/* ============================================================
   RehanSchool - Responsive Styles
   Tablet & Mobile Optimizations
   ============================================================ */

/* ============================================================
   Large Tablets / Small Desktops (max-width: 1024px)
   ============================================================ */
@media (max-width: 1024px) {
    .hero .container {
        grid-template-columns: 1fr;
        text-align: center;
    }
    .hero-content p {
        margin: 0 auto 30px;
    }
    .hero-actions {
        justify-content: center;
    }
    .hero-stats {
        justify-content: center;
    }
    .hero-illustration {
        display: none;
    }
    .features-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .categories-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .courses-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    .course-layout {
        grid-template-columns: 1fr;
    }
    .course-detail-header {
        grid-template-columns: 1fr;
    }
    .course-thumbnail-large {
        order: -1;
    }
    .course-thumbnail-large img,
    .course-thumbnail-placeholder-lg {
        max-height: 300px;
    }
    .learning-sidebar {
        width: 280px;
    }
    .learning-main {
        padding: 20px;
    }
    .blog-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .testimonials-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .about-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
    .contact-layout {
        grid-template-columns: 1fr;
    }
    .profile-layout {
        grid-template-columns: 1fr;
    }
    .values-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .team-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================================================
   Tablets (max-width: 768px)
   ============================================================ */
@media (max-width: 768px) {
    h1 { font-size: 2rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }

    .navbar-menu {
        display: none;
        position: absolute;
        top: 70px;
        left: 0;
        right: 0;
        background: var(--bg-primary);
        border-bottom: 1px solid var(--border);
        flex-direction: column;
        padding: 16px;
        box-shadow: var(--shadow-lg);
    }
    .navbar-menu.show {
        display: flex;
    }
    .navbar-toggle {
        display: block;
    }
    .nav-links {
        flex-direction: column;
        width: 100%;
    }
    .nav-links a {
        padding: 12px 16px;
        border-radius: var(--radius);
    }
    .nav-actions {
        width: 100%;
        flex-direction: column;
        padding-top: 12px;
        border-top: 1px solid var(--border);
    }
    .nav-actions .btn {
        width: 100%;
        justify-content: center;
    }
    .nav-user-dropdown {
        width: 100%;
    }
    .btn-user {
        width: 100%;
        justify-content: center;
    }
    .dropdown-menu {
        position: static;
        width: 100%;
        box-shadow: none;
        border: 1px solid var(--border);
        margin-top: 8px;
        opacity: 1;
        visibility: visible;
        transform: none;
        display: none;
    }
    .dropdown-menu.show {
        display: block;
    }

    .hero-content h1 {
        font-size: 2.25rem;
    }
    .hero-stats {
        gap: 24px;
        flex-wrap: wrap;
    }
    .features-grid {
        grid-template-columns: 1fr;
    }
    .categories-grid {
        grid-template-columns: 1fr;
    }
    .courses-grid {
        grid-template-columns: 1fr;
    }
    .search-form {
        flex-direction: column;
    }
    .search-form select {
        min-width: 100%;
    }

    .dashboard-header {
        flex-direction: column;
        text-align: center;
    }
    .dashboard-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    .stat-card {
        flex-direction: column;
        text-align: center;
        padding: 20px;
    }
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .learning-container {
        flex-direction: column;
    }
    .learning-sidebar {
        width: 100%;
        max-height: 300px;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
    .learning-main {
        padding: 16px;
    }
    .lesson-actions {
        flex-direction: column;
    }
    .lesson-actions .btn {
        width: 100%;
    }

    .blog-grid {
        grid-template-columns: 1fr;
    }
    .testimonials-grid {
        grid-template-columns: 1fr;
    }
    .course-layout {
        grid-template-columns: 1fr;
    }

    .leaderboard-podium {
        flex-direction: column;
        align-items: center;
        gap: 16px;
    }
    .podium-item.rank-1 {
        order: 0;
        transform: none;
    }
    .podium-item {
        width: 100%;
        max-width: 300px;
    }
    .leaderboard-table table {
        font-size: 0.8rem;
    }

    .profile-layout {
        grid-template-columns: 1fr;
    }
    .form-row {
        grid-template-columns: 1fr;
    }
    .role-selector {
        flex-direction: column;
    }

    .events-grid {
        grid-template-columns: 1fr;
    }
    .event-card {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .footer-grid {
        grid-template-columns: 1fr;
        text-align: center;
    }
    .footer-col {
        text-align: center;
    }
    .footer-col h4 {
        justify-content: center;
    }
    .social-links {
        justify-content: center;
    }
    .contact-info li {
        justify-content: center;
    }
    .footer-bottom {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }
    .footer-bottom-links {
        justify-content: center;
        flex-wrap: wrap;
    }

    .auth-card {
        padding: 24px;
    }
    .auth-section {
        padding: 20px;
    }

    .chatbot-container {
        width: calc(100vw - 48px);
        height: 480px;
        right: -20px;
    }

    .blog-post-meta {
        flex-wrap: wrap;
        justify-content: center;
    }

    .values-grid {
        grid-template-columns: 1fr;
    }
    .team-grid {
        grid-template-columns: 1fr;
    }
    .quizzes-grid {
        grid-template-columns: 1fr;
    }
    .certificates-grid {
        grid-template-columns: 1fr;
    }
    .my-courses-grid {
        grid-template-columns: 1fr;
    }

    .section-header h2 {
        font-size: 1.75rem;
    }

    .filter-tabs {
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* ============================================================
   Mobile Phones (max-width: 480px)
   ============================================================ */
@media (max-width: 480px) {
    .container {
        padding: 0 14px;
    }

    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.35rem; }

    .hero-content h1 {
        font-size: 1.75rem;
    }
    .hero-content p {
        font-size: 1rem;
    }
    .hero-actions {
        flex-direction: column;
    }
    .hero-actions .btn {
        width: 100%;
    }
    .hero-stats {
        gap: 16px;
    }
    .hero-stats .stat-item {
        flex: 1;
        min-width: 80px;
    }
    .stat-number {
        font-size: 1.25rem;
    }

    .dashboard-stats {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
    .stat-card {
        padding: 16px;
    }
    .stat-number {
        font-size: 1.5rem;
    }

    .course-thumbnail {
        height: 180px;
    }
    .course-detail-header h1 {
        font-size: 1.5rem;
    }
    .course-meta-list {
        gap: 10px;
    }
    .course-price-box {
        flex-direction: column;
        align-items: flex-start;
    }
    .course-price-box .btn {
        width: 100%;
    }

    .cta-content h2 {
        font-size: 1.75rem;
    }
    .cta-actions {
        flex-direction: column;
    }
    .cta-actions .btn {
        width: 100%;
    }

    .page-banner {
        padding: 40px 0;
    }
    .page-banner h1 {
        font-size: 1.75rem;
    }

    .modal-content {
        margin: 10px;
        max-height: 85vh;
    }
    .modal-header {
        padding: 16px;
    }
    .modal-form, .modal .standard-form {
        padding: 16px;
    }

    .section-card {
        padding: 16px;
    }

    .enrolled-course-item {
        flex-direction: column;
        text-align: center;
    }

    .chatbot-container {
        width: calc(100vw - 32px);
        right: -8px;
        bottom: 66px;
        height: 440px;
    }

    .topic-card {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    .topic-footer {
        justify-content: center;
    }

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

    .data-table {
        font-size: 0.8rem;
    }
    .data-table th,
    .data-table td {
        padding: 10px 12px;
    }

    .quiz-info-bar {
        flex-wrap: wrap;
        gap: 12px;
    }

    .result-stats {
        gap: 20px;
    }

    .review-options {
        grid-template-columns: 1fr;
    }

    .assignment-card {
        padding: 16px;
    }
    .assignment-title {
        flex-direction: column;
        align-items: flex-start;
    }
    .assignment-meta {
        flex-direction: column;
        gap: 6px;
    }
}

/* ============================================================
   Dark Mode Support (based on system preference)
   ============================================================ */
@media (prefers-color-scheme: dark) {
    :root {
        --text-primary: #f3f4f6;
        --text-secondary: #9ca3af;
        --text-muted: #6b7280;
        --bg-primary: #1f2937;
        --bg-secondary: #111827;
        --bg-tertiary: #374151;
        --border: #374151;
        --border-light: #4b5563;
    }
    .navbar {
        background: rgba(31,41,55,0.95);
    }
    .hero {
        background: linear-gradient(135deg, #111827 0%, #1f2937 100%);
    }
    .auth-section {
        background: linear-gradient(135deg, #111827 0%, #1f2937 100%);
    }
    input, select, textarea {
        background: #374151;
        color: #f3f4f6;
        border-color: #4b5563;
    }
    .chatbot-container {
        background: #1f2937;
    }
    .course-thumbnail-placeholder,
    .blog-image-placeholder,
    .about-illustration {
        background: linear-gradient(135deg, #1f2937, #374151);
    }
    .page-banner {
        background: linear-gradient(135deg, #1f2937, #111827);
    }
}
