:root {
    /* User brand palette */
    --brand-green: #07A869;
    --brand-blue:  #3D7EB9;
    --brand-teal:  #0DA9A6;
    --brand-deep:  #15445A;
    --brand-sand:  #C1B48A;
    --brand-gray:  #C2C1C1;

    /* Derived tokens */
    --primary-1: #27b881; /* lighter from green */
    --primary-2: var(--brand-teal);
    --primary-3: var(--brand-green);
    --accent-1: var(--brand-green);
    --bg-soft: #eef7ef;   /* keep soft mint background */
    --text-main: var(--brand-deep);
    --border-soft: rgba(0,0,0,0.08);
}

/* ====== Fonts: Cairo (AR/EN) from Google Fonts ====== */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;500;600;700&display=swap');

/* Light mode inputs: mint green blocks per screenshot */
body:not(.theme-dark) .form-control {
  background-color: #d3ecd3; /* mint */
  border-color: #bfe0bf;
  color: #0b3b32;
}
body:not(.theme-dark) .form-control::placeholder { color: #5b6b65; }
body:not(.theme-dark) .form-control:focus {
  background-color: #c7e6c7;
  border-color: #9bdcb8;
  box-shadow: 0 0 0 0.22rem rgba(155, 220, 184, 0.35);
}

body {
    font-family: 'Cairo', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    /* Soft mint background similar to mockup */
    background-color: var(--bg-soft);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== Refined typography ===== */
h1, .display-1, .display-2, .display-3, .display-4 { letter-spacing: -0.02em; }
h1, h2, h3, h4, h5, h6 { color: var(--text-main); }
h1, .display-1 { font-weight: 700; }
h2, .display-2 { font-weight: 600; }
h3, .display-3 { font-weight: 600; }
h4, .display-4 { font-weight: 500; }
h5 { font-weight: 500; }
h6 { font-weight: 500; }
/* Sizes tuned for Sakkal Majalla readability */
h1 { font-size: 2.1rem; line-height: 1.2; }
h2 { font-size: 1.8rem; line-height: 1.25; }
h3 { font-size: 1.5rem; line-height: 1.3; }
h4 { font-size: 1.25rem; line-height: 1.35; }
h5 { font-size: 1.1rem; line-height: 1.4; }
h6 { font-size: 1rem; line-height: 1.4; }
.lead { color: #5b6b65; }
/* Force white titles in hero/welcome areas only in dark mode */
.theme-dark .hero-gradient h1, .theme-dark .hero-gradient .display-1, .theme-dark .hero-gradient .display-2,
.theme-dark .welcome-title, .theme-dark .page-title.welcome { color: #ffffff; text-shadow: 0 1px 0 rgba(0,0,0,.35); }

/* Smooth global theme transition (applied temporarily via JS) */
.theme-transition * { transition: background-color .25s ease, color .25s ease, border-color .25s ease; }

/* Link styling aligned with green palette */
a { text-decoration: none; color: var(--primary-3); }
a:hover { text-decoration: underline; text-underline-offset: 2px; color: var(--primary-2); }

footer {
    margin-top: auto;
}

/* ===== Dark mode base ===== */
.theme-dark {
    /* Dark Mode – user palette (Option A lightened ~5%) */
    /* Provided: 7896AE, 727E94, 384A72, 1B2C63, 02004A */
    --bg: #0a0f5f;          /* very dark base, slightly lighter */
    --surface: #243b7a;     /* cards/surfaces, slightly lighter */
    --muted: #727E94;       /* muted text base */
    --text: #FFFFFF;        /* global white text in dark mode */
    --primary: #7896AE;     /* accent blue */
    --primary-strong: #384A72; /* deeper accent */
    --card-shadow: rgba(0,0,0,.55);
    /* Extra accents (light but muted) */
    --accent-blue: #6f9bd6;  /* soft blue */
    --accent-blue-weak: rgba(111,155,214,0.15);
    --accent-gray: #9aa6b2;  /* soft gray */
    --accent-gray-weak: rgba(154,166,178,0.18);
}
body.theme-dark { background-color: var(--bg); color: var(--text); }
/* Light mode navbar: solid mint background like reference */
body:not(.theme-dark) .navbar.bg-primary, body:not(.theme-dark) .navbar-light.bg-primary {
    background-image: none;
    background-color: #cfe8e0 !important;
}

/* Taskbar/NavBar solid color (applies in dark mode) */
body.theme-dark .navbar.bg-primary, body.theme-dark .navbar-dark.bg-primary {
    background-image: none;
    background-color: #7896AE !important;
}

/* Navbar icon/link color harmonized */
.navbar .nav-link i { color: #0b3b32; opacity: .9; }
.navbar .nav-link:hover i { opacity: 1; }
.navbar-dark .navbar-brand { color: #0b3b32 !important; font-weight: 700; }
.navbar-dark .navbar-nav .nav-link { color: #0b3b32 !important; }
.navbar-dark .navbar-nav .nav-link:hover { color: #062f26 !important; }
.navbar-dark .navbar-nav .nav-link.active { color: #05261e !important; font-weight: 700; }
.navbar-dark .dropdown-menu { border-color: rgba(0,0,0,0.08); }

/* Navbar text/icon color in light mode: dark text for readability */
body:not(.theme-dark) .navbar-light .navbar-brand,
body:not(.theme-dark) .navbar-light .nav-link,
body:not(.theme-dark) .navbar-light .nav-link i { color: #0b3b32 !important; opacity: 1; }
body.theme-dark .navbar .nav-link, body.theme-dark .navbar .nav-link i { color: #ffffff; }
body.theme-dark .navbar .nav-link:hover, body:not(.theme-dark) .navbar-light .nav-link:hover { opacity: .95; }

/* Navbar dropdown styling */
.navbar .dropdown-menu { box-shadow: 0 8px 20px rgba(0,0,0,.08); border-color: var(--border-soft); }
/* Light mode dropdown: soft light background */
body:not(.theme-dark) .navbar .dropdown-menu { background-color: #f7fbf9; color: #0b3b32; border-color: var(--border-soft); }
body:not(.theme-dark) .navbar .dropdown-item { color: #0b3b32; }
body:not(.theme-dark) .navbar .dropdown-item i { color: #0b3b32; opacity: .9; }
body:not(.theme-dark) .navbar .dropdown-item:hover { background-color: #ecf7ef; }
body:not(.theme-dark) .navbar .dropdown-item:hover i { opacity: 1; }

.theme-dark .navbar .nav-link { color: var(--text); }
.theme-dark .navbar .nav-link.active { color: var(--text); }
.theme-dark .navbar .dropdown-menu { background-color: #384A72; color: var(--text); border-color: #2a364a; }
.theme-dark .dropdown-item { color: var(--text); }
.theme-dark .dropdown-item:hover { background: #2f3f68; }

.theme-dark .card { background-color: var(--surface); box-shadow: 0 8px 18px var(--card-shadow); }
.theme-dark .card-header { background-color: var(--surface); border-color: #2a323a; color: var(--text); }
.theme-dark .hero-gradient { background: linear-gradient(180deg, rgba(32,40,48,.75) 0%, rgba(23,27,33,.75) 100%); border-color: #2a323a; color: var(--text); }
.theme-dark .glass { background: rgba(27,32,38,.7); border-color: #2a323a; }
.theme-dark .section-title { color: var(--text); }
.theme-dark .stat-pill { background: #20363a; color: #b6fff3; }
.theme-dark .text-muted, .theme-dark .muted, .theme-dark .form-text { color: #f2f2f2 !important; }

.theme-dark .form-control { background-color: #1b2026; color: var(--text); border-color: #2a323a; }
.theme-dark .form-control::placeholder { color: #8a949e; }
.theme-dark .btn-outline-primary { color: var(--primary); border-color: var(--primary-strong); }
.theme-dark .btn-outline-primary:hover { background: rgba(56,74,114,0.18); border-color: var(--primary-strong); color: #e9f1f8; }
.theme-dark .btn-primary { background: linear-gradient(90deg, var(--primary-strong) 0%, #1B2C63 100%); border-color: var(--primary-strong); color: #ffffff; }
.theme-dark .btn-primary:hover { filter: brightness(1.05); }

.theme-dark .alert { background-color: #1b2026; color: var(--text); border-color: #2a323a; }
.theme-dark .flash-alert { background-color: #1b2026; color: var(--text); }

.theme-dark footer { background-color: #0e1114; color: var(--muted); }

/* Dark mode alerts (softer backgrounds) */
.theme-dark .alert-success { background-color: #1c2630; border-color: #264e6b; color: #cfe6f5; }
.theme-dark .alert-info { background-color: #1a2430; border-color: #2b4d6e; color: #d5e8f8; }
.theme-dark .alert-warning { background-color: #2a2417; border-color: #6b5520; color: #ffe6b8; }
.theme-dark .alert-danger { background-color: #2a1c20; border-color: #6b2f3b; color: #f6c6ce; }

/* ===== Optional blue/gray accents (dark mode only) ===== */
.theme-dark .badge-blue { background-color: var(--accent-blue); color: #0b1220; }
.theme-dark .badge-gray { background-color: var(--accent-gray); color: #0b1220; }

.theme-dark .btn-blue { background-color: var(--accent-blue); border-color: var(--accent-blue); color: #0b1220; }
.theme-dark .btn-blue:hover { filter: brightness(1.05); }
.theme-dark .btn-outline-blue { color: var(--accent-blue); border-color: var(--accent-blue); }
.theme-dark .btn-outline-blue:hover { background-color: var(--accent-blue-weak); }

.theme-dark .btn-gray { background-color: var(--accent-gray); border-color: var(--accent-gray); color: #0b1220; }
.theme-dark .btn-gray:hover { filter: brightness(1.05); }
.theme-dark .btn-outline-gray { color: var(--accent-gray); border-color: var(--accent-gray); }
.theme-dark .btn-outline-gray:hover { background-color: var(--accent-gray-weak); }

/* Subtle tinted surfaces utilities */
.theme-dark .bg-tint-blue { background-color: rgba(111,155,214,0.08) !important; }
.theme-dark .bg-tint-gray { background-color: rgba(154,166,178,0.10) !important; }
.theme-dark .border-blue { border-color: var(--accent-blue) !important; }
.theme-dark .border-gray { border-color: var(--accent-gray) !important; }

/* Text utilities */
.theme-dark .text-blue { color: var(--accent-blue) !important; }
.theme-dark .text-gray { color: var(--accent-gray) !important; }

/* Darken all light backgrounds and surfaces */
.theme-dark .bg-light { background-color: #1b2026 !important; color: var(--text) !important; }
.theme-dark .text-dark { color: var(--text) !important; }
.theme-dark .border, .theme-dark .card, .theme-dark .dropdown-menu, .theme-dark .modal-content, .theme-dark .list-group-item {
  border-color: #2a323a !important;
}

/* Tables */
.theme-dark .table { color: var(--text); border-color: #2a364a; }
.theme-dark .table thead th { color: #FFFFFF; border-color: #2a364a; background-color: var(--surface); }
.theme-dark .table tbody td { border-color: #2a364a; }
.theme-dark .table-striped > tbody > tr:nth-of-type(odd) { --bs-table-accent-bg: #19243a; color: var(--text); }
.theme-dark .table-hover > tbody > tr:hover { --bs-table-accent-bg: #1e2c46; color: var(--text); }

/* Dark mode forms: better borders and focus */
.theme-dark .form-control { background-color: #1b2026; color: var(--text); border-color: #2a323a; }
.theme-dark .form-control::placeholder { color: #7f8a94; }
.theme-dark .form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 0.2rem rgba(79,201,122,0.18); }

/* Dark mode buttons/* Secondary buttons aligned with green theme */
.theme-dark .btn-secondary {
    color: var(--text-main);
    background-color: #727E94;
    border-color: #727E94;
}
.theme-dark .btn-secondary:hover {
    background-color: #5f6b82;
    border-color: #5f6b82;
}
.theme-dark .btn-outline-secondary {
    color: var(--text-main);
    border-color: #727E94;
}
.theme-dark .btn-outline-secondary:hover {
    background-color: rgba(114,126,148,0.15);
    border-color: #727E94;
    color: #e9f1f8;
}

/* Dark mode dropdown hover */
.theme-dark .dropdown-item:hover { background-color: #1f262d; color: var(--text); }

/* Badges in dark mode */
.theme-dark .badge.bg-success { background-color: #2a8e87 !important; color: #e8fffb; }
.theme-dark .badge.bg-secondary, .theme-dark .badge-secondary { background-color: #727E94 !important; color: #e9f1f8; }
.badge { border-radius: 12px; }

/* List groups */
.theme-dark .list-group { background-color: #171a1e; }
.theme-dark .list-group-item { background-color: #171a1e; color: var(--text); }
.theme-dark .list-group-item-action:hover { background-color: #1d2228; }

/* Modals */
.theme-dark .modal-content { background-color: #171a1e; color: var(--text); }
.theme-dark .modal-header, .theme-dark .modal-footer { border-color: #2a323a; }
.theme-dark .modal-backdrop.show { opacity: .75; }

/* Dropdowns and dividers */
.theme-dark .dropdown-divider { border-top-color: #2a323a; }

/* Buttons */
.theme-dark .btn-light { color: var(--text); background-color: #27303a; border-color: #303946; }
.theme-dark .btn-light:hover { background-color: #2e3844; border-color: #3a4452; }
.theme-dark .btn-outline-light { color: #e8f0f6; border-color: #3a4452; }
.theme-dark .btn-outline-light:hover { background-color: #2e3844; }

/* Links in dark mode: white for maximum readability */
.theme-dark a { color: #ffffff; }
.theme-dark a:hover { color: #f2f2f2; }

.card {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
    border: 1px solid var(--border-soft);
    border-radius: 16px;
    margin-bottom: 20px;
}

.card-header {
    background-color: #ecf7ef; /* subtle green header */
    border-bottom: 1px solid var(--border-soft);
}

.btn-primary {
    /* Brand primary matching palette */
    background: linear-gradient(90deg, var(--brand-teal) 0%, var(--brand-green) 100%);
    border-color: var(--brand-teal);
}

.btn-primary { transition: filter .15s ease, box-shadow .15s ease; }
.btn-primary:hover {
    filter: brightness(0.95);
    border-color: #4bb3a4;
}

/* Rounded pill inputs and buttons to match design */
.form-control {
    border-radius: 9999px;
    padding-inline: 1rem;
    height: 44px;
    border-color: var(--border-soft);
    border-width: 1px;
}

/* Compact button sizes and consistent paddings */
.btn { border-radius: 9999px; padding: .5rem 1rem; }
.btn-sm { padding: .35rem .75rem; }
.btn-lg { padding: .75rem 1.25rem; }

/* Ghost button variant for minimal UI */
.btn-ghost { background: transparent; border: 1px solid rgba(0,0,0,0.1); color: var(--text-main); }
.btn-ghost:hover { background: rgba(0,0,0,0.03); }

/* Softer borders for buttons in light mode */
.btn { border-color: var(--border-soft); }
.btn:hover { border-color: rgba(0,0,0,0.12); }
.btn:active { transform: scale(0.98); transition: transform 120ms ease; }

/* Focus ring for accessibility */
:focus { outline: none; }
.form-control:focus, .btn:focus, .nav-link:focus { box-shadow: 0 0 0 0.22rem rgba(79, 201, 122, 0.28); border-color: var(--primary-2); }
/* Distinct focus color in dark mode */
.theme-dark .form-control:focus, .theme-dark .btn:focus, .theme-dark .nav-link:focus {
  box-shadow: 0 0 0 0.25rem rgba(120,150,174,0.45);
  border-color: #7896AE;
}
.theme-dark .form-control:focus { background-color: #2a3f84; }

/* Search/input focus look (box around field, slight color change) */
input[type="search"], input[type="text"], textarea { transition: background-color .2s ease, border-color .2s ease, box-shadow .2s ease; }
input[type="search"]:focus, input[type="text"]:focus, textarea:focus { text-decoration: none; }
body:not(.theme-dark) input[type="search"]:focus, body:not(.theme-dark) input[type="text"]:focus, body:not(.theme-dark) textarea:focus {
  background-color: #eef7ef;
}
.theme-dark input[type="search"]:focus, .theme-dark input[type="text"]:focus, .theme-dark textarea:focus {
  background-color: #2a3f84;
}

/* Invalid state styling */
.is-invalid, .form-control.is-invalid { border-color: #dc3545 !important; }
.invalid-feedback { color: #dc3545; }
.theme-dark .is-invalid, .theme-dark .form-control.is-invalid { border-color: #ff6b6b !important; background-color: rgba(255,107,107,0.06); }
.theme-dark .invalid-feedback { color: #ff9a9a; }

/* Removed top logo header - logo now only in navbar */

/* Navbar polish */
.navbar .nav-link { font-weight: 600; }
.navbar .nav-link:hover { opacity: .9; }
.navbar { transition: box-shadow .2s ease, background-color .2s ease; }
.navbar { padding-top: .4rem; padding-bottom: .4rem; }
.navbar .brand-logo { height: 42px; width: auto; display: block; }
@media (min-width: 992px){ .navbar .brand-logo { height: 48px; } }

/* Light mode navbar text/icons: dark over mint */
body:not(.theme-dark) .navbar .nav-link,
body:not(.theme-dark) .navbar .navbar-brand,
body:not(.theme-dark) .navbar .nav-link i { color: #083c35 !important; }
body:not(.theme-dark) .navbar .nav-link:hover { color: #062f2a !important; }
.navbar .navbar-nav > li { display: flex; align-items: center; }

/* Icon bubble: circular white chip around icons */
.icon-bubble {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: #ffffff;
  color: #083c35 !important;
  border: 1px solid rgba(0,0,0,0.08);
  box-shadow: 0 2px 6px rgba(0,0,0,.05);
}
.icon-bubble:hover { filter: brightness(0.98); }
.icon-bubble i { color: inherit; }
.navbar-elevated { box-shadow: 0 8px 18px rgba(0,0,0,.08); }
.navbar .navbar-brand { transition: color .3s ease; }
#themeIcon { transition: transform .3s ease, color .3s ease; }
body.theme-dark #themeIcon { transform: rotate(180deg); }

/* Bubble group spacing and user pill */
.bubble-group .nav-link .icon-bubble { margin-inline: .1rem; }
.bubble-group .dropdown .icon-bubble { margin-inline: .1rem; }
.bubble-group { gap: .5rem; }
.user-pill {
  background: #ffffff;
  border: 1px solid var(--border-soft);
  border-radius: 9999px;
  padding: .4rem .8rem;
  min-width: 130px;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.user-pill .xsmall { font-size: .75rem; }

/* Colored bubble variants */
.bubble-warning { background-color: #ffe08a; }
.bubble-success { background-color: #b9f3cf; }

/* Subtle divider inside navbar main links */
.nav-divider .nav-link.disabled {
  opacity: 1; cursor: default;
  padding-inline: .5rem; margin-inline: .25rem;
  border-inline-start: 1px solid rgba(0,0,0,0.08);
  height: 24px; align-self: center;
}

/* Section spacing helpers */
.section { padding-block: 1.25rem; }
.section-lg { padding-block: 2rem; }

/* Elevation utility */
.elevated { box-shadow: 0 12px 28px rgba(0,0,0,.08) !important; }

/* Cleaner table look */
.table thead th { font-weight: 700; border-bottom-color: var(--border-soft); }
.table td, .table th { vertical-align: middle; border-color: var(--border-soft); }

/* Sitewide: table headers with white text in light mode */
body:not(.theme-dark) .table thead th {
  color: #fff;
  background-color: #1f6f5c; /* dark green-teal for readability */
}

/* Sticky table headers (works inside .table-responsive) */
.table thead th {
  position: sticky;
  top: 0;
  z-index: 2; /* above body cells */
}

/* Ensure dark mode header remains readable when sticky */
.theme-dark .table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
}

/* Optional: make first column sticky when table has .table-sticky-first */
.table.table-sticky-first thead th:first-child,
.table.table-sticky-first tbody td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
}
/* Light mode backgrounds for sticky first column */
body:not(.theme-dark) .table.table-sticky-first thead th:first-child {
  background-color: #1f6f5c; /* same as header bg */
  color: #fff;
  z-index: 3;
}
body:not(.theme-dark) .table.table-sticky-first tbody td:first-child {
  background-color: #ffffff;
  box-shadow: 2px 0 0 rgba(0,0,0,0.06);
}
/* Dark mode backgrounds for sticky first column */
.theme-dark .table.table-sticky-first thead th:first-child {
  background-color: var(--surface);
  color: var(--text);
  z-index: 3;
}
.theme-dark .table.table-sticky-first tbody td:first-child {
  background-color: var(--surface);
  box-shadow: 2px 0 0 rgba(0,0,0,0.3);
}

/* Announcements card prominence */
.border-info { border-color: #b6f0e5 !important; }
/* Light mode header only */
body:not(.theme-dark) .card.border-info .card-header { background: #f0fbf8; }
/* Subtle body gradient for announcements in light mode */
body:not(.theme-dark) .card.border-info { 
  background-image: linear-gradient(180deg, rgba(136,214,199,0.14) 0%, rgba(125,220,142,0.10) 100%);
}
/* Dark mode announcements card */
.theme-dark .card.border-info { background: var(--surface); border-color: #2a364a; }
.theme-dark .card.border-info .card-header { background: var(--surface); border-bottom: 1px solid #2a364a; color: var(--text); }
.theme-dark .card.border-info .card-header i { color: var(--primary); }
/* Top accent and gentle hover for Announcements in dark mode */
.theme-dark .card.border-info { position: relative; transition: box-shadow .2s ease, transform .2s ease; }
.theme-dark .card.border-info::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary-strong) 100%);
  border-top-left-radius: 16px; border-top-right-radius: 16px;
}
.theme-dark .card.border-info:hover { box-shadow: 0 10px 26px rgba(0,0,0,.35); }

/* Apply the same top accent + hover to other key cards in dark mode */
.theme-dark .card.border-primary, .theme-dark .card.border-dark, .theme-dark .card.border-secondary {
  position: relative; transition: box-shadow .2s ease, transform .2s ease;
}
.theme-dark .card.border-primary::before, .theme-dark .card.border-dark::before, .theme-dark .card.border-secondary::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary-strong) 100%);
  border-top-left-radius: 16px; border-top-right-radius: 16px;
}
.theme-dark .card.border-primary:hover, .theme-dark .card.border-dark:hover, .theme-dark .card.border-secondary:hover {
  box-shadow: 0 10px 26px rgba(0,0,0,.35);
}

/* Footer subtle style */
footer { border-top: 1px solid rgba(0,0,0,0.06); }
/* Lists & items */
.list-group-item { border-color: var(--border-soft); }

/* Centered auth card with gradient fill */
.auth-card {
    background-image: linear-gradient(180deg, rgba(125,220,142,0.28) 0%, rgba(79,201,122,0.28) 100%);
    border-radius: 18px;
}
.auth-card .card-header { background: transparent; border-bottom: none; }
.auth-title { text-align: center; font-weight: 600; }

.assignment-card, .category-card {
    transition: transform 0.3s ease;
}

.assignment-card:hover, .category-card:hover {
    transform: translateY(-2px);
}

/* Better readability for project/category cards in dark mode */
.theme-dark .category-card, .theme-dark .assignment-card { color: var(--text); }
.theme-dark .category-card .card-title, .theme-dark .assignment-card .card-title {
  color: var(--text) !important;
  font-size: 1.15rem;
  font-weight: 700;
}
.theme-dark .category-card .text-muted, .theme-dark .assignment-card .text-muted { color: #d9caa6 !important; }
.theme-dark .category-card a, .theme-dark .assignment-card a { color: var(--text); }
.theme-dark .category-card a:hover, .theme-dark .assignment-card a:hover { opacity: .95; }

/* Make action buttons inside cards clear and consistent */
.theme-dark .category-card .btn, .theme-dark .assignment-card .btn {
  background-color: #727E94;
  border-color: #727E94;
  color: #ffffff;
}
.theme-dark .category-card .btn:hover, .theme-dark .assignment-card .btn:hover { background-color: #5f6b82; border-color: #5f6b82; }

/* Slightly clearer borders for cards in dark mode */
.theme-dark .category-card, .theme-dark .assignment-card { border-color: #2f3f68; }

/* Subtle text edge for readability on dark surfaces */
.theme-dark .category-card .card-title, .theme-dark .assignment-card .card-title,
.theme-dark .category-card .card-text, .theme-dark .assignment-card .card-text {
  text-shadow: 0 1px 0 rgba(0,0,0,0.35);
}

.dashboard-stat {
    text-align: center;
    padding: 20px;
}

.dashboard-stat h3 {
    font-size: 2.5rem;
    margin-bottom: 0;
}

.dashboard-stat p {
    margin-top: 0;
    color: #6c757d;
}

.submission-card {
    margin-bottom: 15px;
}

.deadline-passed {
    color: #dc3545;
    font-weight: bold;
}

.deadline-approaching {
    color: #fd7e14;
    font-weight: bold;
}

.deadline-future {
    color: #198754;
}

.file-upload {
    margin: 20px 0;
    padding: 20px;
    border: 2px dashed #dee2e6;
    border-radius: 5px;
    text-align: center;
}

.file-upload.dragover {
    border-color: #0d6efd;
    background-color: rgba(13, 110, 253, 0.05);
}

.post-meta {
    font-size: 0.9rem;
    color: #6c757d;
    margin-bottom: 15px;
}

.attachment-link {
    display: inline-block;
    margin-top: 10px;
    padding: 5px 10px;
    background-color: #e9ecef;
    border-radius: 4px;
    text-decoration: none;
    color: #495057;
}

.attachment-link:hover {
    background-color: #dee2e6;
    color: #212529;
}

.grade-badge {
    font-size: 1.2rem;
    padding: 5px 10px;
    border-radius: 4px;
}

.grade-a {
    background-color: #d4edda;
    color: #155724;
}

.grade-b {
    background-color: #d1ecf1;
    color: #0c5460;
}

.grade-c {
    background-color: #fff3cd;
    color: #856404;
}

.grade-d {
    background-color: #f8d7da;
    color: #721c24;
}

.grade-f {
    background-color: #f5c6cb;
    color: #721c24;
}

.feedback-box {
    margin-top: 15px;
    padding: 15px;
    background-color: #f8f9fa;
    border-left: 4px solid #0d6efd;
    border-radius: 4px;
}

/* ===== Home page enhancements ===== */
.hover-shadow {
    transition: transform .2s ease, box-shadow .2s ease;
}
.hover-shadow:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 24px rgba(0,0,0,.12);
}

.hero {
    color: #0b3b32;
}
.hero .hero-logo {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    background: rgba(255,255,255,.6);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,.08);
}

.decorative-bg {
    position: relative;
}
.decorative-bg::before {
    content: '';
    position: absolute;
    inset: -8px;
    background: radial-gradient(600px 200px at 0% -20%, rgba(91,208,138,.18) 0%, rgba(91,208,138,0) 70%);
    pointer-events: none;
    z-index: 0;
}
.hero-gradient {
    background: radial-gradient(1200px 400px at 100% -10%, rgba(111,211,196,.35) 0%, rgba(91,208,138,.25) 40%, rgba(255,255,255,.0) 70%),
                linear-gradient(180deg, rgba(255,255,255,.8) 0%, rgba(255,255,255,.7) 100%);
    border: 1px solid rgba(0,0,0,.04);
}

.glass {
    background: rgba(255,255,255,0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.4);
}

.section-title {
    display: flex;
    align-items: center;
    gap: .5rem;
    color: #0b3b32;
    font-weight: 600;
    margin-bottom: .75rem;
}
.section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, rgba(0,0,0,.12), rgba(0,0,0,0));
}

.stat-pill {
    display: inline-block;
    padding: .25rem .75rem;
    border-radius: 9999px;
    background: #e8f5f1;
    color: #0b3b32;
    font-weight: 600;
}

.list-clean {
    list-style: none;
    padding: 0;
    margin: 0;
}
.list-clean li + li {
    border-top: 1px dashed rgba(0,0,0,.08);
}

/* ===== Subtle reveal animations ===== */
@keyframes revealFadeUp {
    0% { opacity: 0; transform: translateY(10px); }
    100% { opacity: 1; transform: translateY(0); }
}

.reveal {
    opacity: 0;
    animation: revealFadeUp .6s ease forwards;
}

/* Stagger helpers */
.stagger > *:nth-child(1) { animation-delay: .05s; }
.stagger > *:nth-child(2) { animation-delay: .15s; }
.stagger > *:nth-child(3) { animation-delay: .25s; }
.stagger > *:nth-child(4) { animation-delay: .35s; }
.stagger > *:nth-child(5) { animation-delay: .45s; }

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .reveal { animation: none !important; opacity: 1 !important; }
}

/* ===== MOBILE OPTIMIZATIONS ===== */
/* Mobile-first responsive design improvements */

/* Mobile viewport and touch optimizations */
@media (max-width: 768px) {
  /* Better spacing for mobile */
  .container-fluid { padding-left: 15px; padding-right: 15px; }
  
  /* Larger touch targets */
  .btn { 
    min-height: 44px; 
    padding: 12px 16px;
    font-size: 16px; /* Prevents zoom on iOS */
  }
  .btn-sm { 
    min-height: 40px; 
    padding: 10px 14px; 
    font-size: 14px;
  }
  
  /* Form inputs optimized for mobile */
  .form-control {
    min-height: 48px;
    font-size: 16px; /* Prevents zoom on iOS */
    padding: 12px 16px;
  }
  
  /* Card improvements for mobile */
  .card {
    margin-bottom: 16px;
    border-radius: 12px;
  }
  
  /* Better navbar for mobile */
  .navbar {
    padding: 8px 15px;
    min-height: 60px;
  }
  
  .navbar-brand {
    font-size: 16px;
  }
  
  /* Mobile navbar improvements */
  .navbar-nav .nav-link {
    padding: 10px 16px !important;
    margin: 0;
    border-radius: 8px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    font-weight: 500;
    font-size: 15px;
  }
  
  .navbar-nav .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.15);
    transform: translateX(2px);
  }
  
  .navbar-nav .nav-link.active {
    background-color: rgba(255, 255, 255, 0.2);
    font-weight: 600;
    border-left: 3px solid #047857;
  }
  
  /* Compact mobile menu */
  .navbar-collapse {
    margin-top: 8px;
    padding: 8px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
  }
  
  /* Mobile menu container */
  .mobile-menu-container {
    padding: 0 8px;
  }
  
  /* Icon spacing in mobile */
  .nav-link i {
    width: 18px;
    text-align: center;
    font-size: 15px;
  }
  
  /* Remove gaps between menu items */
  .main-links {
    gap: 0;
    margin: 0;
    padding: 0;
  }
  
  .main-links .nav-item {
    width: 100%;
    margin: 0;
    padding: 0;
  }
  
  /* Compact list styling */
  .main-links .nav-item + .nav-item {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }
  
  /* Group menu items together */
  .main-links {
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 4px;
    margin: 8px 0;
  }
  
  /* First and last item styling */
  .main-links .nav-item:first-child .nav-link {
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
  }
  
  .main-links .nav-item:last-child .nav-link {
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
  }
  
  /* Remove individual borders and use container */
  .main-links .nav-item + .nav-item {
    border-top: none;
  }
  
  .main-links .nav-item + .nav-item .nav-link {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0;
  }
  
  /* Profile dropdown improvements */
  .navbar-nav .dropdown-menu {
    border: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-radius: 12px;
    margin-top: 8px;
  }
  
  .dropdown-item {
    padding: 12px 16px;
    font-size: 15px;
  }
  
  /* Language toggle button */
  .btn-outline-dark {
    min-height: 36px;
    padding: 8px 12px;
    font-size: 14px;
    font-weight: 600;
  }

  /* Mobile Quick Actions Bar */
  .mobile-quick-actions {
    order: 2;
    background-color: rgba(255, 255, 255, 0.08);
    padding: 6px 10px;
    border-radius: 25px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  }
  
  .mobile-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.1);
    color: #047857 !important;
    text-decoration: none;
    transition: all 0.2s ease;
    border: 1px solid rgba(255, 255, 255, 0.15);
  }
  
  .mobile-icon-btn:hover {
    background-color: rgba(255, 255, 255, 0.25);
    color: #065f46 !important;
    transform: scale(1.1);
  }
  
  .mobile-icon-btn i {
    font-size: 14px;
  }
  
  .mobile-icon-btn span {
    font-size: 12px;
  }
  
  /* Mobile badge positioning */
  .mobile-badge {
    font-size: 10px;
    min-width: 16px;
    height: 16px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  /* Mobile dropdown styling */
  .mobile-dropdown {
    min-width: 200px;
    border: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-radius: 12px;
    margin-top: 8px;
  }
  
  .mobile-dropdown .dropdown-item {
    padding: 10px 16px;
    font-size: 14px;
  }
  
  .mobile-dropdown .dropdown-header {
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 600;
    color: #6c757d;
  }
  
  /* Navbar toggler positioning */
  .navbar-toggler {
    order: 3;
    margin-left: 8px;
  }

  /* Mobile navbar container improvements */
  .navbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  
  .navbar-brand {
    order: 1;
    flex: 1;
  }
  
  /* Hide desktop bubble group on mobile */
  .bubble-group {
    display: none !important;
  }
  
  /* Mobile responsive cards */
  .card {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  }
  
  /* Mobile form improvements */
  .form-control, .form-select {
    border-radius: 8px;
  }
  
  /* Mobile button improvements */
  .btn {
    border-radius: 8px;
  }
  
  /* Mobile alert improvements */
  .alert {
    border-radius: 8px;
    margin-bottom: 16px;
  }

  /* Mobile Bottom Navigation */
  .mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #CCEAE2 0%, #B8E6D3 100%);
    border-top: 1px solid rgba(4, 120, 87, 0.2);
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    padding: 8px 0;
  }
  
  .bottom-nav-container {
    display: flex;
    justify-content: space-around;
    align-items: center;
    max-width: 100%;
    margin: 0 auto;
    padding: 0 8px;
  }
  
  .bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #047857 !important;
    padding: 8px 4px;
    border-radius: 12px;
    transition: all 0.2s ease;
    min-width: 50px;
    flex: 1;
    max-width: 80px;
  }
  
  .bottom-nav-item:hover {
    color: #065f46 !important;
    background-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
  }
  
  .bottom-nav-item.active {
    color: #065f46 !important;
    background-color: rgba(255, 255, 255, 0.3);
    font-weight: 600;
  }
  
  .bottom-nav-item i {
    font-size: 18px;
    margin-bottom: 4px;
  }
  
  .bottom-nav-item span {
    font-size: 10px;
    font-weight: 500;
    text-align: center;
    line-height: 1.2;
  }
  
  /* Adjust main content for bottom nav */
  .mobile-main-content {
    padding-bottom: 80px;
  }
  
  /* Responsive bottom nav for different screen sizes */
  @media (max-width: 360px) {
    .bottom-nav-item span {
      font-size: 9px;
    }
    .bottom-nav-item i {
      font-size: 16px;
    }
  }
  
  @media (min-width: 361px) and (max-width: 480px) {
    .bottom-nav-item {
      max-width: 70px;
    }
  }
  
  /* Hide bottom nav on larger screens */
  @media (min-width: 992px) {
    .mobile-bottom-nav {
      display: none !important;
    }
    .mobile-main-content {
      padding-bottom: 0;
    }
  }
  
  /* Mobile-friendly tables */
  .table-responsive {
    border: none;
    margin-bottom: 0;
  }
  
  .table {
    font-size: 14px;
  }
  
  .table th,
  .table td {
    padding: 8px 6px;
    white-space: nowrap;
  }
  
  /* Stack buttons vertically on mobile */
  .btn-group-vertical-mobile {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  
  .btn-group-vertical-mobile .btn {
    width: 100%;
  }
  
  /* Better spacing for cards */
  .card-body {
    padding: 16px;
  }
  
  .card-header {
    padding: 12px 16px;
  }
  
  .card-footer {
    padding: 12px 16px;
  }
  
  /* Typography adjustments */
  h1 { font-size: 1.8rem; }
  h2 { font-size: 1.6rem; }
  h3 { font-size: 1.4rem; }
  h4 { font-size: 1.2rem; }
  
  /* Dashboard stats responsive */
  .dashboard-stat h3 {
    font-size: 2rem;
  }
  
  /* Better modal for mobile */
  .modal-dialog {
    margin: 10px;
    max-width: calc(100% - 20px);
  }
  
  /* Improved dropdown for mobile */
  .dropdown-menu {
    min-width: 200px;
    font-size: 16px;
  }
  
  .dropdown-item {
    padding: 12px 16px;
  }
}

/* Extra small devices (phones, less than 576px) */
@media (max-width: 575.98px) {
  /* Even more compact spacing */
  .container-fluid { padding-left: 10px; padding-right: 10px; }
  
  /* Stack card actions vertically */
  .card-footer .d-flex {
    flex-direction: column !important;
    gap: 8px;
  }
  
  .card-footer .btn {
    width: 100%;
  }
  
  /* Better table for very small screens */
  .table-responsive {
    font-size: 12px;
  }
  
  /* Hide less important columns on very small screens */
  .table .d-none-xs {
    display: none !important;
  }
  
  /* Compact navbar */
  .navbar {
    padding: 6px 10px;
  }
  
  .navbar-brand {
    font-size: 16px;
  }
  
  /* Better form layout */
  .form-group {
    margin-bottom: 16px;
  }
  
  /* Compact alerts */
  .alert {
    padding: 12px;
    font-size: 14px;
  }
}

/* Medium devices (tablets, 768px and up) */
@media (min-width: 768px) and (max-width: 991.98px) {
  /* Tablet optimizations */
  .card {
    margin-bottom: 20px;
  }
  
  /* Better button groups for tablets */
  .btn-group {
    flex-wrap: wrap;
    gap: 4px;
  }
  
  /* Improved table spacing */
  .table th,
  .table td {
    padding: 10px 8px;
  }
  
  /* Hide mobile quick actions on tablets */
  .mobile-quick-actions {
    display: none !important;
  }
  
  /* Show desktop bubble group on tablets */
  .bubble-group {
    display: flex !important;
  }
}

/* Large devices (desktops, 992px and up) */
@media (min-width: 992px) {
  /* Desktop navbar improvements */
  .navbar .container {
    display: flex;
    align-items: center;
  }
  
  .navbar-brand {
    order: unset;
    flex: unset;
  }
  
  /* Hide mobile quick actions on desktop */
  .mobile-quick-actions {
    display: none !important;
  }
  
  /* Show desktop bubble group */
  .bubble-group {
    display: flex !important;
    align-items: center;
    gap: 20px;
  }
  
  /* Desktop navbar improvements */
  .navbar {
    padding: 12px 0;
    min-height: 70px;
  }
  
  .navbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  
  /* Desktop Quick Actions */
  .desktop-quick-actions {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.08) 100%);
    padding: 8px 16px;
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
  }
  
  .desktop-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0.1) 100%);
    color: #047857 !important;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1.5px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  }
  
  .desktop-icon-btn:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.35) 0%, rgba(255, 255, 255, 0.2) 100%);
    color: #065f46 !important;
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    border-color: rgba(255, 255, 255, 0.4);
  }
  
  .desktop-icon-btn i {
    font-size: 18px;
    font-weight: 500;
  }
  
  /* Desktop badge */
  .desktop-badge {
    font-size: 11px;
    min-width: 20px;
    height: 20px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.9);
  }
  
  /* Desktop dropdown */
  .desktop-dropdown {
    min-width: 280px;
    border: none;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
    border-radius: 20px;
    margin-top: 16px;
    backdrop-filter: blur(20px);
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.3);
  }
  
  .desktop-dropdown .dropdown-item {
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 12px;
    margin: 4px 8px;
    transition: all 0.2s ease;
  }
  
  .desktop-dropdown .dropdown-item:hover {
    background: linear-gradient(135deg, rgba(4, 120, 87, 0.1) 0%, rgba(4, 120, 87, 0.05) 100%);
    color: #047857;
    transform: translateX(4px);
  }
  
  .desktop-dropdown .dropdown-header {
    padding: 12px 20px 8px;
    font-size: 12px;
    font-weight: 700;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }
  
  /* Language button */
  .desktop-lang-btn {
    display: inline-flex;
    align-items: center;
    padding: 10px 20px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.08) 100%);
    color: #047857 !important;
    text-decoration: none;
    border-radius: 30px;
    border: 1.5px solid rgba(255, 255, 255, 0.25);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 600;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
  }
  
  .desktop-lang-btn:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.25) 0%, rgba(255, 255, 255, 0.15) 100%);
    color: #065f46 !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    border-color: rgba(255, 255, 255, 0.4);
  }
  
  .desktop-lang-btn i {
    font-size: 16px;
    margin-right: 6px;
  }
  
  /* Navbar divider */
  .navbar-divider {
    width: 2px;
    height: 35px;
    background: linear-gradient(180deg, transparent 0%, rgba(255, 255, 255, 0.3) 20%, rgba(255, 255, 255, 0.3) 80%, transparent 100%);
    border-radius: 1px;
  }
  
  /* Desktop card styling */
  .card {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
    margin-bottom: 20px;
  }
  
  /* Desktop button styling */
  .btn {
    border-radius: 9999px;
  }
  
  /* Desktop form styling */
  .form-control, .form-select {
    border-radius: 9999px;
  }
  
  /* Desktop alert styling */
  .alert {
    border-radius: 16px;
  }
  
  /* Profile dropdown improvements */
  .navbar-nav .dropdown-toggle {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.08) 100%);
    border: 1.5px solid rgba(255, 255, 255, 0.25);
    border-radius: 30px;
    padding: 8px 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
  }
  
  .navbar-nav .dropdown-toggle:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.25) 0%, rgba(255, 255, 255, 0.15) 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    border-color: rgba(255, 255, 255, 0.4);
  }
  
  .navbar-nav .dropdown-toggle .icon-bubble {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0.1) 100%);
    width: 35px;
    height: 35px;
    border: 1.5px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  }
  
  .navbar-nav .dropdown-menu {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
    border-radius: 20px;
    margin-top: 16px;
    min-width: 200px;
  }
  
  .navbar-nav .dropdown-item {
    padding: 12px 20px;
    font-weight: 500;
    border-radius: 12px;
    margin: 4px 8px;
    transition: all 0.2s ease;
  }
  
  .navbar-nav .dropdown-item:hover {
    background: linear-gradient(135deg, rgba(4, 120, 87, 0.1) 0%, rgba(4, 120, 87, 0.05) 100%);
    color: #047857;
    transform: translateX(4px);
  }
}

/* Touch-friendly improvements for all mobile devices */
@media (hover: none) and (pointer: coarse) {
  /* Better touch targets */
  .btn, .nav-link, .dropdown-item {
    min-height: 44px;
    display: flex;
    align-items: center;
  }
  
  /* Remove hover effects on touch devices */
  .btn:hover,
  .card:hover,
  .nav-link:hover {
    transform: none;
  }
  
  /* Better focus states for touch */
  .btn:focus,
  .form-control:focus,
  .nav-link:focus {
    outline: 2px solid var(--primary-2);
    outline-offset: 2px;
  }
}

/* Landscape orientation optimizations */
@media (max-width: 768px) and (orientation: landscape) {
  /* Compact navbar in landscape */
  .navbar {
    padding: 4px 15px;
  }
  
  /* Reduce vertical spacing */
  .card {
    margin-bottom: 12px;
  }
  
  .section {
    padding-block: 1rem;
  }
}

/* High DPI displays (Retina) */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  /* Sharper borders and shadows */
  .card {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  }
  
  .btn {
    border-width: 0.5px;
  }
}

/* Dark mode mobile optimizations */
@media (max-width: 768px) {
  .theme-dark .card {
    box-shadow: 0 4px 16px var(--card-shadow);
  }
  
  .theme-dark .navbar {
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  }
  
  .theme-dark .modal-content {
    margin: 10px;
  }
}

/* Accessibility improvements for mobile */
@media (max-width: 768px) {
  /* Larger focus indicators */
  *:focus {
    outline-width: 3px;
    outline-offset: 2px;
  }
  
  /* Better contrast for small text */
  .text-muted {
    color: #495057 !important;
  }
  
  .theme-dark .text-muted {
    color: #e9ecef !important;
  }
  
  /* Ensure minimum text size */
  small, .small {
    font-size: 14px !important;
  }
}

/* Print optimizations */
@media print {
  .navbar,
  .btn,
  .card-footer,
  footer {
    display: none !important;
  }
  
  .card {
    border: 1px solid #000 !important;
    box-shadow: none !important;
  }
  
  body {
    background: white !important;
    color: black !important;
  }
}