/* style.css - Athi River Secondary School Library System */
/* Color Theme: Black, White, Red */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

html {
    scroll-behavior: smooth;
}

:root {
    --primary-black: #000000;
    --secondary-black: #111111;
    --dark-gray: #222222;
    --medium-gray: #333333;
    --light-gray: #444444;
    --white: #FFFFFF;
    --off-white: #F8F9FA;
    --pure-white: #FFFFFF;
    --primary-red: #E74C3C;
    --dark-red: #C0392B;
    --light-red: #FDEDEC;
    --success-green: #27AE60;
    --warning-orange: #F39C12;
    --info-blue: #3498DB;
    --shadow: rgba(0, 0, 0, 0.2);
    --transition: all 0.3s ease;
}

/* Base font sizing for better mobile fit */
html {
    font-size: 14px;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--secondary-black);
    color: var(--white);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    flex: 1;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    color: var(--white);
    margin-bottom: 1rem;
    font-weight: 600;
}

h1 {
    font-size: 2rem;
    color: var(--primary-red);
}

h2 {
    font-size: 1.6rem;
    border-bottom: 2px solid var(--primary-red);
    padding-bottom: 10px;
    margin-bottom: 20px;
}

h3 {
    font-size: 1.2rem;
}

p {
    margin-bottom: 1rem;
    color: #DDDDDD;
}

a {
    color: var(--primary-red);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--white);
    text-decoration: underline;
}

/* Navigation */
.navbar {
    background-color: var(--primary-black);
    border-bottom: 3px solid var(--primary-red);
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
}

.nav-brand a {
    color: var(--white);
    font-size: 1.15rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-brand a:hover {
    color: var(--primary-red);
    text-decoration: none;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-start;
}

.nav-menu a {
    color: var(--white);
    padding: 8px 12px;
    border-radius: 4px;
    transition: var(--transition);
    display: inline-block;
    white-space: nowrap;
}

/* Admin tabs */
.admin-tabs {
    display:flex;
    gap:8px;
    margin-bottom:12px;
    flex-wrap:wrap;
}
.admin-tabs .tab {
    padding:8px 12px;
    border-radius:6px;
    background: #161616;
    color: #ddd;
    text-decoration: none;
    border: 1px solid rgba(255,255,255,0.03);
}
.admin-tabs .tab:hover { background:#1f1f1f; color:#fff; }
.admin-tabs .tab.active {
    background: var(--primary-red);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}
.admin-tabs .tab.tab-return { border-left: 3px solid var(--primary-red); }

.nav-menu a:hover {
    background-color: var(--primary-red);
    color: var(--white);
    text-decoration: none;
}

.logout-btn {
    background-color: var(--dark-red);
    color: var(--white) !important;
    padding: 8px 12px;
}

.logout-btn:hover {
    background-color: var(--primary-red) !important;
}

.user-welcome {
    color: var(--primary-red);
    font-weight: bold;
    margin-left: 10px;
    font-size: 0.8rem;
    display: inline-block;
}

/* Dropdown */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropbtn {
    background-color: transparent;
    color: var(--white);
    padding: 8px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: var(--transition);
}

.dropbtn:hover {
    background-color: var(--primary-red);
    color: var(--white);
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: var(--primary-black);
    min-width: 180px;
    box-shadow: 0px 8px 16px 0px var(--shadow);
    z-index: 1;
    border-radius: 4px;
    border: 1px solid var(--primary-red);
    top: 100%;
    left: 0;
    margin-top: 5px;
}

.dropdown-content a {
    color: var(--white);
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    transition: var(--transition);
    touch-action: manipulation;
}

.dropdown-content a:hover {
    background-color: var(--primary-red);
}

.dropdown:hover .dropdown-content {
    display: block;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 8px 18px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    text-align: center;
    transition: var(--transition);
    text-decoration: none !important;
}

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

.btn-primary:hover {
    background-color: var(--dark-red);
    color: var(--white);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow);
}

.btn-secondary {
    background-color: transparent;
    color: var(--white);
    border: 2px solid var(--white);
}

.btn-secondary:hover {
    background-color: var(--white);
    color: var(--primary-black);
}

.btn-danger {
    background-color: var(--dark-red);
    color: var(--white);
}

.btn-danger:hover {
    background-color: #A93226;
    color: var(--white);
}

.btn-small {
    padding: 5px 15px;
    font-size: 0.9rem;
}

.btn-block {
    display: block;
    width: 100%;
}

.btn i {
    margin-right: 8px;
}

/* Badges for counts */
.badge {
    display: inline-block;
    background: var(--white);
    color: var(--primary-black);
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
    margin-left: 8px;
    font-size: 0.85rem;
}
.badge-warning {
    background: var(--warning-orange);
    color: var(--primary-black);
}

/* Hero Section */
.hero {
    background: linear-gradient(rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0.9)), url('https://images.unsplash.com/photo-1481627834876-b7833e8f5570?ixlib=rb-1.2.1&auto=format&fit=crop&w=1200&q=80');
    background-size: cover;
    background-position: center;
    padding: 60px 15px;
    text-align: center;
    border-radius: 10px;
    margin-bottom: 40px;
    border: 2px solid var(--primary-red);
}

.hero-content h1 {
    color: var(--white);
    font-size: 2rem;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px var(--primary-black);
}

.hero-subtitle {
    font-size: 1rem;
    color: #EEEEEE;
    margin-bottom: 30px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.hero-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Features Section */
.features {
    padding: 40px 0;
    margin-bottom: 40px;
}

.section-title {
    text-align: center;
    margin-bottom: 40px;
    color: var(--white);
}

.section-title i {
    color: var(--primary-red);
    margin-right: 10px;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin-top: 30px;
}

.feature-card {
    background-color: var(--medium-gray);
    padding: 30px;
    border-radius: 8px;
    text-align: center;
    transition: var(--transition);
    border: 1px solid var(--light-gray);
}

.feature-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary-red);
    box-shadow: 0 8px 25px var(--shadow);
}

.feature-icon {
    font-size: 2.2rem;
    color: var(--primary-red);
    margin-bottom: 20px;
}

.feature-card h3 {
    color: var(--white);
    margin-bottom: 15px;
}

.feature-card p {
    color: #CCCCCC;
}

/* Form Styles */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 70vh;
    padding: 20px;
}

.auth-card {
    background-color: var(--medium-gray);
    padding: 28px;
    border-radius: 10px;
    width: 100%;
    max-width: 450px;
    border: 1px solid var(--light-gray);
}

.auth-title {
    text-align: center;
    margin-bottom: 30px;
    color: var(--white);
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--white);
    font-weight: 600;
}

.form-group label i {
    color: var(--primary-red);
    margin-right: 8px;
    width: 20px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    background-color: var(--dark-gray);
    border: 1px solid var(--light-gray);
    border-radius: 4px;
    color: var(--white);
    font-size: 0.95rem;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-red);
    box-shadow: 0 0 0 2px rgba(231, 76, 60, 0.2);
}

/* Autocomplete suggestions for login */
.suggestions {
    position: relative;
    margin-top: 6px;
}
.suggestions .suggest-item {
    background: var(--dark-gray);
    padding: 8px 10px;
    border: 1px solid var(--light-gray);
    cursor: pointer;
}
.suggestions .suggest-item + .suggest-item {
    border-top: none;
}

/* Modal styles for admin password (shared) */
.modal {
    display: none; /* controlled via inline style/display:flex */
    align-items: center;
    justify-content: center;
}
.modal > div {
    background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, #FFFFFF 100%);
    color: var(--primary-black);
    border-radius: 10px;
    padding: 20px;
    max-width: 480px;
    width: 96%;
    box-shadow: 0 12px 40px rgba(0,0,0,0.35);
    border: 1px solid rgba(0,0,0,0.06);
}
.modal h3 {
    margin: 0 0 6px 0;
    color: var(--primary-black);
}
.modal p { color: #333333; margin-bottom: 12px; }
.modal input[type="password"] {
    width: 100%;
    padding: 10px 12px;
    border-radius: 6px;
    border: 1px solid #E6E6E6;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.03);
    margin-bottom: 12px;
    font-size: 1rem;
}
.modal .btn { padding: 8px 14px; border-radius: 6px; }
.modal .btn:not(.btn-primary) {
    background: #F2F2F2; color: #222; border: none;
}
.modal .btn-primary { background: var(--primary-red); color: var(--white); border: none; }
.modal .btn + .btn { margin-left: 8px; }

/* small animation */
.modal > div { transform: translateY(-8px); opacity: 0; transition: transform 220ms ease, opacity 220ms ease; }
.modal.open > div { transform: translateY(0); opacity: 1; }

@media (max-width: 520px) {
    .modal > div { padding: 14px; }
    .modal input[type="password"] { font-size: 0.95rem; }
}

/* Simple tooltip using data-tooltip attribute */
.tooltip {
    position: relative;
    display: inline-block;
    cursor: help;
    color: var(--info-blue);
}
.tooltip:after {
    content: attr(data-tooltip);
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: calc(100% + 8px);
    background: rgba(0,0,0,0.85);
    color: #fff;
    padding: 6px 8px;
    border-radius: 6px;
    white-space: nowrap;
    font-size: 0.85rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 150ms ease, transform 150ms ease;
    transform-origin: bottom center;
}
.tooltip:hover:after,
.tooltip:focus:after {
    opacity: 1;
    transform: translateX(-50%) translateY(-4px);
}

.rv-locked { color: #bbb; margin-left: 8px; }

/* Info banner used on some pages */
.info-banner {
    background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01));
    border-left: 4px solid var(--primary-red);
    padding: 10px 14px;
    border-radius: 6px;
    color: #EEE;
    margin-bottom: 14px;
    font-size: 0.98rem;
}
.info-banner a { color: var(--primary-red); text-decoration: underline; }

/* Chat styles for talk_to_admin */
.chat-wrapper { max-width: 900px; margin: 0 auto; }
.chat-container {
    background: linear-gradient(180deg, #101010, #0d0d0d);
    border: 1px solid #222;
    padding: 18px;
    border-radius: 10px;
    max-height: 520px;
    overflow-y: auto;
    margin-bottom: 12px;
}
.chat-item { display:flex; margin-bottom:12px; }
.chat-item.user { justify-content:flex-end; }
.chat-item.admin { justify-content:flex-start; }
.chat-bubble { max-width:80%; padding:10px 14px; border-radius:12px; box-shadow:0 6px 18px rgba(0,0,0,0.45); }
.user-bubble { background: linear-gradient(180deg,#1b7aeb,#155ecf); color:#fff; border-bottom-right-radius:2px; }
.admin-bubble { background: linear-gradient(180deg,#222,#181818); color:#ddd; border-bottom-left-radius:2px; }
.chat-text { margin-bottom:6px; white-space:pre-wrap; }
.chat-time { font-size:0.8rem; color:#bbb; text-align:right; }
.chat-meta { font-size:0.85rem; color:#ffdca3; margin-bottom:6px; }
.chat-form { display:flex; gap:8px; align-items:center; }
.chat-form textarea { flex:1; min-height:56px; padding:10px;border-radius:8px;border:1px solid #333;background:#0b0b0b;color:#fff; }
.chat-form input[type="text"] { width:280px;padding:8px;border-radius:8px;border:1px solid #333;background:#0b0b0b;color:#fff; }
.chat-form button { padding:10px 16px;border-radius:8px; }
.chat-empty { color:#aaa;text-align:center;padding:40px 0; }
.suggestions .suggest-item.active {
    background: var(--primary-red);
    color: var(--white);
}

.form-hint {
    display: block;
    margin-top: 5px;
    color: #999;
    font-size: 0.9rem;
}

.auth-links {
    margin-top: 25px;
    text-align: center;
    color: #CCCCCC;
}

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

/* Dashboard Styles */
.dashboard-header {
    background-color: var(--medium-gray);
    padding: 30px;
    border-radius: 8px;
    margin-bottom: 30px;
    border-left: 5px solid var(--primary-red);
}

.dashboard-header h1 {
    color: var(--white);
}

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background-color: var(--dark-gray);
    padding: 25px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: var(--transition);
    border: 1px solid var(--light-gray);
}

.stat-card:hover {
    border-color: var(--primary-red);
    transform: translateY(-3px);
}

.stat-icon {
    font-size: 1.8rem;
    color: var(--primary-red);
}

.stat-info h3 {
    font-size: 1rem;
    color: #999;
    margin-bottom: 5px;
}

.stat-info p {
    font-size: 1.4rem;
    font-weight: bold;
    color: var(--white);
}

.stat-breakdown {
    display: block;
    font-size: 0.8rem;
    color: #999;
    font-weight: normal;
    margin-top: 5px;
}

/* Books Grid */
.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
    margin-top: 30px;
}

.book-card {
    background-color: var(--medium-gray);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--light-gray);
    transition: var(--transition);
}

.book-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary-red);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.book-icon {
    background-color: var(--dark-red);
    color: var(--white);
    font-size: 2.2rem;
    padding: 22px;
    text-align: center;
}

.book-info {
    padding: 20px;
}

.book-info h3 {
    color: var(--white);
    margin-bottom: 10px;
    font-size: 1rem;
}

.book-author {
    color: var(--primary-red);
    font-style: italic;
    margin-bottom: 10px;
}

.book-type {
    margin-bottom: 10px;
}

.type-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
}

.type-badge.digital {
    background: #3498db;
    color: white;
}

.type-badge.physical {
    background: #e67e22;
    color: white;
}

.book-card.physical-book {
    border-left: 4px solid #e67e22;
}

.btn-success {
    background-color: #27ae60;
    color: white;
}

.btn-success:hover {
    background-color: #229954;
}

.btn-disabled {
    background-color: #95a5a6;
    color: #ecf0f1;
    cursor: not-allowed;
    opacity: 0.6;
}

.book-category {
    display: inline-block;
    background-color: var(--dark-gray);
    color: #CCCCCC;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.85rem;
    margin-bottom: 15px;
}

.book-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.book-meta {
    margin-top: 10px;
}

.copies {
    display: inline-block;
    background-color: var(--primary-red);
    color: var(--white);
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

.physical-book .book-icon {
    background-color: var(--primary-red);
}

/* Admin Styles */
.admin-table {
    width: 100%;
    background-color: var(--dark-gray);
    border-collapse: collapse;
    border: 1px solid var(--light-gray);
}

.admin-table th {
    background-color: var(--primary-black);
    color: var(--white);
    padding: 15px;
    text-align: left;
    border-bottom: 2px solid var(--primary-red);
}

.admin-table td {
    padding: 15px;
    border-bottom: 1px solid var(--light-gray);
    color: #DDDDDD;
}

.admin-table tr:hover {
    background-color: var(--medium-gray);
}

.role-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: bold;
}

.role-admin {
    background-color: var(--dark-red);
    color: var(--white);
}

.role-teacher {
    background-color: var(--info-blue);
    color: var(--white);
}

.role-learner {
    background-color: var(--success-green);
    color: var(--white);
}

/* Search Bar */
.search-bar {
    display: flex;
    margin: 30px 0;
    align-items: center;
}

.clear-search {
    background-color: var(--dark-gray);
    color: var(--light-gray);
    border: 1px solid var(--light-gray);
    padding: 12px 15px;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    margin-left: 5px;
}

.clear-search:hover {
    background-color: var(--light-gray);
    color: var(--white);
}

.view-all-link {
    background-color: var(--medium-gray);
    color: var(--white);
    border: 1px solid var(--light-gray);
    padding: 12px 15px;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    margin-left: 10px;
    transition: var(--transition);
}

.view-all-link:hover {
    background-color: var(--light-gray);
    color: var(--primary-red);
}

.search-bar input {
    flex: 1;
    padding: 12px 20px;
    background-color: var(--dark-gray);
    border: 1px solid var(--light-gray);
    border-right: none;
    border-radius: 4px 0 0 4px;
    color: var(--white);
    font-size: 1rem;
}

.search-bar input:focus {
    outline: none;
    border-color: var(--primary-red);
}

.search-bar button {
    background-color: var(--primary-red);
    color: var(--white);
    border: none;
    padding: 12px 25px;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    font-size: 1.2rem;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 50px;
}

.search-bar button:hover {
    background-color: var(--dark-red);
}

/* Search Results */
.search-results {
    color: var(--primary-red);
    font-weight: 500;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.no-results, .no-books {
    text-align: center;
    padding: 60px 20px;
    color: var(--light-gray);
}

.no-results i, .no-books i {
    font-size: 4rem;
    margin-bottom: 20px;
    display: block;
}

.no-results h3, .no-books h3 {
    color: var(--white);
    margin-bottom: 10px;
}

.no-results a {
    color: var(--primary-red);
    text-decoration: none;
}

.no-results a:hover {
    text-decoration: underline;
}

/* File Upload */
.file-upload-area {
    border: 2px dashed var(--light-gray);
    border-radius: 8px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background-color: var(--dark-gray);
}

.file-upload-area:hover {
    border-color: var(--primary-red);
    background-color: rgba(231, 76, 60, 0.05);
}

.file-upload-area i {
    color: var(--primary-red);
    margin-bottom: 15px;
}

.file-upload-area p {
    margin-bottom: 10px;
    color: var(--white);
}

#fileName {
    display: block;
    margin-top: 10px;
    color: var(--primary-red);
    font-weight: bold;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-state i {
    color: var(--light-gray);
    margin-bottom: 20px;
}

.empty-state h3 {
    color: var(--white);
    margin-bottom: 10px;
}

/* Alert Messages */
.alert {
    padding: 15px 20px;
    border-radius: 4px;
    margin-bottom: 20px;
    border-left: 4px solid;
}

.alert-success {
    background-color: rgba(39, 174, 96, 0.1);
    border-color: var(--success-green);
    color: #27AE60;
}

.alert-danger {
    background-color: rgba(231, 76, 60, 0.1);
    border-color: var(--primary-red);
    color: var(--primary-red);
}

.alert-info {
    background-color: rgba(52, 152, 219, 0.1);
    border-color: var(--info-blue);
    color: var(--info-blue);
}

.alert-warning {
    background-color: rgba(243, 156, 18, 0.1);
    border-color: var(--warning-orange);
    color: var(--warning-orange);
}

/* Footer */
.footer {
    background-color: var(--primary-black);
    color: var(--white);
    padding: 40px 0 20px;
    margin-top: 60px;
    border-top: 3px solid var(--primary-red);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
    padding: 0 20px;
}

.footer-section h3 {
    color: var(--white);
    margin-bottom: 20px;
    font-size: 1.2rem;
}

.footer-section h3 i {
    color: var(--primary-red);
    margin-right: 10px;
}

.footer-section a {
    display: block;
    color: #CCCCCC;
    margin-bottom: 10px;
    transition: var(--transition);
}

.footer-section a:hover {
    color: var(--primary-red);
    text-decoration: none;
    padding-left: 5px;
}

.footer-section p {
    color: #999;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.footer-section p i {
    color: var(--primary-red);
    width: 20px;
}

.footer-bottom {
    text-align: center;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--light-gray);
    color: #999;
    font-size: 0.9rem;
}

.sally-credit {
    margin-top: 10px;
    color: var(--white);
}

.sally-credit a {
    color: var(--primary-red);
    font-weight: bold;
}

/* Responsive Design */
@media (max-width: 768px) {
    html {
        font-size: 13px;
    }
    
    .nav-container {
        flex-direction: column;
        gap: 15px;
    }
    
    .nav-brand {
        text-align: center;
    }
    
    .nav-menu {
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }
    
    .nav-menu a,
    .nav-menu .dropdown {
        padding: 8px 12px;
        font-size: 0.9rem;
    }
    
    .dropbtn {
        padding: 8px 12px;
        font-size: 0.9rem;
    }
    
    .dropdown-content {
        min-width: 200px;
    }
    
    .hero-content h1 {
        font-size: 1.8rem;
    }
    
    .hero-content p {
        font-size: 0.95rem;
    }
    
    .hero-buttons {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .hero-buttons .btn {
        width: 100%;
        min-height: 44px;
        font-size: 1rem;
    }
    
    .dashboard-stats {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .stat-card {
        padding: 15px;
    }
    
    .books-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .book-card {
        padding: 15px;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .feature-card {
        padding: 20px;
    }
    
    .actions-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .action-card {
        padding: 15px;
        min-height: 120px;
    }
    
    .action-card i {
        font-size: 2rem;
    }
    
    .action-card h3 {
        font-size: 1rem;
    }
    
    .action-card p {
        font-size: 0.8rem;
    }
    
    .admin-table {
        display: block;
        overflow-x: auto;
    }
    
    .admin-table table {
        width: 100%;
    }
    
    /* Form responsiveness */
    form {
        display: flex;
        flex-direction: column;
    }
    
    input, textarea, select {
        width: 100%;
        max-width: 100%;
        padding: 12px;
        font-size: 1rem;
        min-height: 44px;
    }
    
    label {
        margin-bottom: 8px;
        font-size: 0.95rem;
    }
    
    /* Create Teacher Form - Stack on mobile */
    .create-teacher-form {
        display: flex !important;
        flex-direction: column !important;
        gap: 15px !important;
    }
    
    .create-teacher-form > .btn {
        grid-column: auto !important;
        width: 100%;
    }
    
    /* Video responsiveness */
    .video-container {
        position: relative;
        padding-bottom: 56.25%;
        height: 0;
        overflow: hidden;
        max-width: 100%;
        background: #000;
    }
    
    .video-container iframe {
        position: absolute;
        top: 0;
        left: 0;
        width: 100% !important;
        height: 100% !important;
        max-width: 100% !important;
        max-height: 100% !important;
    }
    
    .responsive-video {
        width: 100%;
        height: auto;
        max-width: 100%;
    }
    
    /* Buttons - ensure touch-friendly */
    .btn {
        min-height: 44px;
        padding: 10px 16px;
        font-size: 0.95rem;
        border-radius: 6px;
    }
    
    .btn-small {
        min-height: 38px;
        padding: 8px 12px;
    }
    
    /* Dropdowns - mobile bottom sheet */
    .dropdown-content {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        top: auto;
        width: 100%;
        max-width: 100%;
        max-height: 70vh;
        overflow-y: auto;
        z-index: 2000;
        border-radius: 12px 12px 0 0;
        padding: 12px 10px 18px 10px;
        background-color: var(--primary-black);
        box-shadow: 0 -8px 24px rgba(0,0,0,0.5);
    }

    .dropdown-close {
        display: block;
        margin: 0 0 10px auto;
        background: transparent;
        border: none;
        color: var(--light-gray);
        font-size: 1.6rem;
        padding: 8px 12px;
        border-radius: 6px;
        cursor: pointer;
    }

    .dropdown-close:focus {
        outline: none;
        box-shadow: 0 0 0 3px rgba(231,76,60,0.12);
    }

    .dropdown-content a {
        display: block;
        padding: 12px 10px;
        border-radius: 8px;
        margin-bottom: 6px;
        background: transparent;
    }

    .dropdown-content a:hover {
        background-color: rgba(231,76,60,0.08);
    }
    
    /* Auth cards */
    .auth-card {
        padding: 20px;
        width: 100%;
        max-width: 100%;
    }
    
    .section-header {
        padding: 15px 0;
        text-align: center;
    }
    
    .section-header h1 {
        font-size: 1.5rem;
    }
    
    .section-header p {
        font-size: 0.9rem;
    }
    
    /* Book actions */
    .book-actions {
        flex-direction: column;
        gap: 8px;
    }
    
    /* Message input area */
    .message-input-area {
        flex-direction: column;
    }
    
    .message-input-area input {
        width: 100%;
    }
    
    .message-input-area button {
        width: 100%;
        margin-top: 10px;
    }
}

@media (max-width: 480px) {
    html {
        font-size: 12px;
    }
    
    .container {
        padding: 10px;
    }
    
    .navbar {
        padding: 10px 0;
    }
    
    .nav-brand a {
        font-size: 1rem;
    }
    
    .nav-menu a,
    .nav-menu .dropdown {
        padding: 6px 10px;
        font-size: 0.8rem;
    }
    
    .user-welcome {
        display: none;
    }
    
    .logout-btn {
        padding: 6px 10px;
        font-size: 0.8rem;
    }
    
    .auth-card {
        padding: 15px;
        border-radius: 8px;
    }
    
    .auth-title {
        font-size: 1.3rem;
        margin-bottom: 15px;
    }
    
    .hero {
        padding: 30px 15px;
    }
    
    .hero-content h1 {
        font-size: 1.4rem;
    }
    
    .hero-content p {
        font-size: 0.85rem;
    }
    
    .dashboard-stats {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .stat-card {
        padding: 12px;
        border-radius: 6px;
    }
    
    .stat-icon {
        font-size: 1.8rem;
    }
    
    .stat-info h3 {
        font-size: 0.95rem;
    }
    
    .stat-info p {
        font-size: 1.2rem;
    }
    
    .books-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .book-card {
        padding: 12px;
        border-radius: 6px;
    }
    
    .book-icon {
        font-size: 2rem;
    }
    
    .action-card {
        padding: 12px;
        min-height: 100px;
    }
    
    .action-card i {
        font-size: 1.8rem;
        margin-bottom: 8px;
    }
    
    .action-card h3 {
        font-size: 0.9rem;
        margin-bottom: 5px;
    }
    
    .action-card p {
        font-size: 0.75rem;
    }
    
    .btn {
        min-height: 42px;
        padding: 10px 14px;
        font-size: 0.9rem;
        border-radius: 5px;
    }
    
    .btn-block {
        width: 100%;
    }
    
    input[type="text"],
    input[type="password"],
    input[type="email"],
    input[type="number"],
    input[type="date"],
    textarea,
    select {
        padding: 10px;
        font-size: 1rem;
        min-height: 42px;
        width: 100%;
    }
    
    input:focus,
    textarea:focus,
    select:focus {
        font-size: 1rem;
    }
    
    /* Prevent zoom on focus on iOS */
    input[type="text"],
    input[type="email"],
    textarea {
        font-size: 16px;
    }
    
    label {
        font-size: 0.9rem;
        margin-bottom: 6px;
    }
    
    .form-group {
        margin-bottom: 12px;
    }
    
    .form-card {
        padding: 15px;
    }
    
    .create-teacher-form {
        display: flex !important;
        flex-direction: column !important;
    }
    
    /* Tables */
    .admin-table {
        font-size: 0.85rem;
    }
    
    .admin-table th,
    .admin-table td {
        padding: 8px;
    }
    
    /* Teacher cards */
    .teacher-card {
        padding: 12px;
    }
    
    .teacher-info {
        margin-bottom: 10px;
    }
    
    .teacher-actions {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }
    
    .teacher-actions .btn {
        width: 100%;
        font-size: 0.8rem;
        padding: 8px;
    }
    
    /* Footer */
    .footer {
        padding: 20px 15px;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .footer-section {
        text-align: center;
    }
    
    .footer-section h3 {
        font-size: 1rem;
    }
    
    .footer-section p,
    .footer-section a {
        font-size: 0.85rem;
    }
    
    /* Modals - full screen on mobile */
    .modal {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 2000;
    }
    
    .modal > div {
        width: 95%;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    /* Search input - larger for touch */
    .search-bar input {
        padding: 12px;
        font-size: 1rem;
        min-height: 44px;
    }
    
    .search-bar button {
        min-height: 44px;
        padding: 10px 12px;
    }
    
    /* Dropdown menu - better mobile UX */
    .dropdown-content {
        min-width: 160px;
        right: 0;
        left: auto;
    }
}

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

.hero-content, .feature-card, .book-card {
    animation: fadeIn 0.6s ease-out;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--dark-gray);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-red);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--dark-red);
}

/* Light theme */
[data-theme="light"] {
    --primary-black: #FAFBFC;
    --secondary-black: #F1F3F4;
    --dark-gray: #E8EAED;
    --medium-gray: #DADCE0;
    --light-gray: #BDC1C6;
    --white: #202124;
    --off-white: #5F6368;
    --pure-white: #FFFFFF;
    --primary-red: #1A73E8;
    --dark-red: #1557B0;
    --light-red: #E8F0FE;
    --success-green: #34A853;
    --warning-orange: #F9AB00;
    --info-blue: #4285F4;
    --shadow: rgba(0, 0, 0, 0.1);
}

/* Light theme specific overrides */
[data-theme="light"] .navbar {
    background-color: #FFFFFF;
    border-bottom: 2px solid #E8EAED;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .nav-menu a {
    color: #202124;
}

[data-theme="light"] .nav-menu a:hover {
    background-color: #E8F0FE;
    color: #1A73E8;
}

[data-theme="light"] .dropdown-content {
    background-color: #FFFFFF;
    border: 1px solid #E8EAED;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .dropdown-content a {
    color: #202124;
}

[data-theme="light"] .dropdown-content a:hover {
    background-color: #E8F0FE;
    color: #1A73E8;
}

[data-theme="light"] .btn-secondary:hover {
    background-color: #E8F0FE;
    color: #1A73E8;
}

[data-theme="light"] .card,
[data-theme="light"] .admin-section,
[data-theme="light"] .settings-section {
    background-color: #FFFFFF;
    border: 1px solid #E8EAED;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .footer {
    background-color: #F1F3F4;
    border-top: 1px solid #E8EAED;
}

[data-theme="light"] body {
    background-color: #FAFBFC;
}

[data-theme="light"] .container {
    background-color: #FAFBFC;
}

[data-theme="light"] .stat-card {
    background: linear-gradient(135deg, #FFFFFF 0%, #F8F9FA 100%);
    border: 1px solid #E8EAED;
}

[data-theme="light"] .action-card {
    background: linear-gradient(135deg, #FFFFFF 0%, #F8F9FA 100%);
    border: 1px solid #E8EAED;
    transition: all 0.3s ease;
}

[data-theme="light"] .action-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: #1A73E8;
}

[data-theme="light"] .book-card {
    background: linear-gradient(135deg, #FFFFFF 0%, #F8F9FA 100%);
    border: 1px solid #E8EAED;
    transition: all 0.3s ease;
}

[data-theme="light"] .book-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .admin-table {
    background-color: #FFFFFF;
    border: 1px solid #E8EAED;
}

[data-theme="light"] .admin-table th {
    background-color: #F8F9FA;
    color: #202124;
    border-bottom: 2px solid #E8EAED;
}

[data-theme="light"] .admin-table td {
    border-bottom: 1px solid #E8EAED;
}

[data-theme="light"] .admin-table tr:hover {
    background-color: #F8F9FA;
}

[data-theme="light"] input[type="text"],
[data-theme="light"] input[type="password"],
[data-theme="light"] input[type="email"],
[data-theme="light"] textarea,
[data-theme="light"] select {
    background-color: #FFFFFF;
    border: 1px solid #E8EAED;
    color: #202124;
}

[data-theme="light"] input[type="text"]:focus,
[data-theme="light"] input[type="password"]:focus,
[data-theme="light"] input[type="email"]:focus,
[data-theme="light"] textarea:focus,
[data-theme="light"] select:focus {
    border-color: #1A73E8;
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.1);
}

/* Quick Actions and Dropdown Styles */
.quick-actions {
    margin-top: 40px;
}

.section-title {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: var(--white);
    display: flex;
    align-items: center;
    gap: 10px;
}

.actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.action-card {
    background: linear-gradient(135deg, var(--dark-gray) 0%, var(--secondary-black) 100%);
    border: 1px solid var(--light-gray);
    border-radius: 8px;
    padding: 20px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    text-decoration: none;
    color: var(--white);
    position: relative;
}

.action-card:hover {
    background: linear-gradient(135deg, var(--light-gray) 0%, var(--dark-gray) 100%);
    border-color: var(--primary-red);
    transform: translateY(-4px);
    box-shadow: 0 8px 16px var(--shadow);
}

.action-card i {
    font-size: 2.5rem;
    color: var(--primary-red);
    margin-bottom: 10px;
}

.action-card h3 {
    font-size: 1.1rem;
    margin-bottom: 8px;
    color: var(--white);
}

.action-card p {
    font-size: 0.85rem;
    color: var(--light-gray);
    margin: 0;
}

/* More Dropdown Styles */
.more-dropdown {
    position: relative;
}

.more-dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
    background: var(--secondary-black);
    border: 1px solid var(--light-gray);
    border-radius: 8px;
    margin-top: 10px;
    z-index: 1000;
    min-width: 250px;
    box-shadow: 0 8px 24px var(--shadow);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.dropdown-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 12px 15px;
    color: var(--white);
    text-decoration: none;
    transition: var(--transition);
    border-bottom: 1px solid var(--dark-gray);
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover {
    background-color: var(--dark-gray);
    padding-left: 20px;
}

.dropdown-item i {
    color: var(--primary-red);
    margin-right: 8px;
    font-size: 0.9rem;
    margin-bottom: 0;
}

.dropdown-item small {
    color: var(--light-gray);
    font-size: 0.75rem;
    margin-top: 4px;
    display: block;
}

/* Light Theme Dropdown */
[data-theme="light"] .action-card {
    background: linear-gradient(135deg, #FFFFFF 0%, #F8F9FA 100%);
    border: 1px solid #E8EAED;
    color: #202124;
}

[data-theme="light"] .action-card:hover {
    background: linear-gradient(135deg, #F8F9FA 0%, #FFFFFF 100%);
    border-color: #1A73E8;
}

[data-theme="light"] .action-card h3 {
    color: #202124;
}

[data-theme="light"] .action-card p {
    color: #5F6368;
}

[data-theme="light"] .dropdown-menu {
    background: #FFFFFF;
    border: 1px solid #E8EAED;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .dropdown-item {
    color: #202124;
    border-bottom-color: #E8EAED;
}

[data-theme="light"] .dropdown-item:hover {
    background-color: #F8F9FA;
}

[data-theme="light"] .dropdown-item small {
    color: #5F6368;
}

/* Create Teacher Form */
.create-teacher-section {
    margin-bottom: 40px;
}

.form-card {
    background: linear-gradient(135deg, var(--dark-gray) 0%, var(--secondary-black) 100%);
    border: 1px solid var(--light-gray);
    border-radius: 8px;
    padding: 30px;
    margin-top: 20px;
}

.create-teacher-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    color: var(--white);
    margin-bottom: 8px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-group label i {
    color: var(--primary-red);
}

.form-group input {
    padding: 10px 12px;
    border: 1px solid var(--light-gray);
    border-radius: 4px;
    background-color: var(--secondary-black);
    color: var(--white);
    font-size: 0.95rem;
    transition: var(--transition);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-red);
    box-shadow: 0 0 8px rgba(231, 76, 60, 0.3);
}

.create-teacher-form > .btn {
    grid-column: 1 / -1;
    align-self: flex-end;
    width: fit-content;
}

/* Light Theme Form */
[data-theme="light"] .form-card {
    background: linear-gradient(135deg, #FFFFFF 0%, #F8F9FA 100%);
    border: 1px solid #E8EAED;
}

[data-theme="light"] .form-group label {
    color: #202124;
}

[data-theme="light"] .form-group input {
    background-color: #FFFFFF;
    border-color: #E8EAED;
    color: #202124;
}

[data-theme="light"] .form-group input:focus {
    border-color: #1A73E8;
    box-shadow: 0 0 8px rgba(26, 115, 232, 0.2);
}