/* ==========================================================================
   ImageTag AI / Image Analysis & Tagging
   Main Stylesheet
   ==========================================================================
   TABLE OF CONTENTS
   01. CSS Reset & Base
   02. CSS Variables (Design Tokens)
   03. Reusable Components (Buttons, Alerts, Cards, Forms)
   04. Navbar (Public Pages)
   05. Hero Section (index.html)
   06. Features Section
   07. How It Works Section
   08. About Section
   09. Footer
   10. Auth Pages (login.html, signup.html)
   11. Dashboard Layout (sidebar + main)
   12. Dashboard Components (stats, cards, upload)
   13. Upload Page
   14. Results Page
   15. History Page
   16. History Detail Page
   17. Profile / Edit Profile / Change Password
   18. Error Pages (404, 500, error.html)
   19. Utilities & Helpers
   20. Responsive Media Queries
   21. Dark Mode Fixes & Extra Utilities
   ========================================================================== */


/* ==========================================================================
   01. CSS RESET & BASE
   ========================================================================== */

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

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: "Inter", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont,
        "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-body);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
}

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

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

button,
input,
select,
textarea {
    font-family: inherit;
    font-size: inherit;
}

h1, h2, h3, h4, h5, h6 {
    line-height: 1.25;
    font-weight: 700;
    color: var(--text-primary);
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }

ul, ol {
    list-style: none;
}

::selection {
    background-color: var(--primary);
    color: #ffffff;
}


/* ==========================================================================
   02. CSS VARIABLES (DESIGN TOKENS)
   ========================================================================== */

:root {
    /* Brand colours */
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #eef2ff;
    --primary-soft: #e0e7ff;

    --secondary: #0ea5e9;
    --secondary-dark: #0284c7;

    /* Status colours */
    --success: #16a34a;
    --success-light: #dcfce7;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --warning: #f59e0b;
    --warning-light: #fef3c7;

    /* Neutrals */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-inverse: #ffffff;

    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --bg-subtle: #f1f5f9;
    --bg-dark: #0f172a;

    --border: #e2e8f0;
    --border-strong: #cbd5e1;

    /* Radius */
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.05);
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
    --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.1);
    --shadow-lg: 0 16px 40px rgba(15, 23, 42, 0.12);

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition: 0.25s ease;
    --transition-slow: 0.4s ease;

    /* Layout */
    --container: 1200px;
    --navbar-height: 72px;
    --sidebar-width: 260px;
}


/* ==========================================================================
   03. REUSABLE COMPONENTS
   ========================================================================== */

/* ----- Buttons ----- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 22px;
    border: 2px solid transparent;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    white-space: nowrap;
    transition: all var(--transition);
    line-height: 1.4;
}

.btn:focus-visible {
    outline: 3px solid var(--primary-soft);
    outline-offset: 2px;
}

.btn-primary {
    background-color: var(--primary);
    color: var(--text-inverse);
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.25);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.35);
}

.btn-secondary {
    background-color: transparent;
    color: var(--text-primary);
    border-color: var(--border-strong);
}

.btn-secondary:hover {
    background-color: var(--bg-subtle);
    border-color: var(--primary);
    color: var(--primary);
}

.btn-success {
    background-color: var(--success);
    color: var(--text-inverse);
}

.btn-success:hover {
    background-color: #15803d;
    transform: translateY(-2px);
}

.btn-danger {
    background-color: var(--danger);
    color: var(--text-inverse);
}

.btn-danger:hover {
    background-color: #b91c1c;
    transform: translateY(-2px);
}

.btn-full {
    width: 100%;
}

/* ----- Alerts ----- */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius);
    font-size: 0.92rem;
    font-weight: 500;
    margin-bottom: 18px;
    border-left: 4px solid;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-error,
.alert-danger {
    background-color: var(--danger-light);
    color: #991b1b;
    border-color: var(--danger);
}

.alert-success {
    background-color: var(--success-light);
    color: #166534;
    border-color: var(--success);
}

.alert-warning {
    background-color: var(--warning-light);
    color: #92400e;
    border-color: var(--warning);
}

.alert-info {
    background-color: var(--primary-light);
    color: var(--primary-dark);
    border-color: var(--primary);
}

/* ----- Cards ----- */
.card,
.dashboard-card,
.form-card,
.profile-card,
.history-card,
.result-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

/* ----- Forms ----- */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.form-group input,
.form-group select,
.form-group textarea,
.form-control {
    width: 100%;
    padding: 12px 16px;
    font-size: 0.95rem;
    color: var(--text-primary);
    background-color: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    transition: all var(--transition-fast);
}

.form-group input::placeholder,
.form-control::placeholder {
    color: var(--text-muted);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-light);
}

.form-group input:invalid:not(:placeholder-shown) {
    border-color: var(--danger);
}

.input-help,
.password-help {
    display: block;
    margin-top: 6px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.label-row label {
    margin-bottom: 0;
}

.label-row a {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--primary);
}

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

/* ----- Section Labels ----- */
.section-label,
.card-label,
.hero-badge,
.welcome-label {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--primary);
}

.hero-badge,
.welcome-label {
    padding: 6px 14px;
    background-color: var(--primary-light);
    border-radius: var(--radius-full);
    margin-bottom: 18px;
}


/* ==========================================================================
   04. NAVBAR (PUBLIC PAGES)
   ========================================================================== */

.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

.nav-user {
    padding: 8px 12px;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--primary);
    background-color: var(--primary-light);
    border-radius: var(--radius-full);
}

.nav-container {
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 24px;
    height: var(--navbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo,
.auth-logo,
.sidebar-logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
}

.logo-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #ffffff;
    font-size: 0.85rem;
    font-weight: 800;
    border-radius: var(--radius);
    letter-spacing: 0.02em;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-menu a {
    padding: 8px 14px;
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.nav-menu a:hover {
    color: var(--primary);
    background-color: var(--primary-light);
}

.nav-menu a.active {
    color: var(--primary);
    font-weight: 600;
}

.nav-menu .nav-login {
    color: var(--text-primary);
    font-weight: 600;
    margin-left: 8px;
}

.nav-menu .nav-signup {
    background-color: var(--primary);
    color: #ffffff;
    font-weight: 600;
    padding: 10px 20px;
    border-radius: var(--radius);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

.nav-menu .nav-signup:hover {
    background-color: var(--primary-dark);
    color: #ffffff;
    transform: translateY(-1px);
}


/* ==========================================================================
   05. HERO SECTION (index.html)
   ========================================================================== */

.hero-section {
    padding: 80px 24px 100px;
    background:
        radial-gradient(circle at 15% 20%, rgba(79, 70, 229, 0.08), transparent 45%),
        radial-gradient(circle at 85% 80%, rgba(14, 165, 233, 0.08), transparent 45%),
        var(--bg-body);
    overflow: hidden;
}

.hero-container {
    max-width: var(--container);
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 60px;
    align-items: center;
}

.hero-content h1 {
    font-size: clamp(2.2rem, 5vw, 3.4rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 20px;
}

.hero-content h1 span {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-content > p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 540px;
    margin-bottom: 32px;
}

.hero-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 36px;
}

.hero-features {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.hero-features strong {
    color: var(--success);
    margin-right: 6px;
}

/* Hero visual card */
.hero-visual {
    display: flex;
    justify-content: center;
}

.analysis-card {
    width: 100%;
    max-width: 400px;
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    padding: 24px;
    transform: rotate(1.5deg);
    transition: transform var(--transition-slow);
}

.analysis-card:hover {
    transform: rotate(0deg) translateY(-6px);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 18px;
}

.status-dot {
    color: var(--success);
    font-size: 0.7rem;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}

.image-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 40px 20px;
    background-color: var(--bg-subtle);
    border: 2px dashed var(--border-strong);
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
}

.image-icon {
    font-size: 2rem;
}

.image-placeholder p {
    font-weight: 600;
    color: var(--text-secondary);
}

.image-placeholder small {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.sample-result {
    background-color: var(--bg-subtle);
    border-radius: var(--radius);
    padding: 16px;
}

.result-title {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.tag-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border);
}

.tag-row:last-child {
    border-bottom: none;
}

.tag-row strong {
    color: var(--primary);
}


/* ==========================================================================
   06. FEATURES SECTION
   ========================================================================== */

.features-section {
    padding: 90px 24px;
    background-color: var(--bg-card);
}

.section-heading {
    max-width: 640px;
    margin: 0 auto 56px;
    text-align: center;
}

.section-heading h2 {
    font-size: clamp(1.7rem, 3.5vw, 2.3rem);
    font-weight: 800;
    margin: 12px 0 14px;
    letter-spacing: -0.01em;
}

.section-heading p {
    color: var(--text-secondary);
    font-size: 1.02rem;
}

.features-grid {
    max-width: var(--container);
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
}

.feature-card {
    padding: 32px 26px;
    background-color: var(--bg-body);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    transition: all var(--transition);
}

.feature-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-soft);
    background-color: var(--bg-card);
}

.feature-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    background: linear-gradient(135deg, var(--primary-light), var(--primary-soft));
    color: var(--primary);
    font-size: 1.1rem;
    font-weight: 800;
    border-radius: var(--radius);
    margin-bottom: 18px;
}

.feature-card h3 {
    font-size: 1.1rem;
    margin-bottom: 10px;
}

.feature-card p {
    font-size: 0.93rem;
    color: var(--text-secondary);
}


/* ==========================================================================
   07. HOW IT WORKS SECTION
   ========================================================================== */

.steps-section {
    padding: 90px 24px;
    background-color: var(--bg-body);
}

.steps-container {
    max-width: var(--container);
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
}

.step-card {
    position: relative;
    padding: 36px 28px;
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
    transition: all var(--transition);
}

.step-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-md);
}

.step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #ffffff;
    font-size: 1.1rem;
    font-weight: 800;
    border-radius: var(--radius);
    margin-bottom: 20px;
}

.step-card h3 {
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.step-card p {
    font-size: 0.94rem;
    color: var(--text-secondary);
}


/* ==========================================================================
   08. ABOUT SECTION
   ========================================================================== */

.about-section {
    padding: 90px 24px;
    background-color: var(--bg-card);
    border-top: 1px solid var(--border);
}

.about-container {
    max-width: var(--container);
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 60px;
    align-items: center;
}

.about-content h2 {
    font-size: clamp(1.7rem, 3.5vw, 2.3rem);
    font-weight: 800;
    margin: 12px 0 20px;
    letter-spacing: -0.01em;
}

.about-content p {
    color: var(--text-secondary);
    margin-bottom: 16px;
    font-size: 1rem;
}

.about-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
}

.stat-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 28px 16px;
    background-color: var(--bg-body);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    text-align: center;
    transition: all var(--transition);
}

.stat-box:hover {
    border-color: var(--primary-soft);
    box-shadow: var(--shadow-sm);
    transform: translateY(-3px);
}

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

.stat-box span {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 500;
}


/* ==========================================================================
   09. FOOTER
   ========================================================================== */

.footer {
    background-color: var(--bg-dark);
    color: #cbd5e1;
    padding: 56px 24px 0;
}

.footer-container {
    max-width: var(--container);
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 32px;
    padding-bottom: 40px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.footer h3 {
    color: #ffffff;
    font-size: 1.15rem;
    margin-bottom: 10px;
}

.footer p {
    font-size: 0.9rem;
    color: #94a3b8;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 22px;
    align-items: center;
}

.footer-links a {
    font-size: 0.92rem;
    color: #cbd5e1;
}

.footer-links a:hover {
    color: #ffffff;
}

.footer-bottom {
    max-width: var(--container);
    margin: 0 auto;
    padding: 22px 0;
    text-align: center;
}

.footer-bottom p {
    font-size: 0.85rem;
    color: #64748b;
}


/* ==========================================================================
   10. AUTH PAGES (login.html, signup.html)
   ========================================================================== */

.auth-page {
    background-color: var(--bg-body);
}

.auth-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 100vh;
}

/* Left info panel */
.auth-info {
    position: relative;
    padding: 48px;
    background: linear-gradient(150deg, #1e1b4b 0%, #312e81 50%, #4338ca 100%);
    color: #ffffff;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.auth-info::before {
    content: "";
    position: absolute;
    top: -80px;
    right: -80px;
    width: 320px;
    height: 320px;
    background: radial-gradient(circle, rgba(14, 165, 233, 0.35), transparent 65%);
    border-radius: 50%;
}

.auth-info::after {
    content: "";
    position: absolute;
    bottom: -100px;
    left: -60px;
    width: 280px;
    height: 280px;
    background: radial-gradient(circle, rgba(79, 70, 229, 0.45), transparent 65%);
    border-radius: 50%;
}

.auth-logo {
    position: relative;
    z-index: 1;
    color: #ffffff;
    font-size: 1.2rem;
}

.auth-logo span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 800;
}

.auth-info-content {
    position: relative;
    z-index: 1;
    margin: auto 0;
    max-width: 460px;
}

.auth-info-content .hero-badge {
    background-color: rgba(255, 255, 255, 0.15);
    color: #e0e7ff;
}

.auth-info-content h1 {
    color: #ffffff;
    font-size: clamp(1.8rem, 3.2vw, 2.5rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 18px;
}

.auth-info-content > p {
    color: #c7d2fe;
    font-size: 1rem;
    margin-bottom: 36px;
}

.auth-benefit {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 20px;
}

.auth-benefit > span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    background-color: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    font-size: 0.8rem;
    font-weight: 700;
    color: #86efac;
}

.auth-benefit strong {
    display: block;
    color: #ffffff;
    font-size: 0.96rem;
    margin-bottom: 2px;
}

.auth-benefit small {
    color: #a5b4fc;
    font-size: 0.85rem;
}

/* Right form panel */
.auth-form-area {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    background-color: var(--bg-body);
}

.auth-form-card {
    width: 100%;
    max-width: 440px;
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    padding: 40px 36px;
}

.mobile-auth-logo {
    display: none;
}

.auth-form-card h2 {
    font-size: 1.7rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    margin-bottom: 8px;
}

.auth-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 28px;
}

.remember-row,
.terms-row {
    margin-bottom: 22px;
    font-size: 0.88rem;
    color: var(--text-secondary);
}

.remember-row label,
.terms-row label {
    display: flex;
    align-items: center;
    gap: 9px;
    cursor: pointer;
}

.remember-row input[type="checkbox"],
.terms-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}

.terms-row a {
    color: var(--primary);
    font-weight: 500;
}

.terms-row a:hover {
    text-decoration: underline;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 26px 0;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 600;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background-color: var(--border);
}

.auth-switch {
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 18px;
}

.auth-switch a {
    color: var(--primary);
    font-weight: 600;
}

.auth-switch a:hover {
    text-decoration: underline;
}

.back-home {
    display: block;
    text-align: center;
    font-size: 0.88rem;
    color: var(--text-muted);
    font-weight: 500;
}

.back-home:hover {
    color: var(--primary);
}


/* ==========================================================================
   11. DASHBOARD LAYOUT (sidebar + main)
   ========================================================================== */

.dashboard-page {
    display: flex;
    min-height: 100vh;
    background-color: var(--bg-body);
}

/* ----- Sidebar ----- */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 200;
    width: var(--sidebar-width);
    height: 100vh;
    background-color: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    overflow-y: auto;
}

.sidebar-logo {
    padding: 8px 12px;
    margin-bottom: 32px;
    font-size: 1.05rem;
}

.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    font-size: 0.93rem;
    font-weight: 500;
    color: var(--text-secondary);
    border-radius: var(--radius);
    transition: all var(--transition-fast);
}

.sidebar-link span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    font-size: 1rem;
    color: var(--text-muted);
}

.sidebar-link:hover {
    background-color: var(--bg-subtle);
    color: var(--primary);
}

.sidebar-link:hover span {
    color: var(--primary);
}

.sidebar-link.active {
    background-color: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

.sidebar-link.active span {
    color: var(--primary);
}

.sidebar-bottom {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.logout-link:hover {
    background-color: var(--danger-light);
    color: var(--danger);
}

.logout-link:hover span {
    color: var(--danger);
}

/* ----- Main content area ----- */
.dashboard-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 32px 36px 56px;
    min-width: 0;
}

.dashboard-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 32px;
}

.dashboard-header h1 {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    margin-bottom: 4px;
}

.dashboard-header p {
    font-size: 0.94rem;
    color: var(--text-secondary);
}

/* User menu */
.user-menu {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px 8px 8px;
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-xs);
}

.user-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #ffffff;
    font-weight: 700;
    font-size: 0.95rem;
    border-radius: 50%;
}

.user-info {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.user-info strong {
    font-size: 0.9rem;
    font-weight: 600;
}

.user-info small {
    font-size: 0.75rem;
    color: var(--text-muted);
}


/* ==========================================================================
   12. DASHBOARD COMPONENTS
   ========================================================================== */

/* ----- Welcome card ----- */
.welcome-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 32px;
    padding: 40px;
    margin-bottom: 28px;
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 55%, #4338ca 100%);
    border-radius: var(--radius-xl);
    color: #ffffff;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    position: relative;
}

.welcome-card::after {
    content: "";
    position: absolute;
    top: -70px;
    right: 120px;
    width: 240px;
    height: 240px;
    background: radial-gradient(circle, rgba(14, 165, 233, 0.35), transparent 65%);
    border-radius: 50%;
    pointer-events: none;
}

.welcome-card > div {
    position: relative;
    z-index: 1;
}

.welcome-label {
    background-color: rgba(255, 255, 255, 0.15);
    color: #e0e7ff;
}

.welcome-card h2 {
    color: #ffffff;
    font-size: clamp(1.4rem, 2.6vw, 1.9rem);
    font-weight: 800;
    margin-bottom: 10px;
}

.welcome-card p {
    color: #c7d2fe;
    max-width: 520px;
    margin-bottom: 24px;
}

.welcome-card .btn-primary {
    background-color: #ffffff;
    color: var(--primary-dark);
    box-shadow: none;
}

.welcome-card .btn-primary:hover {
    background-color: #eef2ff;
}

.welcome-visual {
    position: relative;
    z-index: 1;
}

.ai-circle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 130px;
    height: 130px;
    background: rgba(255, 255, 255, 0.12);
    border: 2px solid rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    font-size: 2rem;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: 0.04em;
}

/* ----- Stats ----- */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 18px;
    margin-bottom: 28px;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 22px;
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
    transition: all var(--transition);
}

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

.stat-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background-color: var(--primary-light);
    color: var(--primary);
    font-size: 1.05rem;
    font-weight: 800;
    border-radius: var(--radius);
    flex-shrink: 0;
}

.stat-card div:last-child {
    display: flex;
    flex-direction: column;
}

.stat-card span {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.stat-card strong {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-primary);
}

.status-online {
    color: var(--success) !important;
    font-size: 1rem !important;
}

/* ----- Dashboard grid ----- */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1.3fr; /* Upload chota, Recent bada */
    gap: 24px;
    align-items: stretch; /* Dono boxes ki height barabar */
    margin-bottom: 28px;
}

.dashboard-card {
    padding: 26px;
    display: flex;
    flex-direction: column;
}

.card-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 22px;
}

.card-heading h3 {
    font-size: 1.15rem;
    margin-top: 4px;
}

.card-heading a {
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--primary);
}

.card-heading a:hover {
    text-decoration: underline;
}

.card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    background-color: var(--primary-light);
    color: var(--primary);
    font-size: 1rem;
    font-weight: 800;
    border-radius: var(--radius);
    flex-shrink: 0;
}

/* ----- Upload dropzone (shared) ----- */
.upload-dropzone {
    position: relative;
    margin-bottom: 18px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 40px 24px;
    background-color: var(--bg-body);
    border: 2px dashed var(--border-strong);
    border-radius: var(--radius-lg);
    cursor: pointer;
    text-align: center;
    transition: all var(--transition);
    height: 100%;
}

.upload-label:hover,
.upload-dropzone.dragover .upload-label {
    border-color: var(--primary);
    background-color: var(--primary-light);
}

.upload-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #ffffff;
    font-size: 1.3rem;
    font-weight: 700;
    border-radius: 50%;
    margin-bottom: 8px;
}

.upload-label h3,
.upload-label h4 {
    font-size: 1.05rem;
}

.upload-label p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.upload-label small {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Image preview */
.image-preview {
    position: relative;
    margin-top: 16px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border);
    background-color: var(--bg-subtle);
}

.image-preview img {
    width: 100%;
    max-height: 320px;
    object-fit: contain;
}

.remove-image {
    position: absolute;
    top: 10px;
    right: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background-color: rgba(15, 23, 42, 0.7);
    color: #ffffff;
    border: none;
    border-radius: 50%;
    font-size: 1.15rem;
    line-height: 1;
    cursor: pointer;
    transition: background-color var(--transition-fast);
}

.remove-image:hover {
    background-color: var(--danger);
}

/* ----- Recent list ----- */


.recent-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px;
    background-color: var(--bg-body);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: all var(--transition-fast);
    min-height: 75px; /* Height fix kar di */
    flex-shrink: 0; /* Item shrink na ho */
}

.recent-item:hover {
    border-color: var(--primary-soft);
    background-color: var(--primary-light);
}

.recent-item img {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.recent-info {
    flex: 1;
    min-width: 0; /* Ye zaroori hai taake text truncate ho sake */
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.recent-info strong {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis; /* Aage ... laga dega */
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.recent-info small {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.view-btn {
    padding: 7px 14px;
    background-color: var(--primary);
    color: #ffffff;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    flex-shrink: 0; /* Button dabe na */
    text-decoration: none;
}

.view-btn:hover {
    background-color: var(--primary-dark);
}

/* ----- Empty state ----- */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 44px 24px;
    text-align: center;
    background-color: var(--bg-body);
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    height: 100%;
}

.empty-icon {
    font-size: 2.2rem;
    opacity: 0.6;
}

.empty-state h2,
.empty-state h4 {
    font-size: 1.1rem;
}

.empty-state p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    max-width: 340px;
}

/* ----- Info section (dashboard / upload) ----- */
.info-section {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 28px;
    padding: 34px 36px;
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
}

.info-content {
    max-width: 560px;
}

.info-content h2 {
    font-size: 1.35rem;
    font-weight: 800;
    margin: 8px 0 10px;
}

.info-content p {
    font-size: 0.93rem;
    color: var(--text-secondary);
}

.info-steps {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}

.mini-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 16px 20px;
    background-color: var(--bg-body);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    min-width: 100px;
}

.mini-step span {
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: 0.05em;
}

.mini-step strong {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}


/* ==========================================================================
   13. UPLOAD PAGE
   ========================================================================== */

.upload-page-card {
    max-width: 720px;
    margin: 0 auto 28px;
}

.upload-page-card h2 {
    font-size: 1.3rem;
}

.upload-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 8px;
}


/* ==========================================================================
   14. RESULTS PAGE
   ========================================================================== */

.results-wrapper {
    max-width: var(--container);
    margin: 0 auto;
    padding: 40px 24px 60px;
}

.result-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 32px;
}

.result-header h1 {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    margin-bottom: 4px;
}

.result-header p {
    font-size: 0.94rem;
    color: var(--text-secondary);
}

.result-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.result-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 28px;
}

.result-card {
    padding: 26px;
}

.result-card h2 {
    font-size: 1.15rem;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.image-preview,
.analysis-image {
    width: 100%;
    max-height: 380px;
    object-fit: contain;
    background-color: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

/* Info rows */
.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.92rem;
}

.info-row:last-child {
    border-bottom: none;
}

.info-label,
.label {
    font-weight: 600;
    color: var(--text-secondary);
}

.info-value,
.value {
    color: var(--text-primary);
    font-weight: 500;
    text-align: right;
    word-break: break-word;
}

/* Caption box */
.caption-box,
.caption {
    padding: 18px;
    background-color: var(--bg-body);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius);
    font-size: 0.95rem;
    color: var(--text-primary);
    line-height: 1.7;
}

/* Tags */
.tag-list,
.previous-tags {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.tag-item,
.tag {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px 16px;
    background-color: var(--bg-body);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color var(--transition-fast);
}

.tag-item:hover,
.tag:hover {
    border-color: var(--primary-soft);
}

.tag-item {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
}

.tag-name,
.tag span:first-child {
    font-weight: 600;
    font-size: 0.94rem;
}

.confidence {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--primary);
}

.tag .confidence {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    background-color: var(--primary-light);
    border-radius: var(--radius-full);
}

.confidence-progress {
    width: 100%;
    height: 8px;
    border-radius: var(--radius-full);
    overflow: hidden;
    accent-color: var(--primary);
}

/* Bottom actions */
.result-bottom-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    padding: 24px;
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
}


/* ==========================================================================
   15. HISTORY PAGE
   ========================================================================== */

.history-container,
.details-container,
.profile-container,
.edit-container,
.password-container,
.error-container {
    max-width: var(--container);
    margin: 0 auto;
    padding: 40px 24px 60px;
}

.page-header {
    margin-bottom: 28px;
}

.page-header h1 {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    margin-bottom: 6px;
}

.page-header p {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

/* Filter card */
.filter-card {
    padding: 20px;
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
    margin-bottom: 28px;
}

/* Filter Form Container */
.filter-form {
    display: flex;
    gap: 12px;
    align-items: center;
    width: 100%;
}

/* Search Bar */
.filter-form input[type="search"] {
    flex: 1; /* Bachi hui jagah lega */
    max-width: 450px; /* Zyada bada nahi hoga */
    height: 44px;
    padding: 0 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
}

/* Dropdown */
.filter-form select {
    width: 160px; /* Fix width */
    height: 44px;
    padding: 0 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
}

/* Button (Sabse Important Fix) */
.filter-form .btn-search {
    height: 44px;
    width: auto !important; /* Width ko zabardasti auto kiya */
    padding: 0 30px;
    flex: 0 0 auto; /* Button ko shrink hone se roka */
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* History grid */
.history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

.history-card {
    overflow: hidden;
    transition: all var(--transition);
}

.history-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.history-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background-color: var(--bg-subtle);
    border-bottom: 1px solid var(--border);
}

.history-body {
    padding: 20px;
}

.history-body h2 {
    font-size: 1.02rem;
    font-weight: 700;
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-date {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.history-caption {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 18px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.history-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.delete-history-form {
    margin: 0;
}

.delete-btn {
    padding: 8px 16px;
    background-color: transparent;
    color: var(--danger);
    border: 1.5px solid var(--danger);
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.delete-btn:hover {
    background-color: var(--danger);
    color: #ffffff;
}


/* ==========================================================================
   16. HISTORY DETAIL PAGE
   ========================================================================== */

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 24px;
}

.back-link:hover {
    text-decoration: underline;
}

.details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.details-grid .card {
    padding: 26px;
}

.details-grid .card h2 {
    font-size: 1.15rem;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.details-grid .card h3 {
    font-size: 1rem;
    margin: 22px 0 12px;
}

.details-grid .card p {
    font-size: 0.92rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.details-grid .card p strong {
    color: var(--text-primary);
}

.details-grid hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 20px 0;
}


/* ==========================================================================
   17. PROFILE / EDIT PROFILE / CHANGE PASSWORD
   ========================================================================== */

.profile-card,
.form-card,
.password-card,
.error-card,
.server-content,
.not-found-content {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    padding: 40px 36px;
}

.profile-container,
.edit-container,
.password-container,
.error-container {
    max-width: 640px;
}

/* Profile header */
.profile-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding-bottom: 28px;
    margin-bottom: 28px;
    border-bottom: 1px solid var(--border);
}

.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 84px;
    height: 84px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #ffffff;
    font-size: 2rem;
    font-weight: 800;
    border-radius: 50%;
    margin-bottom: 16px;
    box-shadow: 0 8px 22px rgba(79, 70, 229, 0.3);
}

.profile-header h1 {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 4px;
}

.profile-header p {
    font-size: 0.88rem;
    color: var(--text-muted);
}

/* Profile info */
.profile-info {
    margin-bottom: 28px;
}

/* Shared form card headers */
.form-card h1,
.password-card h1 {
    font-size: 1.55rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    margin-bottom: 8px;
}

.form-card > p,
.password-card > p {
    font-size: 0.94rem;
    color: var(--text-secondary);
    margin-bottom: 28px;
}

/* Actions row */
.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 8px;
}

.profile-card .actions {
    padding-top: 24px;
    border-top: 1px solid var(--border);
}


/* ==========================================================================
   18. ERROR PAGES (404, 500, error.html)
   ========================================================================== */

.not-found,
.server-error {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - var(--navbar-height));
    padding: 60px 24px;
    background:
        radial-gradient(circle at 50% 30%, rgba(79, 70, 229, 0.07), transparent 55%),
        var(--bg-body);
}

.not-found-content,
.server-content {
    max-width: 560px;
    width: 100%;
    text-align: center;
    padding: 56px 40px;
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
}

.number {
    font-size: clamp(4rem, 12vw, 6.5rem);
    font-weight: 900;
    line-height: 1;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 16px;
}

.not-found-content h1,
.server-content h1 {
    font-size: 1.6rem;
    font-weight: 800;
    margin-bottom: 14px;
}

.not-found-content p,
.server-content p {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 30px;
}

/* Analysis error page */
.error-card {
    text-align: center;
}

.error-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    background-color: var(--danger-light);
    color: var(--danger);
    font-size: 2rem;
    font-weight: 800;
    border-radius: 50%;
    margin-bottom: 22px;
}

.error-card h1 {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 14px;
}

.error-message {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 30px;
    line-height: 1.7;
}


/* ==========================================================================
   19. UTILITIES & HELPERS
   ========================================================================== */

.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.hidden { display: none !important; }

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background-color: var(--bg-subtle);
}

::-webkit-scrollbar-thumb {
    background-color: var(--border-strong);
    border-radius: var(--radius-full);
    border: 2px solid var(--bg-subtle);
}

::-webkit-scrollbar-thumb:hover {
    background-color: var(--text-muted);
}


/* ==========================================================================
   20. RESPONSIVE MEDIA QUERIES
   ========================================================================== */

/* ----- Large tablets / small desktops ----- */
@media (max-width: 1100px) {
    .hero-container {
        grid-template-columns: 1fr;
        gap: 48px;
        text-align: center;
    }

    .hero-content > p {
        margin-left: auto;
        margin-right: auto;
    }

    .hero-buttons,
    .hero-features {
        justify-content: center;
    }

    .hero-visual {
        order: -1;
    }

    .about-container {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .dashboard-grid,
    .result-grid,
    .details-grid {
        grid-template-columns: 1fr;
    }
}

/* ----- Tablets ----- */
@media (max-width: 900px) {
    .auth-wrapper {
        grid-template-columns: 1fr;
    }

    .auth-info {
        display: none;
    }

    .auth-form-area {
        padding: 32px 20px;
    }

    .mobile-auth-logo {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        margin-bottom: 24px;
        font-size: 1.05rem;
        font-weight: 700;
        color: var(--primary);
    }

    /* Sidebar collapses to top bar */
    .dashboard-page {
        flex-direction: column;
    }

    .sidebar {
        position: sticky;
        top: 0;
        width: 100%;
        height: auto;
        flex-direction: row;
        align-items: center;
        gap: 16px;
        padding: 12px 16px;
        border-right: none;
        border-bottom: 1px solid var(--border);
        overflow-x: auto;
    }

    .sidebar-logo {
        margin-bottom: 0;
        flex-shrink: 0;
    }

    .sidebar-menu {
        flex-direction: row;
        flex: 1;
        overflow-x: auto;
        gap: 6px;
    }

    .sidebar-link {
        white-space: nowrap;
        padding: 9px 12px;
    }

    .sidebar-link span {
        width: auto;
    }

    .sidebar-bottom {
        margin-top: 0;
        padding-top: 0;
        border-top: none;
        border-left: 1px solid var(--border);
        padding-left: 12px;
        flex-shrink: 0;
    }

    .dashboard-main {
        margin-left: 0;
        padding: 24px 20px 48px;
    }

    .welcome-card {
        flex-direction: column;
        text-align: center;
    }

    .welcome-card p {
        margin-left: auto;
        margin-right: auto;
    }
}

/* ----- Mobile ----- */
@media (max-width: 640px) {
    h1 { font-size: 1.6rem; }
    h2 { font-size: 1.3rem; }

    .nav-container {
        flex-direction: column;
        height: auto;
        padding: 14px 18px;
        gap: 12px;
    }

    .nav-menu {
        flex-wrap: wrap;
        justify-content: center;
        gap: 4px;
    }

    .nav-menu a {
        padding: 7px 10px;
        font-size: 0.85rem;
    }

    .nav-menu .nav-signup {
        padding: 8px 16px;
    }

    .hero-section {
        padding: 48px 18px 64px;
    }

    .features-section,
    .steps-section,
    .about-section {
        padding: 60px 18px;
    }

    .section-heading {
        margin-bottom: 36px;
    }

    .about-stats {
        grid-template-columns: 1fr;
    }

    .footer-container {
        flex-direction: column;
        text-align: center;
    }

    .footer-links {
        justify-content: center;
    }

    .auth-form-card {
        padding: 30px 22px;
    }

    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .user-menu {
        width: 100%;
    }

    .welcome-card {
        padding: 28px 22px;
    }

    .ai-circle {
        width: 96px;
        height: 96px;
        font-size: 1.5rem;
    }

    .dashboard-stats {
        grid-template-columns: 1fr;
    }

    .info-section {
        flex-direction: column;
        align-items: flex-start;
        padding: 26px 22px;
    }

    .info-steps {
        width: 100%;
    }

    .mini-step {
        flex: 1;
        min-width: 0;
        padding: 12px 10px;
    }

    .result-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .result-actions {
        width: 100%;
    }

    .result-actions .btn {
        flex: 1;
    }

    .filter-form {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-form .form-control,
    .filter-form .form-control:last-of-type {
        flex: 1 1 100%;
        width: 100%;
    }

    .filter-form .btn {
        width: 100%;
    }

    .history-grid {
        grid-template-columns: 1fr;
    }

    .history-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .history-actions .view-btn,
    .delete-history-form .delete-btn {
        width: 100%;
        text-align: center;
    }

    .result-bottom-actions {
        flex-direction: column;
    }

    .result-bottom-actions form,
    .result-bottom-actions .btn {
        width: 100%;
    }

    .actions {
        flex-direction: column;
    }

    .actions .btn {
        width: 100%;
    }

    .profile-card,
    .form-card,
    .password-card,
    .error-card {
        padding: 28px 22px;
    }

    .not-found-content,
    .server-content {
        padding: 40px 24px;
    }
}

/* ----- Reduced motion ----- */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}


/* ==========================================================================
   21. DARK MODE FIXES & EXTRA UTILITIES
   ========================================================================== */

/* Google translate ka top wala frame chupao */
iframe.skiptranslate {
    display: none !important;
    height: 0 !important;
    visibility: hidden !important;
}

/* Body ko upar shift hone se roko (jo Google translate karta hai) */
body {
    top: 0 !important;
    position: static !important;
}

/* Google translate ka logo aur banner chupao */
.goog-te-banner-frame {
    display: none !important;
}

#goog-gt-tt, .goog-te-balloon-frame {
    display: none !important;
}

.goog-text-highlight {
    background: none !important;
    box-shadow: none !important;
}

/* JS Dynamic Elements (Password Strength, etc) */
.password-strength {
    display: block;
    height: 4px;
    width: 0;
    margin-top: 8px;
    border-radius: 2px;
    background-color: transparent;
    transition: all 0.3s ease;
}

button[type="submit"]:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

/* Upload Dropzone Bada Fix */
.large-dropzone {
    position: relative;
    margin: 20px 0;
    background-color: var(--bg-body);
    border: 2px dashed var(--border-strong);
    border-radius: 12px;
    transition: all 0.3s ease;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.large-dropzone.dragover {
    border-color: var(--primary);
    background-color: var(--primary-light);
}

.upload-prompt {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-align: center;
}

.analysis-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.preview-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 15px;
    align-items: center;
}

.preview-info strong {
    font-size: 1.1rem;
    color: var(--text-primary);
    font-weight: 600;
}

/* Hero Animation */
.scan-line {
    position: absolute;
    top: -10%;
    left: 0;
    width: 100%;
    height: 4px;
    background: rgba(79, 70, 229, 0.8);
    box-shadow: 0 0 20px 4px rgba(79, 70, 229, 0.6);
    z-index: 1;
    animation: scan 2.5s infinite linear;
}

@keyframes scan {
    0% { top: -10%; opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { top: 110%; opacity: 0; }
}

.anim-tag-1, .anim-tag-2, .anim-tag-3 {
    opacity: 0;
    animation: slideUp 0.6s ease forwards;
}

.anim-tag-1 { animation-delay: 0.5s; }
.anim-tag-2 { animation-delay: 1.0s; }
.anim-tag-3 { animation-delay: 1.5s; }

@keyframes slideUp {
    0% { opacity: 0; transform: translateY(15px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* Custom Language Switcher */
.custom-lang-switcher {
    display: inline-block;
    margin-right: 15px;
}

.custom-lang-switcher select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-color: transparent;
    border: 1.5px solid var(--border-strong);
    border-radius: var(--radius);
    padding: 8px 30px 8px 12px;
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    outline: none;
    transition: all var(--transition-fast);
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23475569%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 10px;
}

.custom-lang-switcher select:hover,
.custom-lang-switcher select:focus {
    border-color: var(--primary);
    background-color: var(--primary-light);
    color: var(--primary);
}

.custom-lang-switcher select option {
    background-color: var(--bg-card);
    color: var(--text-primary);
    padding: 10px;
}