/* 
 * TechFusion Master Design System
 * Modern, International Standard UI
 */

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

:root {
    /* Color Palette - Modern Tech (Slate & Blue) */
    --color-primary: #0f172a;
    /* Slate 900 */
    --color-primary-light: #1e293b;
    /* Slate 800 */
    --color-secondary: #3b82f6;
    /* Blue 500 */
    --color-secondary-dark: #2563eb;
    /* Blue 600 */
    --color-accent: #f59e0b;
    /* Amber 500 */

    /* Functional Colors */
    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-error: #ef4444;
    --color-info: #0ea5e9;

    /* Surface & Background */
    --color-background: #f8fafc;
    /* Slate 50 */
    --color-surface: #ffffff;
    --color-surface-hover: #f1f5f9;

    /* Typography Colors */
    --color-text-main: #0f172a;
    --color-text-muted: #64748b;
    /* Slate 500 */
    --color-text-light: #94a3b8;
    /* Slate 400 */
    --color-text-inverted: #ffffff;

    /* Borders */
    --color-border: #e2e8f0;
    /* Slate 200 */
    --color-border-hover: #cbd5e1;
    /* Slate 300 */

    /* Typography */
    --font-heading: 'Poppins', sans-serif;
    --font-body: 'Inter', sans-serif;

    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 2rem;
    --spacing-xl: 4rem;

    /* Shadows (Tailwind-ish) */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

    /* Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 300ms ease;
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background-color: var(--color-background);
    color: var(--color-text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    color: var(--color-text-main);
    line-height: 1.2;
    margin-bottom: var(--spacing-sm);
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
}

h2 {
    font-size: 2rem;
    font-weight: 600;
}

h3 {
    font-size: 1.5rem;
    font-weight: 600;
}

a {
    color: var(--color-secondary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--color-secondary-dark);
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Layout Utilities */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

.grid {
    display: grid;
    gap: var(--spacing-lg);
}

/* Navbar */
.navbar {
    background-color: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: var(--spacing-md) 0;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--color-primary);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.nav-links {
    display: flex;
    gap: var(--spacing-lg);
    align-items: center;
}

.nav-link {
    color: var(--color-text-muted);
    font-weight: 500;
    font-size: 0.95rem;
    transition: color var(--transition-fast);
}

.nav-link:hover,
.nav-link.active {
    color: var(--color-primary);
}

/* Navigation Enhancements */
.nav-divider {
    height: 1px;
    background-color: var(--color-border);
    margin: var(--spacing-sm) 0;
    width: 100%;
}

.desktop-only {
    display: inherit;
}

.mobile-only, .mobile-sidebar, .nav-overlay {
    display: none;
}

@media (max-width: 768px) {
    .desktop-only { display: none !important; }
    .mobile-only { display: inherit !important; }
}

.text-truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Auth Buttons Container */
.auth-buttons-container {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

/* User Dropdown Desktop */
.nav-user-dropdown-container {
    position: relative;
    display: flex;
    align-items: center;
}

.nav-user-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-md);
    transition: background var(--transition-fast);
    color: var(--color-text-main);
    font-family: var(--font-body);
    font-weight: 500;
}

.nav-user-btn:hover {
    background: var(--color-surface-hover);
}

.avatar-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--color-primary-light);
    color: var(--color-surface);
    display: flex;
    align-items: center;
    justify-content: center;
}

.avatar-circle span {
    font-size: 1.25rem;
}

.nav-user-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 220px;
    display: flex;
    flex-direction: column;
    padding: 0.5rem 0;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-fast);
}

.nav-user-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    color: var(--color-text-main);
    font-weight: 500;
    font-size: 0.9rem;
    transition: background var(--transition-fast), color var(--transition-fast);
    text-decoration: none;
}

.dropdown-item .material-icons-outlined {
    font-size: 1.2rem;
    color: var(--color-text-muted);
}

.dropdown-item:hover, .dropdown-item.active {
    background: var(--color-surface-hover);
    color: var(--color-secondary);
}

.dropdown-item:hover .material-icons-outlined, .dropdown-item.active .material-icons-outlined {
    color: var(--color-secondary);
}

.dropdown-item.logout-item:hover {
    color: var(--color-error);
    background: rgba(239, 68, 68, 0.05);
}

.dropdown-item.logout-item:hover .material-icons-outlined {
    color: var(--color-error);
}

.dropdown-divider {
    height: 1px;
    background-color: var(--color-border);
    margin: 0.5rem 0;
}

.mobile-nav-header {
    display: none;
}

/* Mobile Menu Toggle */
.menu-toggle {
    display: none;
    font-size: 1.5rem;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-text-main);
}

/* Mobile Overrides */
@media (max-width: 768px) {
    .desktop-only { display: none !important; }
    .mobile-only { display: inherit !important; }
    
    body.nav-open {
        overflow: hidden;
        position: fixed;
        width: 100%;
        height: 100%;
    }

    .nav-links {
        padding: 0;
        padding-bottom: var(--spacing-xl);
        display: flex;
        position: fixed;
        top: 0;
        right: 0;
        transform: translateX(100%);
        width: 85vw; /* Changed from 300px to strictly fit within viewport */
        max-width: 320px;
        height: 100vh;
        height: 100dvh;
        background: var(--color-surface);
        flex-direction: column;
        box-shadow: -5px 0 25px rgba(0,0,0,0.15);
        transition: transform var(--transition-normal);
        z-index: 1001;
        align-items: stretch;
        overflow-y: auto;
        overflow-x: hidden;
    }

    .nav-links.active {
        transform: translateX(0);
    }

    .menu-toggle {
        display: block;
        z-index: 1002;
        position: relative;
    }

    /* New Global Mobile Sidebar */
    .mobile-sidebar {
        position: fixed;
        top: 0;
        right: 0;
        width: 85vw;
        max-width: 320px;
        height: 100vh;
        height: 100dvh;
        background: var(--color-surface);
        z-index: 9999;
        transform: translateX(100%);
        transition: transform var(--transition-normal);
        display: flex;
        flex-direction: column;
        box-shadow: -5px 0 25px rgba(0,0,0,0.15);
        overflow-y: auto;
    }

    .nav-overlay {
        display: block; /* Override global display: none */
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        backdrop-filter: blur(4px);
        z-index: 9998;
        opacity: 0;
        visibility: hidden;
        transition: all var(--transition-normal);
    }

    .mobile-sidebar.active {
        transform: translateX(0);
    }

    .mobile-nav-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 1.5rem;
        border-bottom: 1px solid var(--color-border);
        background: var(--color-surface);
        position: sticky;
        top: 0;
        z-index: 10;
    }

    .mobile-nav-content {
        padding: 1rem 0;
        display: flex;
        flex-direction: column;
    }

    .mobile-nav-link {
        display: flex;
        align-items: center;
        gap: 1rem;
        padding: 1rem 1.5rem;
        color: var(--color-text-main);
        font-weight: 500;
        font-size: 1.05rem;
        transition: background var(--transition-fast);
        width: 100%;
    }

    .mobile-nav-link:hover, .mobile-nav-link.active {
        background: var(--color-surface-hover);
        color: var(--color-secondary);
    }

    .mobile-nav-link .material-icons-outlined {
        font-size: 1.4rem;
        color: var(--color-text-muted);
    }

    .mobile-nav-link.active .material-icons-outlined {
        color: var(--color-secondary);
    }

    .mobile-nav-divider {
        height: 1px;
        background: var(--color-border);
        margin: 0.75rem 0;
    }

    .mobile-account-header {
        padding: 0.5rem 1.5rem;
        font-size: 0.8rem;
        text-transform: uppercase;
        color: var(--color-text-muted);
        letter-spacing: 0.05em;
        font-weight: 700;
    }

    .mobile-auth-buttons {
        padding: 1.5rem;
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }

    .mobile-logout {
        color: var(--color-error);
    }

    .mobile-logout .material-icons-outlined {
        color: var(--color-error);
    }

    .nav-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background: rgba(0,0,0,0.5);
        z-index: 9998;
        opacity: 0;
        visibility: hidden;
        transition: all var(--transition-normal);
        backdrop-filter: blur(2px);
    }

    .nav-overlay.active {
        opacity: 1;
        visibility: visible;
    }

    .mobile-close-btn {
        background: transparent;
        border: none;
        color: var(--color-text-muted);
        cursor: pointer;
        padding: 0.5rem;
        border-radius: var(--radius-sm);
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
    gap: 0.5rem;
    font-size: 1rem;
}

.btn-primary {
    background-color: var(--color-primary);
    color: var(--color-text-inverted);
}

.btn-primary:hover {
    background-color: var(--color-primary-light);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background-color: var(--color-surface);
    color: var(--color-text-main);
    border: 1px solid var(--color-border);
}

.btn-secondary:hover {
    background-color: var(--color-surface-hover);
    border-color: var(--color-border-hover);
}

.btn-accent {
    background-color: var(--color-accent);
    color: var(--color-primary);
}

.btn-accent:hover {
    filter: brightness(110%);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* Hero Section */
.hero {
    overflow: hidden;
    position: relative;
    padding: 3rem 0;
    /* Reduced padding on mobile */
}

@media (min-width: 768px) {
    .hero {
        padding: 5rem 0;
    }

    .hero .container {
        display: grid;
        grid-template-columns: 1fr 1fr;
        align-items: center;
        gap: var(--spacing-xl);
    }
}

.hero-content {
    max-width: 600px;
}

.hero-title {
    font-size: 3.5rem;
    line-height: 1.1;
    margin-bottom: var(--spacing-md);
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--color-text-muted);
    margin-bottom: var(--spacing-lg);
}

.hero-visual {
    position: relative;
    display: none;
}

@media (min-width: 768px) {
    .hero-visual {
        display: block;
    }
}

.hero-card-stack {
    position: relative;
    width: 100%;
    height: 400px;
}

.card-layer {
    position: absolute;
    width: 80%;
    height: 100%;
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--color-border);
    transition: transform var(--transition-normal);
}

.card-layer:nth-child(1) {
    transform: rotate(-6deg) translateX(-20px) scale(0.9);
    z-index: 1;
    background: var(--color-secondary);
    opacity: 0.2;
}

.card-layer:nth-child(2) {
    transform: rotate(6deg) translateX(20px) scale(0.95);
    z-index: 2;
    background: var(--color-primary);
    opacity: 0.1;
}

.card-layer:nth-child(3) {
    transform: rotate(0deg);
    z-index: 3;
    overflow: hidden;
    background: var(--color-surface);
}

/* Cards */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition-normal);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--color-secondary);
}

.card-image {
    height: 200px;
    background: var(--color-background);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-normal);
}

.card:hover .card-image img {
    transform: scale(1.05);
}

.card-content {
    padding: var(--spacing-md);
}

.card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-sm);
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

.card-title {
    font-size: 1.25rem;
    margin-bottom: var(--spacing-sm);
}

.card-price {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-primary);
}

/* Footer */
.footer {
    background-color: var(--color-primary);
    color: var(--color-text-inverted);
    padding: var(--spacing-xl) 0 var(--spacing-lg);
    margin-top: var(--spacing-xl);
}

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

.footer-col h4 {
    color: var(--color-text-inverted);
    margin-bottom: var(--spacing-md);
}

.footer-links li {
    margin-bottom: var(--spacing-sm);
}

.footer-links a {
    color: var(--color-text-light);
    transition: color var(--transition-fast);
}

.footer-links a:hover {
    color: var(--color-text-inverted);
}

.footer-bottom {
    text-align: center;
    padding-top: var(--spacing-lg);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--color-text-light);
    font-size: 0.875rem;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

.animate-fade-in {
    animation: fadeIn 0.6s ease-out forwards;
}

/* Utilities */
.text-center {
    text-align: center;
}

.mb-1 {
    margin-bottom: var(--spacing-sm);
}

.mb-2 {
    margin-bottom: var(--spacing-md);
}

.mb-4 {
    margin-bottom: var(--spacing-lg);
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-new {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--color-success);
}

/* Auth Pages */
.auth-wrapper {
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-lg) 0;
}

.auth-card {
    background: var(--color-surface);
    width: 100%;
    max-width: 460px;
    padding: 2.5rem;
    border-radius: 1rem;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--color-border);
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--color-text-muted);
    font-size: 0.875rem;
    font-weight: 500;
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-background);
    color: var(--color-text-main);
    transition: all var(--transition-fast);
    outline: none;
    font-family: var(--font-body);
    font-size: 1rem;
}

.form-input:focus {
    border-color: var(--color-secondary);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
    background: var(--color-surface);
}

.auth-card h2 {
    text-align: center;
    color: var(--color-primary);
    margin-bottom: 0.5rem;
}

.auth-card p {
    text-align: center;
    color: var(--color-text-muted);
    margin-bottom: 2rem;
}

.alert {
    padding: 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    border: 1px solid transparent;
}

.alert-success {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--color-success);
    border-color: rgba(16, 185, 129, 0.2);
}

.alert-error {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--color-error);
    border-color: rgba(239, 68, 68, 0.2);
}

.divider {
    position: relative;
    text-align: center;
    margin: 1.5rem 0;
}

.divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 1px;
    background: var(--color-border);
}

.divider span {
    position: relative;
    background: var(--color-surface);
    padding: 0 1rem;
    color: var(--color-text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}