/* ========================================
   MOBILE RESPONSIVE STYLES
   For index.html and admin.html
   ======================================== */

/* Tablet and below (768px) */
@media (max-width: 768px) {
    /* General Container */
    .container {
        padding: 0 16px !important;
        max-width: 100% !important;
    }

    /* ===== NAVIGATION ===== */
    .nav {
        padding: 12px 0 !important;
        gap: 12px !important;
    }

    /* Hide the full text on mobile */
    .nav-logo {
        font-size: 0 !important;
    }

    /* Show only the AI badge */
    .nav-logo .logo-badge {
        font-size: 20px !important;
        margin-right: 0 !important;
    }

    /* Hide navigation links on mobile */
    .nav-links {
        display: none !important;
    }

    /* Make nav buttons smaller and cleaner */
    .nav-buttons {
        display: flex;
        gap: 6px !important;
        margin-left: auto;
    }

    .nav-buttons .btn,
    .nav-buttons .nav-cta {
        padding: 8px 12px !important;
        font-size: 13px !important;
        white-space: nowrap;
    }

    /* ===== HERO SECTION ===== */
    .hero {
        padding: 40px 0 30px !important;
    }

    /* Reorder hero elements on mobile */
    .hero-content {
        display: flex !important;
        flex-direction: column !important;
    }

    /* Hero meta (title, subtitle, description) comes first */
    .hero-meta {
        order: 1 !important;
        text-align: center !important;
        margin-bottom: 24px !important;
    }

    /* Hero card (image/visual) comes second */
    .hero-card,
    .hero-image {
        order: 2 !important;
        margin-bottom: 24px !important;
    }

    /* Hero buttons come last */
    .hero-buttons {
        order: 3 !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 12px !important;
        width: 100% !important;
    }

    .hero-buttons .btn {
        width: 100% !important;
        justify-content: center !important;
        padding: 14px 20px !important;
        font-size: 15px !important;
    }

    /* Hero text sizing */
    .hero-content h1,
    .hero h1,
    h1.hero-title {
        font-size: 56px !important;
        line-height: 1.2 !important;
        margin-bottom: 12px !important;
    }

    .hero-content .subtitle,
    .hero .subtitle {
        font-size: 15px !important;
        margin-bottom: 12px !important;
    }

    .hero-content p,
    .hero p {
        font-size: 14px !important;
        line-height: 1.6 !important;
    }

    /* Hero image/card */
    .hero-image img,
    .hero-card img {
        max-width: 100% !important;
        height: auto !important;
        border-radius: 12px !important;
    }

    /* ===== STATS SECTION ===== */
    .stats-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
        padding: 0 !important;
    }

    .stat-card {
        padding: 16px !important;
        text-align: center !important;
    }

    .stat-number {
        font-size: 28px !important;
        margin-bottom: 4px !important;
    }

    .stat-label {
        font-size: 13px !important;
    }

    /* ===== FEATURES SECTION ===== */
    .features-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }

    .feature-card {
        padding: 20px !important;
        text-align: center !important;
    }

    .feature-icon {
        font-size: 36px !important;
        margin-bottom: 12px !important;
    }

    .feature-card h3 {
        font-size: 18px !important;
        margin-bottom: 8px !important;
    }

    .feature-card p {
        font-size: 14px !important;
        line-height: 1.5 !important;
    }

    /* ===== LESSONS GRID ===== */
    .lessons-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }

    .lesson-card {
        padding: 16px !important;
    }

    .lesson-number {
        font-size: 12px !important;
        padding: 4px 10px !important;
    }

    .lesson-card h3 {
        font-size: 17px !important;
        margin: 12px 0 8px !important;
    }

    .lesson-card p {
        font-size: 13px !important;
        line-height: 1.5 !important;
    }

    .lesson-card .btn {
        padding: 10px 16px !important;
        font-size: 14px !important;
        width: 100% !important;
        margin-top: 12px !important;
    }

    /* ===== CTA SECTION ===== */
    .cta-section {
        padding: 40px 0 !important;
    }

    .cta-content {
        text-align: center !important;
        padding: 24px !important;
    }

    .cta-content h2 {
        font-size: 24px !important;
        margin-bottom: 12px !important;
    }

    .cta-content p {
        font-size: 15px !important;
        margin-bottom: 20px !important;
    }

    .cta-content .btn {
        width: 100% !important;
        padding: 14px 20px !important;
        font-size: 15px !important;
    }

    /* ===== FOOTER ===== */
    .footer-content {
        grid-template-columns: 1fr !important;
        gap: 24px !important;
        text-align: center !important;
    }

    .footer-section {
        align-items: center !important;
    }

    .footer-section h3 {
        font-size: 16px !important;
        margin-bottom: 12px !important;
    }

    .footer-links {
        flex-direction: column !important;
        gap: 8px !important;
    }

    .footer-links a {
        font-size: 14px !important;
    }

    .footer-bottom {
        flex-direction: column !important;
        gap: 12px !important;
        text-align: center !important;
        padding: 16px 0 !important;
    }

    .footer-bottom p {
        font-size: 13px !important;
    }

    /* ===== ADMIN PANEL ===== */
    .admin-container {
        padding: 12px !important;
    }

    .admin-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 12px !important;
        padding: 12px 0 !important;
    }

    .admin-header .logo {
        font-size: 18px !important;
    }

    .admin-header .logo-badge {
        font-size: 16px !important;
        padding: 6px 10px !important;
    }

    .admin-tabs {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        gap: 6px !important;
        width: 100% !important;
        padding-bottom: 8px !important;
        -webkit-overflow-scrolling: touch !important;
    }

    .admin-tab,
    .tab-btn {
        flex: 0 0 auto !important;
        min-width: 100px !important;
        font-size: 13px !important;
        padding: 10px 14px !important;
        white-space: nowrap !important;
    }

    .admin-content,
    .tab-content {
        padding: 16px 12px !important;
    }

    .admin-content h2,
    .tab-content h2 {
        font-size: 20px !important;
        margin-bottom: 16px !important;
    }

    /* Admin Stats Grid */
    .admin-container .stats-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    /* Bulk Actions */
    .bulk-actions {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
        margin-bottom: 16px !important;
    }

    .bulk-actions .btn,
    .bulk-actions button {
        flex: 1 1 calc(50% - 4px) !important;
        min-width: 120px !important;
        padding: 10px 12px !important;
        font-size: 13px !important;
    }

    /* ===== MOBILE-FRIENDLY TABLES ===== */
    
    /* Remove table container overflow */
    .users-table-container {
        overflow: visible !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    /* Hide table headers on mobile */
    .users-table thead {
        display: none !important;
    }

    /* Make table body display as cards */
    .users-table,
    .users-table tbody {
        display: block !important;
        width: 100% !important;
    }

    /* Each table row becomes a card */
    .users-table tr {
        display: block !important;
        margin-bottom: 16px !important;
        padding: 16px !important;
        background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.1)) !important;
        border: 1px solid rgba(78, 205, 196, 0.3) !important;
        border-radius: 12px !important;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3) !important;
        transition: transform 0.2s, box-shadow 0.2s !important;
    }

    .users-table tr:hover {
        transform: translateY(-2px) !important;
        box-shadow: 0 6px 20px rgba(78, 205, 196, 0.2) !important;
    }

    /* Each table cell becomes a row in the card */
    .users-table td {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 10px 0 !important;
        border: none !important;
        border-bottom: 1px solid rgba(78, 205, 196, 0.1) !important;
        font-size: 14px !important;
    }

    .users-table td:last-child {
        border-bottom: none !important;
    }

    /* Add labels before each cell */
    .users-table td::before {
        content: attr(data-label) !important;
        font-weight: 600 !important;
        color: #4ECDC4 !important;
        margin-right: 12px !important;
        min-width: 90px !important;
        font-size: 13px !important;
        text-transform: uppercase !important;
        letter-spacing: 0.5px !important;
    }

    /* Checkbox cell */
    .users-table td:first-child {
        padding: 12px 0 !important;
    }

    .users-table td:first-child input[type="checkbox"] {
        width: 20px !important;
        height: 20px !important;
        cursor: pointer !important;
    }

    /* Role badge in mobile */
    .users-table .role-badge {
        padding: 6px 12px !important;
        border-radius: 20px !important;
        font-size: 12px !important;
        font-weight: 600 !important;
        text-transform: uppercase !important;
    }

    /* Action buttons in cards */
    .users-table td .action-btn,
    .users-table td .btn-icon {
        margin: 4px 0 !important;
        padding: 10px 16px !important;
        font-size: 14px !important;
        border-radius: 8px !important;
        font-weight: 500 !important;
    }

    .users-table td .btn-icon.edit {
        background: rgba(78, 205, 196, 0.2) !important;
        color: #4ECDC4 !important;
        border: 1px solid rgba(78, 205, 196, 0.4) !important;
    }

    .users-table td .btn-icon.delete {
        background: rgba(231, 76, 60, 0.2) !important;
        color: #e74c3c !important;
        border: 1px solid rgba(231, 76, 60, 0.4) !important;
    }

    /* Make action buttons stack vertically */
    .users-table td:last-child {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 8px !important;
        padding-top: 12px !important;
    }

    .users-table td:last-child::before {
        margin-bottom: 8px !important;
        align-self: flex-start !important;
    }

    .users-table td:last-child .action-btn,
    .users-table td:last-child .btn-icon {
        width: 100% !important;
        justify-content: center !important;
        display: flex !important;
        align-items: center !important;
        gap: 6px !important;
    }

    /* Modal */
    .modal-content {
        width: 95% !important;
        max-width: 95% !important;
        margin: 20px auto !important;
        max-height: 90vh;
        overflow-y: auto;
    }

    .modal-header h2 {
        font-size: 20px !important;
    }

    .modal-body {
        padding: 16px !important;
    }

    /* Forms */
    .form-group {
        margin-bottom: 16px !important;
    }

    .form-input,
    .form-select,
    .form-textarea {
        font-size: 16px !important; /* Prevents zoom on iOS */
    }

    /* Buttons */
    .btn {
        padding: 12px 20px !important;
        font-size: 14px !important;
    }

    .btn-group {
        flex-direction: column;
        gap: 8px;
    }

    .btn-group .btn {
        width: 100%;
    }
}

/* ===== MOBILE PHONES (480px and below) ===== */
@media (max-width: 480px) {
    /* Container */
    .container {
        padding: 0 12px !important;
    }

    /* Navigation */
    .nav-buttons .btn,
    .nav-buttons .nav-cta {
        padding: 6px 10px !important;
        font-size: 12px !important;
    }

    /* Hero */
    .hero {
        padding: 30px 0 20px !important;
    }

    .hero-content h1,
    .hero h1,
    h1.hero-title {
        font-size: 46px !important;
        line-height: 1.3 !important;
    }

    .hero-content .subtitle,
    .hero .subtitle {
        font-size: 14px !important;
    }

    .hero-content p,
    .hero p {
        font-size: 13px !important;
    }

    .hero-buttons .btn {
        padding: 12px 16px !important;
        font-size: 14px !important;
    }

    /* Stats */
    .stat-card {
        padding: 14px !important;
    }

    .stat-number {
        font-size: 24px !important;
    }

    .stat-label {
        font-size: 12px !important;
    }

    /* Features */
    .feature-card {
        padding: 16px !important;
    }

    .feature-icon {
        font-size: 32px !important;
    }

    .feature-card h3 {
        font-size: 17px !important;
    }

    .feature-card p {
        font-size: 13px !important;
    }

    /* Lessons */
    .lesson-card {
        padding: 14px !important;
    }

    .lesson-number {
        font-size: 11px !important;
        padding: 4px 8px !important;
    }

    .lesson-card h3 {
        font-size: 16px !important;
    }

    .lesson-card p {
        font-size: 12px !important;
    }

    .lesson-card .btn {
        padding: 10px 14px !important;
        font-size: 13px !important;
    }

    /* CTA */
    .cta-content {
        padding: 20px !important;
    }

    .cta-content h2 {
        font-size: 22px !important;
    }

    .cta-content p {
        font-size: 14px !important;
    }

    /* Admin */
    .admin-container {
        padding: 8px !important;
    }

    .admin-tab,
    .tab-btn {
        min-width: 90px !important;
        font-size: 12px !important;
        padding: 8px 10px !important;
    }

    .bulk-actions .btn,
    .bulk-actions button {
        flex: 1 1 100% !important;
        font-size: 12px !important;
    }

    /* Table Actions */
    .action-btn {
        padding: 6px 8px !important;
        font-size: 11px !important;
    }

    /* Pagination */
    .pagination {
        flex-wrap: wrap !important;
        gap: 4px !important;
    }

    .pagination button {
        padding: 6px 8px !important;
        font-size: 11px !important;
        min-width: 32px !important;
    }

    /* Modal */
    .modal-content {
        padding: 16px !important;
    }

    .modal-header h2 {
        font-size: 18px !important;
    }

    .modal-body {
        padding: 12px !important;
    }
}

/* Landscape mobile (max-height: 500px) */
@media (max-height: 500px) and (orientation: landscape) {
    .hero {
        padding: 40px 0 30px !important;
    }

    .modal-content {
        max-height: 95vh;
    }
}

/* Hamburger Menu for Mobile */
@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: block !important;
        background: none;
        border: none;
        color: #4ECDC4;
        font-size: 24px;
        cursor: pointer;
        padding: 8px;
    }

    .nav-links.mobile-open {
        display: flex !important;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: rgba(5, 8, 17, 0.98);
        border-top: 1px solid rgba(78, 205, 196, 0.15);
        padding: 20px;
        gap: 16px;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    }

    .nav-links.mobile-open a {
        padding: 12px;
        border-radius: 8px;
        transition: background 0.3s;
    }

    .nav-links.mobile-open a:hover {
        background: rgba(78, 205, 196, 0.1);
    }
}

/* Improve touch targets */
@media (hover: none) and (pointer: coarse) {
    .btn,
    .action-btn,
    .admin-tab,
    a {
        min-height: 44px;
        min-width: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}

/* Print styles */
@media print {
    .nav,
    .footer,
    .cta-section,
    .admin-header,
    .admin-tabs,
    .action-btn {
        display: none !important;
    }

    body {
        background: white !important;
        color: black !important;
    }
}
