/* =========================
   Reset and Base Styles
   ========================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f4f4f4;
}

/* Container */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* =========================
   Header / Navbar
   ========================= */
.header {
    background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%);
    color: white;
    padding: 0;
    box-shadow: 0 2px 15px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    padding: 1rem 0;
    position: relative; /* anchors the dropdown menu */
}

.logo {
    font-size: 1.8rem;
    font-weight: bold;
    color: white;
    text-decoration: none;
    display: flex;
    align-items: center;
}

.logo i {
    margin-right: 0.5rem;
    color: #e74c3c;
}

/* =========================
   Search (Desktop)
   ========================= */
.nav-search {
    flex: 0 1 300px;
    margin: 0 2rem;
}

.search-form {
    display: flex;
    background: white;
    border-radius: 25px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.search-input {
    flex: 1;
    border: none;
    padding: 0.8rem 1.2rem;
    font-size: 0.9rem;
    outline: none;
    background: transparent;
}

.search-btn {
    background: #3498db;
    border: none;
    padding: 0.8rem 1.2rem;
    color: white;
    cursor: pointer;
    transition: background 0.3s;
}

.search-btn:hover {
    background: #2980b9;
}

/* Ensure the search button always shows its glyph nicely */
.search-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  line-height:1;
  border-radius:25px; /* matches your rounded search form */
}
.search-btn svg { display:block; }


/* =========================
   Nav Menu (Desktop)
   ========================= */
.nav-menu {
    display: flex;
    list-style: none;
    flex-wrap: wrap;
    align-items: center;
    margin: 0;
    padding: 0;
}

.nav-menu li {
    margin: 0;
    position: relative;
}

.nav-menu a {
    color: white;
    text-decoration: none;
    padding: 0.8rem 1rem;
    display: flex;
    align-items: center;
    transition: all 0.3s;
    border-radius: 5px;
    margin: 0 0.2rem;
    font-weight: 500;
}

.nav-menu a i {
    margin-right: 0.5rem;
    width: 16px;
    text-align: center;
}

.nav-menu a:hover {
    background: rgba(255,255,255,0.1);
    transform: translateY(-2px);
}

.logout-btn {
    background: #e74c3c;
    margin-left: 0.5rem;
}

.logout-btn:hover {
    background: #c0392b;
    transform: translateY(-2px);
}

/* =========================
   Mobile Search (hidden desktop)
   ========================= */
.nav-search-mobile {
    display: none;
}

/* =========================
   Hamburger Button
   ========================= */
.menu-toggle {
    display: none;              /* shown on mobile */
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 5px;
    transition: background 0.3s;
    line-height: 1;
}

.menu-toggle:hover {
    background: rgba(255,255,255,0.1);
}

/* keep FA icon visible */
.menu-toggle .fa-solid { color: #fff; }

/* visual state when expanded */
#menuToggle[aria-expanded="true"] {
    background: rgba(255,255,255,0.12);
}

/* =========================
   Hero
   ========================= */
.hero {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 4rem 0;
    text-align: center;
}

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

.hero p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
}

.btn {
    display: inline-block;
    background: #e74c3c;
    color: white;
    padding: 0.8rem 1.5rem;
    text-decoration: none;
    border-radius: 5px;
    transition: background 0.3s;
}

.btn:hover {
    background: #c0392b;
}

/* =========================
   Layout / Cards
   ========================= */
.main-content { padding: 3rem 0; }

.grid {
    display: grid;
    gap: 2rem;
    grid-template-columns: 1fr;
}

.card {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: transform 0.3s;
}

.card:hover { transform: translateY(-5px); }

/* =========================
   Users Table
   ========================= */
.users-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.users-table th,
.users-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.users-table th {
    background: #34495e;
    color: white;
}

.users-table tr:hover { background: #f8f9fa; }

/* =========================
   Footer
   ========================= */
.footer {
    background: #2c3e50;
    color: white;
    text-align: center;
    padding: 2rem 0;
    margin-top: 3rem;
}

/* =========================
   Transitions & Scrollbar
   ========================= */
.nav-menu, .nav-menu a, .search-form, .menu-toggle {
    transition: all 0.3s ease;
}

.nav-menu::-webkit-scrollbar { width: 6px; }
.nav-menu::-webkit-scrollbar-track { background: rgba(255,255,255,0.1); }
.nav-menu::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.3); border-radius: 3px; }
.nav-menu::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.5); }

/* =========================
   Responsive
   ========================= */

/* Medium screens */
@media (max-width: 1200px) {
    .nav-search {
        flex: 0 1 250px;
        margin: 0 1rem;
    }
}

@media (max-width: 992px) {
    .navbar { padding: 0.8rem 0; }

    .nav-search {
        flex: 0 1 200px;
        margin: 0 0.5rem;
    }

    .nav-menu a {
        padding: 0.6rem 0.8rem;
        font-size: 0.9rem;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .menu-toggle { display: block; }

    /* Hide desktop search; show mobile search inside dropdown */
    .nav-search { display: none; }
    .nav-search-mobile {
        display: block;
        width: 100%;
        padding: 1rem;
        border-bottom: 1px solid rgba(255,255,255,0.1);
    }
    .nav-search-mobile .search-form { width: 100%; }

    /* Mobile dropdown menu */
    .nav-menu {
        display: none;                 /* hidden by default */
        width: 100%;
        flex-direction: column;
        background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%);
        position: absolute;
        top: 100%;
        left: 0;
        box-shadow: 0 5px 15px rgba(0,0,0,0.2);
        max-height: 80vh;
        overflow-y: auto;
    }

    /* JS toggles .open on #navMenu */
    .nav-menu.open {
        display: flex;
    }

    /* (Optional backward compat if something toggles 'active') */
    .nav-menu.active {
        display: flex;
    }

    .nav-menu li {
        width: 100%;
        margin: 0;
    }

    .nav-menu a {
        padding: 1rem 1.5rem;
        margin: 0;
        border-radius: 0;
        border-bottom: 1px solid rgba(255,255,255,0.1);
        justify-content: flex-start;
    }

    .nav-menu a i { width: 20px; }

    .logout-btn {
        margin: 0;
        background: transparent;
        border-top: 2px solid rgba(255,255,255,0.2);
    }

    .logout-btn:hover { background: #e74c3c; }

    /* Other components on small screens */
    .hero h1 { font-size: 2rem; }
    .hero p { font-size: 1rem; }
    .users-table { display: block; overflow-x: auto; }
}

/* Force desktop menu visible above 769px */
@media (min-width: 769px) {
    .grid { grid-template-columns: repeat(3, 1fr); }
    .nav-menu { display: flex !important; }
}

/* Larger desktops */
@media (min-width: 1024px) {
    .container { padding: 0 2rem; }
    .hero { padding: 6rem 0; }
    .hero h1 { font-size: 3rem; }
}

/* =========================
   Vocabulary Page Styles
   ========================= */
.session-stats {
    background: white;
    padding: 1rem;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    text-align: center;
}

.stat-item {
    padding: 0.5rem;
    border-radius: 5px;
    background: #f8f9fa;
}

.stat-label {
    display: block;
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 0.25rem;
}

.stat-value {
    display: block;
    font-size: 1.2rem;
    font-weight: bold;
}

.stat-value.success { color: #28a745; }
.stat-value.failure { color: #dc3545; }
.stat-value.positive { color: #28a745; }
.stat-value.negative { color: #dc3545; }
.stat-value.ratio { color: #ffc107; }

/* Word Container */
.word-container { max-width: 800px; margin: 0 auto; }

.word-card {
    background: white;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    overflow: hidden;
    margin-bottom: 2rem;
}

.word-display {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 3rem 2rem;
    text-align: center;
    color: white;
}

.word-text {
    font-size: 4rem;
    font-weight: bold;
    margin: 0;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    word-break: break-word;
}

/* Controls Section */
.controls-section {
    padding: 2rem;
    border-bottom: 1px solid #eee;
}

.priority-form { margin-bottom: 1.5rem; }

.priority-control {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.priority-label { font-weight: bold; color: #333; }

.priority-input {
    width: 80px;
    padding: 0.5rem;
    border: 2px solid #e9ecef;
    border-radius: 5px;
    text-align: center;
    font-size: 1.1rem;
    font-weight: bold;
}

.priority-input:focus {
    border-color: #3498db;
    outline: none;
}

.action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.btn-correct, .btn-incorrect {
    padding: 1rem 2rem;
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-correct {
    background: #28a745;
    color: white;
}
.btn-correct:hover {
    background: #218838;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(40, 167, 69, 0.3);
}

.btn-incorrect {
    background: #dc3545;
    color: white;
}
.btn-incorrect:hover {
    background: #c82333;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(220, 53, 69, 0.3);
}

.additional-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-details, .btn-external, .btn-edit {
    padding: 0.7rem 1.2rem;
    border: 2px solid #3498db;
    border-radius: 5px;
    background: white;
    color: #3498db;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-details:hover, .btn-external:hover, .btn-edit:hover {
    background: #3498db;
    color: white;
    transform: translateY(-1px);
}

.audio-player { margin-top: 1.5rem; }

/* Word Stats */
.word-stats {
    padding: 1.5rem 2rem;
    background: #f8f9fa;
}

.stats-grid.compact {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.stats-grid.compact .stat-item {
    background: white;
    padding: 0.8rem;
}

/* Details Section */
.details-section {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-top: 1rem;
    overflow: hidden;
}

.details-content { padding: 2rem; }

.definition-section, .picto-section { margin-bottom: 1.5rem; }

.definition-section h3, .picto-section h3 {
    color: #2c3e50;
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.definition-text {
    font-size: 1.1rem;
    line-height: 1.6;
    color: #555;
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 5px;
    border-left: 4px solid #3498db;
}

.picto-image {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Search Messages */
.search-message {
    background: white;
    padding: 1rem 1.5rem;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 1.5rem;
    border-left: 4px solid #3498db;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.search-success {
    color: #155724;
    background: #d4edda;
    padding: 0.8rem 1.2rem;
    border-radius: 5px;
    border-left: 4px solid #28a745;
}

.search-warning {
    color: #856404;
    background: #fff3cd;
    padding: 0.8rem 1.2rem;
    border-radius: 5px;
    border-left: 4px solid #ffc107;
}

.clear-search {
    color: #6c757d;
    text-decoration: none;
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    border: 1px solid #dee2e6;
    border-radius: 5px;
    transition: all 0.3s ease;
}

.clear-search:hover {
    background: #f8f9fa;
    color: #495057;
    text-decoration: none;
}

.btn-random {
    padding: 0.7rem 1.2rem;
    border: 2px solid #6f42c1;
    border-radius: 5px;
    background: white;
    color: #6f42c1;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-random:hover {
    background: #6f42c1;
    color: white;
    transform: translateY(-1px);
}

/* =========================
   Vocabulary Responsive
   ========================= */
@media (max-width: 768px) {
    .word-text { font-size: 3rem; }
    .action-buttons { grid-template-columns: 1fr; }
    .priority-control { flex-direction: column; gap: 0.5rem; }
    .additional-controls { flex-direction: column; align-items: center; }
    .btn-details, .btn-external, .btn-edit { width: 100%; justify-content: center; }
    .stats-grid.compact { grid-template-columns: 1fr; }
    .search-message { flex-direction: column; align-items: flex-start; gap: 0.8rem; }
    .clear-search { align-self: flex-end; }
}

@media (max-width: 480px) {
    .logo { font-size: 1.5rem; }
    .navbar { padding: 0.6rem 0; }
    .nav-menu a { padding: 0.8rem 1.2rem; font-size: 0.85rem; }
    .word-text { font-size: 2.5rem; }
    .controls-section { padding: 1rem; }
    .btn-correct, .btn-incorrect { padding: 0.8rem 1rem; font-size: 1rem; }
}

/* =========================
   Dynamic Ratio Colors
   ========================= */
.stat-value.ratio.low {
    color: #dc3545 !important;
    background: #f8d7da;
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
    font-weight: bold;
}
.stat-value.ratio.medium {
    color: #fd7e14 !important;
    background: #fff3cd;
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
    font-weight: bold;
}
.stat-value.ratio.high {
    color: #28a745 !important;
    background: #d4edda;
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
    font-weight: bold;
}
.stats-grid.compact .stat-item .stat-value.ratio {
    display: inline-block;
    min-width: 60px;
}

.menu-toggle .icon-bars {
  display: block;
  width: 1.25em;
  height: 1.25em;
  fill: currentColor;
}
