/* 
 * SwapIt - Modern UI Styles
 * Contemporary design with vibrant colors, smooth animations, and glassmorphism
 */

:root {
    /* Modern Color Palette - HSL based for easy manipulation */
    --color-primary: hsl(200, 95%, 55%);
    --color-primary-dark: hsl(200, 95%, 45%);
    --color-primary-light: hsl(200, 95%, 65%);

    --color-secondary: hsl(280, 75%, 60%);
    --color-secondary-dark: hsl(280, 75%, 50%);
    --color-secondary-light: hsl(280, 75%, 70%);

    --color-accent: hsl(30, 95%, 60%);
    --color-accent-dark: hsl(30, 95%, 50%);

    --color-success: hsl(145, 65%, 50%);
    --color-danger: hsl(355, 75%, 55%);
    --color-warning: hsl(45, 95%, 55%);

    /* Neutrals */
    --color-dark: hsl(220, 20%, 15%);
    --color-muted: hsl(220, 15%, 45%);
    --color-light: hsl(220, 40%, 98%);
    --color-white: hsl(0, 0%, 100%);

    /* Background gradients */
    --bg-gradient: linear-gradient(135deg, hsl(220, 40%, 98%) 0%, hsl(280, 40%, 98%) 100%);
    --bg-gradient-dark: linear-gradient(135deg, hsl(220, 30%, 12%) 0%, hsl(280, 35%, 15%) 100%);

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.16);
    --shadow-xl: 0 24px 64px rgba(0, 0, 0, 0.20);

    /* Border radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 999px;

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;

    /* Transitions */
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);

    /* Sidebar */
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 80px;
}

/* ===========================
   BASE STYLES
   =========================== */

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

body {
    font-family: 'Inter', 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-gradient);
    color: var(--color-dark);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    margin: 0;
    padding: 0;
}

/* Import Inter font for modern typography */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ===========================
   LAYOUT
   =========================== */

.container {
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    padding: 0 var(--space-xl) var(--space-lg);
    box-sizing: border-box;
}

.container-narrow {
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
    padding: 0 var(--space-xl) var(--space-lg);
    box-sizing: border-box;
}

/* 14-inch laptop and smaller */
@media (max-width: 1440px) {
    .container {
        padding: 0 var(--space-lg) var(--space-lg);
    }

    .container-narrow {
        padding: 0 var(--space-lg) var(--space-lg);
    }

    .site-nav {
        padding: 0 var(--space-lg);
    }
}

/* ===========================
   SIDEBAR LAYOUT (for authenticated pages)
   =========================== */

.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px) saturate(180%);
    border-right: 1px solid rgba(0, 0, 0, 0.08);
    padding: var(--space-xl);
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
    z-index: 100;
    transition: transform var(--transition-base);
    box-shadow: var(--shadow-md);
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding-bottom: var(--space-lg);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.sidebar-logo {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    object-fit: contain;
}

.sidebar-title {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    flex: 1;
    overflow: visible;
}

.sidebar-section-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--color-muted);
    font-weight: 700;
    margin: var(--space-lg) 0 var(--space-sm);
    padding-left: var(--space-md);
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--color-muted);
    font-weight: 500;
    transition: all var(--transition-base);
    position: relative;
    overflow: visible;
}

/* Message badge styling */
.message-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: linear-gradient(135deg, #ff4757, #ff6348);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 7px;
    border-radius: 12px;
    min-width: 20px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(255, 71, 87, 0.4);
    animation: pulse 2s ease-in-out infinite;
    z-index: 10;
    border: 2px solid white;
    line-height: 1.2;
}

/* Message badge on notification bell - different color for better visibility */
#notificationBtn .message-badge {
    background: linear-gradient(135deg, #00d2ff, #3a7bd5);
    box-shadow: 0 2px 8px rgba(0, 210, 255, 0.5);
    border: 2px solid white;
    top: -4px;
    right: -4px;
}

/* Ensure sidebar nav doesn't clip badges */
.sidebar-nav {
    overflow: visible;
}

.sidebar-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--color-primary);
    transform: scaleY(0);
    transition: transform var(--transition-base);
}

.sidebar-link:hover {
    background: rgba(0, 0, 0, 0.04);
    color: var(--color-dark);
    transform: translateX(4px);
}

.sidebar-link.active {
    background: linear-gradient(135deg, rgba(31, 182, 255, 0.1), rgba(108, 92, 231, 0.1));
    color: var(--color-primary);
    font-weight: 600;
}

.sidebar-link.active::before {
    transform: scaleY(1);
}

.sidebar-icon {
    font-size: 1.25rem;
    width: 24px;
    text-align: center;
}

.sidebar-footer {
    padding-top: var(--space-lg);
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
    padding: var(--space-xl);
}

/* Mobile sidebar */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
        padding: var(--space-md);
        box-shadow: 2px 0 20px rgba(0, 0, 0, 0.15);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .sidebar-toggle {
        position: fixed;
        top: var(--space-lg);
        left: var(--space-lg);
        z-index: 99;
        background: var(--color-white);
        border: none;
        border-radius: var(--radius-md);
        padding: var(--space-md);
        box-shadow: var(--shadow-md);
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Mobile sidebar header */
    .sidebar-header {
        padding-bottom: var(--space-md);
        margin-bottom: var(--space-md);
    }

    .sidebar-logo {
        width: 40px;
        height: 40px;
    }

    /* Mobile sidebar navigation */
    .sidebar-nav {
        gap: var(--space-xs);
    }

    .sidebar-link {
        padding: var(--space-sm) var(--space-md);
        font-size: 0.875rem;
        gap: var(--space-sm);
    }

    .sidebar-icon {
        font-size: 1.1rem;
        width: 20px;
    }

    .sidebar-section-title {
        font-size: 0.7rem;
        margin: var(--space-md) 0 var(--space-xs);
        padding-left: var(--space-sm);
    }

    /* Mobile sidebar footer */
    .sidebar-footer {
        padding-top: var(--space-md);
        margin-top: auto;
    }

    .btn-logout {
        padding: var(--space-sm) var(--space-md);
        font-size: 0.875rem;
    }

    .btn-logout i {
        font-size: 1rem;
    }
}

/* ===========================
   NAVIGATION (for public pages)
   =========================== */

.site-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px) saturate(180%);
    box-shadow: var(--shadow-md);
    position: relative;
    z-index: 50;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    width: 100%;
    max-height: 84px;
    height: 84px;
}

.site-nav > * {
    max-width: 1400px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-xl);
}

.brand {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    text-decoration: none;
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.brand img {
    width: 150px;
    height: 150px;
    border-radius: var(--radius-sm);
    object-fit: contain;
}

.sidebar-logo {
    width: 150px;
    height: 150px;
    border-radius: var(--radius-md);
    object-fit: contain;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

/* Remove body padding since navbar is not fixed */
body {
    padding-top: 0;
}

/* ===========================
   BUTTONS
   =========================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-xl);
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
    white-space: nowrap;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    color: var(--color-white);
    box-shadow: 0 8px 24px rgba(31, 182, 255, 0.25);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(31, 182, 255, 0.35);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--color-accent), var(--color-accent-dark));
    color: var(--color-white);
    box-shadow: 0 8px 24px rgba(255, 154, 46, 0.25);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(255, 154, 46, 0.35);
}

.btn-ghost {
    background: transparent;
    color: var(--color-muted);
    border: 2px solid rgba(0, 0, 0, 0.1);
}

.btn-ghost:hover {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.15);
    color: var(--color-dark);
}

.btn-cancel {
    background: transparent;
    color: var(--color-muted);
    border: 2px solid rgba(0, 0, 0, 0.1);
}

.btn-cancel:hover {
    background: rgba(0, 0, 0, 0.04);
    border-color: var(--color-danger);
    color: var(--color-danger);
}

.btn-icon {
    padding: var(--space-md);
    border-radius: var(--radius-md);
}

.btn.selected {
    background: linear-gradient(135deg, var(--color-secondary), var(--color-secondary-dark));
    color: var(--color-white);
    border-color: transparent;
    box-shadow: 0 6px 20px rgba(108, 92, 231, 0.25);
}

/* Logout button */
.nav-logout,
.btn-logout {
    background: var(--color-primary);
    color: var(--color-white);
    border: none;
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-full);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    box-shadow: 0 6px 20px rgba(31, 182, 255, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    width: 100%;
}

.nav-logout:hover,
.btn-logout:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(31, 182, 255, 0.35);
}

.btn-logout i,
.btn-logout .fa-right-from-bracket {
    color: var(--color-secondary) !important;
}

.btn-logout span {
    color: var(--color-white);
}

/* ===========================
   CARDS
   =========================== */

.card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px) saturate(180%);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(255, 255, 255, 0.5);
    transition: all var(--transition-base);
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.auth-card {
    max-width: 480px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px) saturate(180%);
    border-radius: var(--radius-xl);
    padding: var(--space-2xl);
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255, 255, 255, 0.5);
    animation: slideUp var(--transition-slow) var(--transition-bounce);
}

.auth-card h2 {
    font-size: 2rem;
    margin-bottom: var(--space-md);
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Listing cards */
.listing-card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px) saturate(180%);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(255, 255, 255, 0.5);
    transition: all var(--transition-base);
    cursor: pointer;
}

.listing-card:hover {
    transform: translateY(-6px) scale(1.02);
    box-shadow: var(--shadow-lg);
    border-color: var(--color-primary);
}

.listing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: var(--space-lg);
    margin-top: var(--space-xl);
}

/* ===========================
   FORMS
   =========================== */

.form-row {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-lg);
}

label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-dark);
    margin-bottom: var(--space-xs);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="tel"],
input[type="file"],
select,
textarea {
    width: 100%;
    padding: var(--space-md) var(--space-lg);
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-family: inherit;
    background: var(--color-white);
    transition: all var(--transition-base);
    outline: none;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px rgba(31, 182, 255, 0.1);
    transform: translateY(-2px);
}

input::placeholder {
    color: var(--color-muted);
}

/* Custom file input */
input[type="file"] {
    padding: var(--space-md);
    cursor: pointer;
}

/* ===========================
   HERO SECTION
   =========================== */

.hero {
    text-align: center;
    padding: var(--space-xl) 0 var(--space-xxl);
    animation: slideUp 1.2s ease-out;
}

.hero h1 {
    font-size: 3rem;
    font-weight: 900;
    line-height: 1.2;
    margin-bottom: var(--space-lg);
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary), var(--color-accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: fadeIn 1s ease-out 0.3s both;
}

.hero p {
    font-size: 1.25rem;
    color: var(--color-muted);
    max-width: 700px;
    margin: 0 auto var(--space-xl);
}

.hero-actions {
    display: flex;
    gap: var(--space-lg);
    justify-content: center;
    margin-bottom: var(--space-2xl);
}

/* Feature cards */
.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-xl);
    margin-top: var(--space-2xl);
}

.feature {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px) saturate(180%);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(255, 255, 255, 0.5);
    transition: all var(--transition-base);
    animation: slideUp var(--transition-slow) var(--transition-bounce);
    animation-fill-mode: both;
}

.feature:nth-child(1) {
    animation-delay: 0.1s;
}

.feature:nth-child(2) {
    animation-delay: 0.2s;
}

.feature:nth-child(3) {
    animation-delay: 0.3s;
}

.feature:hover {
    transform: translateY(-8px) rotate(1deg);
    box-shadow: var(--shadow-xl);
}

.feature h3 {
    font-size: 1.5rem;
    margin-bottom: var(--space-md);
    color: var(--color-dark);
}

.feature p {
    color: var(--color-muted);
    line-height: 1.6;
}

/* ===========================
   HEADER (for main content area in app layout)
   =========================== */

.main-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-lg) var(--space-xl);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px) saturate(180%);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--space-xl);
    position: relative;
    z-index: 100;
}

.main-header h1 {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Search bar */
.search-bar {
    display: flex;
    gap: var(--space-md);
    align-items: center;
    flex-wrap: wrap;
}

.search-input {
    min-width: 300px;
    flex: 1;
}

/* Category filters */
.category-filters {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
    margin-bottom: var(--space-lg);
}

/* ===========================
   UTILITY CLASSES
   =========================== */

.small {
    font-size: 0.9rem;
    color: var(--color-muted);
}

.link {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 600;
    transition: all var(--transition-fast);
}

.link:hover {
    color: var(--color-primary-dark);
    text-decoration: underline;
}

.text-center {
    text-align: center;
}

.text-muted {
    color: var(--color-muted);
}

/* ===========================
   FOOTER
   =========================== */

.site-footer {
    text-align: center;
    padding: var(--space-2xl) 0;
    color: var(--color-muted);
    margin-top: var(--space-2xl);
}

.site-footer p {
    margin: 0;
}

/* ===========================
   ANIMATIONS
   =========================== */

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideRight {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

/* Loading spinner */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ===========================
   DECORATIVE ELEMENTS
   =========================== */

.bg-decoration {
    position: fixed;
    pointer-events: none;
    z-index: -1;
}

.bg-decoration-1 {
    top: -10%;
    right: -10%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(31, 182, 255, 0.15) 0%, transparent 70%);
    border-radius: 50%;
    animation: float 8s ease-in-out infinite;
}

.bg-decoration-2 {
    bottom: -10%;
    left: -10%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(108, 92, 231, 0.12) 0%, transparent 70%);
    border-radius: 50%;
    animation: float 10s ease-in-out infinite reverse;
}

/* ===========================
   RESPONSIVE DESIGN
   =========================== */

/* Tablet (1024px and below) */
@media (max-width: 1024px) {
    :root {
        --sidebar-width: 220px;
    }

    .hero h1 {
        font-size: 2.5rem;
    }

    .listing-grid,
    .items-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }

    .auth-card {
        max-width: 600px;
    }

    .main-content {
        padding: var(--space-lg);
    }

    /* Item cards on tablet */
    .item-card {
        max-width: 100%;
    }
}

/* Mobile (768px and below) */
@media (max-width: 768px) {
    html {
        font-size: 15px;
    }

    .container {
        padding: var(--space-md);
    }

    /* Hero adjustments */
    .hero h1 {
        font-size: 1.75rem;
        line-height: 1.3;
    }

    .hero p {
        font-size: 0.95rem;
    }

    .hero-actions {
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-md);
    }

    /* Features grid */
    .features {
        grid-template-columns: 1fr;
        gap: var(--space-lg);
    }

    /* Listing grid */
    .listing-grid {
        grid-template-columns: 1fr;
        gap: var(--space-md);
    }

    /* Auth card */
    .auth-card {
        padding: var(--space-lg);
        max-width: 100%;
        margin: var(--space-md);
    }

    .auth-card h2 {
        font-size: 1.5rem;
        line-height: 1.3;
    }

    /* Navigation */
    .site-nav {
        padding: var(--space-md);
        flex-wrap: wrap;
        gap: var(--space-sm);
    }

    .nav-actions {
        gap: var(--space-sm);
    }

    /* Buttons - reduced text size for mobile */
    .btn {
        padding: var(--space-md) var(--space-lg);
        font-size: 0.8rem;
        white-space: nowrap;
    }

    .btn-sm {
        font-size: 0.7rem !important;
    }

    .btn-primary,
    .btn-secondary,
    .btn-ghost,
    .btn-cancel {
        font-size: 0.8rem;
    }

    /* Button icons on mobile */
    .btn i {
        font-size: 0.85rem;
    }

    /* Forms - stack fields vertically on mobile */
    .form-grid,
    div[style*="grid-template-columns: 1fr 1fr"],
    div[style*="grid-template-columns: 1fr 1fr;"],
    div[style*="display: grid"],
    div[style*="display: grid;"] {
        grid-template-columns: 1fr !important;
    }

    /* Main header */
    .main-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-md);
        padding: var(--space-md) var(--space-lg);
    }

    .main-header h1 {
        font-size: 1.5rem;
        line-height: 1.3;
    }

    .main-header p {
        font-size: 0.85rem;
    }

    /* Main content padding */
    .main-content {
        padding: var(--space-md);
    }

    /* Search bar - enhanced mobile styles */
    .search-bar {
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-sm);
        padding: var(--space-lg) !important;
    }

    .search-bar > div {
        width: 100%;
    }

    .search-input {
        min-width: 100%;
        font-size: 0.9rem !important;
        padding: 0.875rem 1rem !important;
    }

    .search-bar input,
    .search-bar select {
        min-width: 100%;
        font-size: 0.9rem !important;
        padding: 0.875rem 1rem !important;
    }

    .search-bar button {
        width: 100%;
        font-size: 0.9rem !important;
        padding: 0.875rem 1.5rem !important;
    }

    /* Category filters */
    .category-filters {
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: var(--space-xs);
    }

    .category-filters .btn {
        font-size: 0.75rem;
        padding: var(--space-xs) var(--space-sm);
        white-space: nowrap;
    }

    /* Messages page - responsive layout */
    .messages-container {
        grid-template-columns: 1fr;
        height: calc(100vh - 120px);
    }

    .threads-list {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 10;
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(20px);
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .threads-list.active {
        transform: translateX(0);
    }

    .messages-view {
        width: 100%;
    }

    /* Item cards - full width on mobile */
    .item-card {
        width: 100%;
        max-width: 100%;
    }

    .listing-card {
        padding: var(--space-md);
    }

    .listing-card h3 {
        font-size: 1.1rem;
        line-height: 1.3;
    }

    .listing-card p {
        font-size: 0.85rem;
    }

    /* Trading items section */
    .trading-items {
        flex-wrap: wrap;
    }

    .swap-section {
        min-width: 100%;
    }

    .swap-arrow {
        transform: rotate(90deg);
        margin: 0.5rem 0;
    }

    /* Action buttons - responsive */
    #actionButtons {
        flex-wrap: wrap;
        gap: var(--space-sm);
    }

    #actionButtons .btn {
        flex: 1;
        min-width: 120px;
    }

    /* Chat header - stack on mobile */
    .messages-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .chat-user-info {
        width: 100%;
    }

    /* Modal adjustments */
    .modal-content {
        width: 95%;
        max-width: 95%;
        margin: 1rem auto;
        max-height: 90vh;
        overflow-y: auto;
    }

    /* Swap modal items grid */
    .swap-modal-items {
        grid-template-columns: 1fr !important;
    }

    /* Profile form sections */
    .auth-card > div[style*="margin-bottom: 2rem"] {
        margin-bottom: 1.5rem !important;
    }

    .auth-card h3 {
        font-size: 1rem !important;
    }

    /* Image upload areas */
    .image-upload-area {
        min-height: 150px;
    }

    /* Sidebar link text - can be hidden on very small screens if needed */
    .sidebar-link span:last-child {
        display: block;
    }

    /* Stats container */
    #marketStats {
        flex-wrap: wrap;
        gap: var(--space-sm);
    }

    #marketStats > div {
        font-size: 0.8rem;
        padding: 0.5rem 0.875rem;
    }

    /* Oasis filter */
    #oasisFilterContainer label {
        font-size: 0.85rem;
        padding: var(--space-sm) var(--space-md);
    }

    /* Welcome message */
    #welcomeMsg {
        font-size: 0.8rem;
    }

    /* Form labels and small text */
    label {
        font-size: 0.85rem;
    }

    .small {
        font-size: 0.8rem;
    }

    /* Prevent text wrapping in buttons */
    .btn,
    .btn-primary,
    .btn-secondary {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

/* Medium screens (768px - 1024px) */
@media (max-width: 1024px) and (min-width: 769px) {
    html {
        font-size: 15px;
    }

    .main-content {
        padding: var(--space-lg);
    }

    .messages-container {
        grid-template-columns: 280px 1fr;
        gap: 1rem;
    }

    .listing-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }

    .search-bar {
        flex-wrap: wrap;
    }

    .search-bar > div {
        flex: 1 1 auto;
        min-width: 150px;
    }
}

/* Small mobile (480px and below) */
@media (max-width: 480px) {
    html {
        font-size: 14px;
    }

    /* Typography */
    .hero h1 {
        font-size: 1.5rem;
        line-height: 1.3;
    }

    .hero p {
        font-size: 0.875rem;
    }

    /* Brand */
    .brand {
        font-size: 1rem;
    }

    .brand img {
        width: 32px;
        height: 32px;
    }

    /* Buttons - slightly larger for better touch targets but smaller text */
    .btn {
        padding: 0.75rem 1rem;
        font-size: 0.75rem;
        min-height: 44px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .btn-sm {
        font-size: 0.7rem !important;
        padding: 0.7rem 0.9rem;
    }

    .btn-primary,
    .btn-secondary,
    .btn-ghost,
    .btn-cancel {
        font-size: 0.75rem;
    }

    /* Button icons on small mobile */
    .btn i {
        font-size: 0.8rem;
    }

    .btn-logout {
        font-size: 0.75rem;
        padding: 0.75rem 1rem;
    }

    /* Auth card */
    .auth-card {
        padding: var(--space-md);
        margin: var(--space-sm);
    }

    .auth-card h2 {
        font-size: 1.25rem;
        line-height: 1.3;
    }

    /* Form sections */
    .auth-card h3 {
        font-size: 0.9rem !important;
    }

    .auth-card p.small {
        font-size: 0.75rem;
    }

    /* Input fields - larger touch targets */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="date"],
    input[type="file"],
    select,
    textarea {
        padding: 0.75rem 0.875rem;
        font-size: 16px;
        /* Prevents zoom on iOS */
        min-height: 44px;
    }

    /* Radio buttons and checkboxes - larger touch areas */
    input[type="radio"],
    input[type="checkbox"] {
        width: 20px;
        height: 20px;
    }

    /* Listing cards */
    .listing-card {
        padding: var(--space-md);
    }

    .listing-card h3 {
        font-size: 1rem;
        line-height: 1.3;
    }

    .listing-card p {
        font-size: 0.8rem;
        line-height: 1.4;
    }

    /* Feature cards */
    .feature {
        padding: var(--space-lg);
    }

    .feature h3 {
        font-size: 1.1rem;
    }

    .feature p {
        font-size: 0.875rem;
    }

    /* Sidebar adjustments */
    .sidebar {
        width: 260px;
    }

    .sidebar-title {
        font-size: 1.1rem;
    }

    .sidebar-logo {
        width: 36px;
        height: 36px;
    }

    /* Main content with sidebar */
    .main-content {
        padding: var(--space-sm);
    }

    .main-header {
        padding: var(--space-md);
        margin-bottom: var(--space-md);
    }

    .main-header h1 {
        font-size: 1.25rem;
        line-height: 1.3;
    }

    /* Navigation actions - stack if needed */
    .nav-actions {
        flex-wrap: wrap;
        gap: var(--space-xs);
    }

    /* Container */
    .container {
        padding: var(--space-sm);
    }

    /* Section spacing */
    div[style*="margin-bottom: 2rem"] {
        margin-bottom: 1rem !important;
    }

    /* Search bar - stack on mobile */
    .search-bar {
        flex-direction: column;
        gap: var(--space-sm);
        padding: var(--space-md) !important;
    }

    .search-bar > div {
        width: 100%;
        flex: 1 !important;
    }

    .search-bar input,
    .search-bar select,
    .search-bar button {
        width: 100%;
        font-size: 0.875rem !important;
        padding: 0.75rem 1rem !important;
    }

    /* Category filters */
    .category-filters {
        gap: var(--space-xs);
        margin-bottom: var(--space-md);
    }

    .category-filters .btn {
        font-size: 0.7rem;
        padding: 0.5rem 0.75rem;
    }

    /* Messages page - stack columns */
    .messages-container {
        grid-template-columns: 1fr !important;
        height: auto;
        gap: 0;
    }

    .threads-list {
        max-height: 250px;
        border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    }

    .messages-view {
        min-height: calc(100vh - 300px);
    }

    /* Trading items - stack vertically */
    .trading-items {
        flex-direction: column;
        gap: 0.75rem;
    }

    .swap-arrow {
        transform: rotate(90deg);
    }

    /* Action buttons - stack on mobile */
    #actionButtons {
        flex-direction: column;
        width: 100%;
        gap: var(--space-sm);
    }

    #actionButtons .btn {
        width: 100%;
    }

    /* Message bubbles - full width on mobile */
    .message {
        max-width: 85% !important;
        font-size: 0.875rem;
    }

    /* Contact info - stack on mobile */
    .contact-info-section > div {
        grid-template-columns: 1fr !important;
    }

    /* Stats in header */
    #marketStats {
        flex-direction: column;
        gap: var(--space-xs);
        width: 100%;
    }

    #marketStats > div {
        font-size: 0.75rem;
        padding: 0.5rem 0.75rem;
    }

    /* Oasis filter */
    #oasisFilterContainer {
        margin-bottom: var(--space-md);
    }

    #oasisFilterContainer label {
        padding: var(--space-sm) var(--space-md);
        font-size: 0.8rem;
    }

    /* Listing grid adjustments */
    .listing-grid {
        gap: var(--space-md);
        margin-top: var(--space-md);
    }

    /* Item card images */
    .listing-card img,
    .carousel-image {
        max-height: 180px;
    }

    /* Profile form grid */
    .auth-card form > div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
        gap: var(--space-sm) !important;
    }

    /* Form labels */
    label {
        font-size: 0.8rem;
    }

    /* Small text */
    .small {
        font-size: 0.7rem;
    }
}

/* Medium mobile (481px - 640px) */
@media (min-width: 481px) and (max-width: 640px) {
    html {
        font-size: 15px;
    }

    .main-content {
        padding: var(--space-md);
    }

    .main-header {
        padding: var(--space-md) var(--space-lg);
    }

    .main-header h1 {
        font-size: 1.5rem;
    }

    .search-bar {
        flex-wrap: wrap;
        gap: var(--space-sm);
        padding: var(--space-lg) !important;
    }

    .search-bar > div {
        flex: 1 1 calc(50% - 0.5rem);
        min-width: 140px;
    }

    .search-bar > div:first-child {
        flex: 1 1 100%;
    }

    .search-bar button {
        flex: 1 1 100%;
    }

    .btn {
        font-size: 0.8rem;
        padding: 0.8rem 1.2rem;
    }

    .auth-card h2 {
        font-size: 1.5rem;
    }

    .listing-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: var(--space-md);
    }

    .listing-card h3 {
        font-size: 1.1rem;
    }

    .category-filters .btn {
        font-size: 0.75rem;
        padding: 0.6rem 0.9rem;
    }
}

/* ===========================
   ACCESSIBILITY
   =========================== */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid var(--color-primary);
    outline-offset: 2px;
}

/* ===========================
   PRINT STYLES
   =========================== */

@media print {

    .sidebar,
    .site-nav,
    .nav-actions,
    .btn,
    .site-footer {
        display: none;
    }

    .main-content {
        margin-left: 0;
    }

    body {
        background: white;
    }
}

/* ===========================
   NOTIFICATIONS
   =========================== */

#notificationContainer {
    position: relative;
    z-index: 9999;
}

.notification-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: var(--color-error);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.notification-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 320px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    margin-top: 10px;
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid rgba(0, 0, 0, 0.05);
    overflow: hidden;
    z-index: 10000;
}

.notification-dropdown.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.notification-header {
    padding: 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.notification-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.notification-list {
    max-height: 400px;
    overflow-y: auto;
}

.notification-item {
    padding: 1rem;
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
    position: relative;
}

.notification-item:hover {
    background: #f8f9fa;
}

.notification-item.unread {
    background: rgba(var(--color-primary-rgb), 0.03);
}

.notification-icon {
    width: 40px;
    height: 40px;
    background: #f1f2f6;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.notification-content {
    flex: 1;
}

.notification-text {
    font-size: 0.9rem;
    line-height: 1.4;
    color: var(--color-dark);
    margin-bottom: 0.25rem;
}

.notification-time {
    font-size: 0.75rem;
    color: var(--color-muted);
}

.notification-dot {
    width: 8px;
    height: 8px;
    background: var(--color-primary);
    border-radius: 50%;
    margin-top: 6px;
}

.empty-state {
    padding: 2rem;
    text-align: center;
    color: var(--color-muted);
    font-size: 0.9rem;
}

.btn-text {
    background: none;
    border: none;
    color: var(--color-primary);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
}

.btn-text:hover {
    text-decoration: underline;
}

/* Carousel Styles */
.image-carousel {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: 12px;
}

.carousel-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
    transition: opacity 0.5s ease;
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    /* Increased z-index */
    transition: background 0.3s ease;
}

.carousel-btn:hover {
    background: rgba(0, 0, 0, 0.8);
}

.carousel-prev {
    left: 10px;
}

.carousel-next {
    right: 10px;
}

.carousel-dots {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 20;
    /* Increased z-index */
}

.carousel-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: background 0.3s ease;
}

.carousel-dot.active {
    background: white;
}

/* ===========================
   MOBILE-SPECIFIC OVERRIDES FOR INLINE STYLES
   =========================== */

/* Override inline font sizes on mobile */
@media (max-width: 768px) {
    /* Search bar inline styles */
    .search-bar input[style*="font-size: 1.1rem"],
    .search-bar input[style*="font-size: 1rem"] {
        font-size: 0.9rem !important;
    }

    .search-bar select[style*="font-size: 1rem"] {
        font-size: 0.9rem !important;
    }

    .search-bar button[style*="font-size: 1.1rem"] {
        font-size: 0.9rem !important;
    }

    /* Header text sizes */
    h1[style*="font-size"],
    h2[style*="font-size"],
    h3[style*="font-size"] {
        font-size: clamp(1rem, 4vw, 1.5rem) !important;
        line-height: 1.3 !important;
    }

    /* Prevent text wrapping in headers and buttons */
    h1, h2, h3, h4, h5, h6 {
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
    }

    /* Ensure buttons don't wrap */
    button, .btn {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }

    /* Grid layouts - force single column on very small screens */
    @media (max-width: 480px) {
        div[style*="grid-template-columns: 1fr 1fr"],
        div[style*="grid-template-columns: repeat(2"],
        div[style*="display: grid"][style*="grid-template-columns"] {
            grid-template-columns: 1fr !important;
        }

        /* Flex layouts - stack on mobile */
        div[style*="display: flex"][style*="gap: 1rem"] {
            flex-direction: column !important;
            gap: var(--space-sm) !important;
        }
    }

    /* Padding adjustments for mobile */
    div[style*="padding: 1.5rem"],
    div[style*="padding: 2rem"] {
        padding: var(--space-md) !important;
    }

    /* Margin adjustments */
    div[style*="margin-bottom: 2rem"] {
        margin-bottom: var(--space-md) !important;
    }

    /* Font size adjustments for small text */
    p[style*="font-size"],
    span[style*="font-size"],
    div[style*="font-size"] {
        font-size: clamp(0.75rem, 3vw, 0.9rem) !important;
    }

    /* Ensure images don't overflow */
    img {
        max-width: 100%;
        height: auto;
    }

    /* Carousel buttons - larger touch targets on mobile */
    .carousel-btn {
        width: 36px !important;
        height: 36px !important;
    }

    /* Notification dropdown - full width on mobile */
    .notification-dropdown {
        width: calc(100vw - 2rem) !important;
        max-width: 320px;
        right: 1rem;
        left: auto;
    }
}

/* Very small screens - additional optimizations */
@media (max-width: 360px) {
    html {
        font-size: 13px;
    }

    .btn {
        font-size: 0.7rem;
        padding: 0.7rem 0.9rem;
    }

    .main-header h1 {
        font-size: 1.1rem;
    }

    .auth-card h2 {
        font-size: 1.1rem;
    }

    .search-bar {
        padding: var(--space-sm) !important;
    }

    .search-bar input,
    .search-bar select,
    .search-bar button {
        font-size: 0.8rem !important;
        padding: 0.7rem 0.875rem !important;
    }
}