/* ============================================
   RESPONSIVE DESIGN - Mobile, Tablet, Desktop
   ============================================ */

/* Mobile Menu Toggle Button */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    z-index: 1001;
}

.mobile-menu-toggle span {
    width: 25px;
    height: 3px;
    background: #2D3748;
    border-radius: 2px;
    transition: all 0.3s;
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(7px, 7px);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* Mobile Menu Overlay */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
}

.mobile-menu-overlay.active {
    display: block;
}

/* ============================================
   TABLET STYLES (768px - 1024px)
   ============================================ */

@media (max-width: 1024px) {
    /* Header adjustments */
    header {
        padding: 1rem 1.5rem;
    }

    .header-container {
        gap: 1rem;
    }

    nav {
        gap: 1.5rem;
    }

    nav a {
        font-size: 0.9rem;
    }

    /* Hero section */
    .hero {
        padding: 4rem 1.5rem;
    }

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

    .hero p {
        font-size: 1.1rem;
    }

    /* Courses grid */
    .courses-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 1.5rem;
    }

    /* Dashboard */
    .dashboard-container {
        gap: 1rem;
    }

    .sidebar {
        width: 220px;
        padding: 1.5rem 0.75rem;
    }

    .main-content {
        padding: 1.5rem;
    }

    /* Stats grid */
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 1rem;
    }

    /* Chatbot */
    .chatbot {
        bottom: 1.5rem;
        right: 1.5rem;
    }

    .chatbot-window {
        width: 320px;
        height: 450px;
    }

    /* Cart sidebar */
    .cart-sidebar {
        width: 350px;
    }

    /* Modal */
    .modal-content {
        max-width: 600px;
        padding: 1.5rem;
    }

    /* Footer */
    .footer-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }

    /* Community content */
    .community-content {
        grid-template-columns: 1fr;
    }

    /* Section titles */
    .section-title {
        font-size: 2rem;
    }
}

/* ============================================
   MOBILE STYLES (max-width: 768px)
   ============================================ */

@media (max-width: 768px) {
    /* Base adjustments */
    * {
        -webkit-tap-highlight-color: transparent;
    }

    /* Header */
    header {
        padding: 1rem;
        position: sticky;
        top: 0;
        z-index: 1000;
    }

    .header-container {
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .logo {
        font-size: 1.25rem;
    }

    .logo-icon {
        font-size: 1.25rem;
    }

    /* Mobile menu toggle */
    .mobile-menu-toggle {
        display: flex;
        margin-left: auto;
    }

    /* Navigation */
    nav.main-nav {
        display: none;
        position: fixed;
        top: 70px;
        left: 0;
        right: 0;
        background: white;
        flex-direction: column;
        padding: 1rem;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
        z-index: 999;
        max-height: calc(100vh - 70px);
        overflow-y: auto;
    }

    nav.main-nav.active {
        display: flex;
    }

    nav.main-nav a {
        padding: 1rem;
        border-bottom: 1px solid #E2E8F0;
        font-size: 1rem;
        width: 100%;
        text-align: left;
    }

    nav.main-nav a:last-child {
        border-bottom: none;
    }

    /* Header right */
    .header-right {
        flex-wrap: wrap;
        gap: 0.5rem;
        width: 100%;
        order: 3;
    }

    .currency-selector {
        font-size: 0.85rem;
        padding: 0.4rem;
        flex: 1;
        min-width: 120px;
    }

    .cart-icon {
        font-size: 1.25rem;
    }

    .btn {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
        white-space: nowrap;
    }

    .btn-outline,
    .btn-primary {
        flex: 1;
        min-width: auto;
    }

    /* Hero section */
    .hero {
        padding: 3rem 1rem;
    }

    .hero h1 {
        font-size: 1.75rem;
        line-height: 1.2;
        margin-bottom: 0.75rem;
    }

    .hero p {
        font-size: 1rem;
        margin-bottom: 1.5rem;
        line-height: 1.5;
    }

    .hero-buttons {
        flex-direction: column;
        gap: 0.75rem;
        width: 100%;
    }

    .hero-buttons .btn {
        width: 100%;
        padding: 0.875rem 1.5rem;
    }

    /* How it works */
    .how-it-works {
        padding: 3rem 1rem;
    }

    .section-title {
        font-size: 1.75rem;
        margin-bottom: 2rem;
    }

    .steps {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .step {
        padding: 1.5rem;
    }

    /* Featured courses */
    .featured-courses {
        padding: 3rem 1rem;
    }

    .filter-bar {
        flex-direction: column;
        gap: 0.75rem;
    }

    .filter-bar input,
    .filter-bar select {
        width: 100%;
        min-width: auto;
    }

    .courses-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .course-card {
        width: 100%;
    }

    /* Why choose */
    .why-choose {
        padding: 3rem 1rem;
    }

    .features {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    /* Pricing */
    .pricing {
        padding: 3rem 1rem;
    }

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

    .instructor-pricing-card {
        padding: 2rem 1.5rem;
    }

    .price-large {
        font-size: 3rem;
    }

    /* Community page */
    .community-page {
        padding: 2rem 1rem;
    }

    .community-header h1 {
        font-size: 1.75rem;
    }

    .community-tabs {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .community-tab {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }

    .community-content {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    /* Dashboard */
    .dashboard-container {
        flex-direction: column;
    }

    .sidebar {
        position: fixed;
        top: 70px;
        left: -250px;
        width: 250px;
        height: calc(100vh - 70px);
        z-index: 998;
        transition: left 0.3s;
        padding: 1.5rem 1rem;
        overflow-y: auto;
        box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
    }

    .sidebar.active {
        left: 0;
    }

    .sidebar-menu {
        list-style: none;
        padding: 0;
    }

    .sidebar-menu a {
        padding: 1rem;
        display: block;
        font-size: 0.95rem;
    }

    .main-content {
        padding: 1rem;
        width: 100%;
    }

    .dashboard-header {
        padding: 1.5rem 1rem;
    }

    .dashboard-header h1 {
        font-size: 1.5rem;
    }

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

    .stat-card {
        padding: 1.25rem;
    }

    .content-card {
        padding: 1.5rem 1rem;
    }

    .content-card h2 {
        font-size: 1.25rem;
    }

    /* Dashboard header - add menu toggle for mobile */
    .dashboard header .header-container {
        position: relative;
    }

    .dashboard .mobile-menu-toggle {
        display: flex;
    }

    .dashboard nav {
        display: none;
    }

    /* Modal */
    .modal {
        padding: 1rem;
    }

    .modal-content {
        width: 100%;
        max-width: 100%;
        max-height: 90vh;
        padding: 1.5rem 1rem;
        border-radius: 8px;
        margin: 0;
    }

    .modal-close {
        top: 0.75rem;
        right: 0.75rem;
        font-size: 1.25rem;
    }

    .form-group {
        margin-bottom: 1rem;
    }

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

    .social-login {
        grid-template-columns: 1fr;
    }

    /* Cart sidebar */
    .cart-sidebar {
        width: 100vw;
        right: -100vw;
    }

    .cart-header {
        padding: 1rem;
    }

    .cart-items {
        padding: 1rem;
    }

    .cart-item {
        flex-direction: column;
        gap: 0.75rem;
    }

    .cart-item-image {
        width: 100%;
        height: 120px;
    }

    /* Chatbot */
    .chatbot {
        bottom: 1rem;
        right: 1rem;
    }

    .chatbot-toggle {
        width: 50px;
        height: 50px;
        font-size: 1.25rem;
    }

    .chatbot-window {
        width: calc(100vw - 2rem);
        max-width: 360px;
        height: calc(100vh - 100px);
        max-height: 500px;
        bottom: 70px;
        right: 0;
        border-radius: 12px 12px 0 0;
    }

    .chatbot-header {
        padding: 0.875rem;
    }

    .chatbot-body {
        padding: 0.75rem;
    }

    .chatbot-input {
        padding: 0.75rem;
    }

    .faq-buttons {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    /* Footer */
    footer {
        padding: 2rem 1rem 1rem;
    }

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

    .footer-bottom {
        padding-top: 1rem;
        font-size: 0.85rem;
    }

    .footer-bottom p {
        margin-bottom: 0.5rem;
    }

    /* Content list */
    .content-list {
        gap: 0.75rem;
    }

    .content-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        padding: 1rem;
    }

    .content-item h3 {
        font-size: 1rem;
    }

    .permissions-grid {
        grid-template-columns: 1fr;
    }

    /* Video player modal */
    .video-player-container {
        border-radius: 4px;
    }

    .video-controls {
        padding: 0.75rem;
        flex-wrap: wrap;
    }

    /* Course preview modal */
    .modal-content.large {
        max-width: 100%;
        width: 100%;
    }

    /* Tables and forms */
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Buttons in mobile */
    .btn-success,
    .btn-primary {
        width: 100%;
    }

    /* Stats */
    .media-stats {
        flex-direction: column;
        gap: 1rem;
    }

    .stat-item {
        text-align: left;
    }

    /* User name display */
    #landingUserName,
    #studentUserName,
    #instructorUserName,
    #adminUserName,
    #superAdminUserName {
        font-size: 0.85rem;
        margin-right: 0.5rem !important;
    }

    /* Home button in dashboard */
    .dashboard .btn-outline[onclick*="navigateToWebsite"] {
        order: -1;
    }

    /* Checkout modal adjustments */
    .order-summary {
        margin-top: 1rem;
        padding-top: 1rem;
        border-top: 1px solid #E2E8F0;
    }

    /* Course progress */
    .progress-bar-container {
        margin: 1rem 0;
    }

    .course-controls {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .course-controls button {
        flex: 1;
        min-width: auto;
    }
}

/* ============================================
   SMALL MOBILE STYLES (max-width: 480px)
   ============================================ */

@media (max-width: 480px) {
    /* Header */
    .logo {
        font-size: 1.1rem;
    }

    .logo-icon {
        font-size: 1.1rem;
    }

    /* Hero */
    .hero h1 {
        font-size: 1.5rem;
    }

    .hero p {
        font-size: 0.95rem;
    }

    /* Section titles */
    .section-title {
        font-size: 1.5rem;
    }

    /* Dashboard header */
    .dashboard-header h1 {
        font-size: 1.25rem;
    }

    /* Stats */
    .stat-value {
        font-size: 1.5rem;
    }

    .stat-icon {
        font-size: 1.5rem;
    }

    /* Modal */
    .modal-content {
        padding: 1rem;
    }

    .modal h2 {
        font-size: 1.25rem;
    }

    /* Course cards */
    .course-content {
        padding: 1rem;
    }

    .course-title {
        font-size: 1rem;
    }

    /* Footer */
    .footer-bottom {
        font-size: 0.75rem;
        line-height: 1.4;
    }

    /* Chatbot */
    .chatbot-toggle {
        width: 45px;
        height: 45px;
        font-size: 1.1rem;
    }

    .chatbot-window {
        width: 100vw;
        max-width: 100%;
        right: 0;
        left: 0;
        border-radius: 0;
        height: calc(100vh - 70px);
        max-height: none;
    }

    /* Cart sidebar */
    .cart-item-details {
        width: 100%;
    }

    /* Button groups */
    .hero-buttons .btn {
        font-size: 0.875rem;
        padding: 0.75rem 1.25rem;
    }

    /* Text sizes */
    .stat-label {
        font-size: 0.85rem;
    }

    .content-item p {
        font-size: 0.85rem;
    }
}

/* ============================================
   UTILITY CLASSES FOR RESPONSIVE
   ============================================ */

.hide-mobile {
    display: block;
}

.show-mobile {
    display: none;
}

@media (max-width: 768px) {
    .hide-mobile {
        display: none !important;
    }

    .show-mobile {
        display: block !important;
    }
}

/* Touch-friendly sizes */
@media (max-width: 768px) {
    a, button, input, select, textarea {
        min-height: 44px; /* iOS touch target size */
        min-width: 44px;
    }

    .cart-icon,
    .chatbot-toggle {
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* Landscape mobile adjustments */
@media (max-width: 768px) and (orientation: landscape) {
    .hero {
        padding: 2rem 1rem;
    }

    .hero h1 {
        font-size: 1.5rem;
    }

    .chatbot-window {
        height: calc(100vh - 60px);
        max-height: 400px;
    }

    .sidebar {
        top: 60px;
        height: calc(100vh - 60px);
    }
}

/* Print styles */
@media print {
    .chatbot,
    .cart-sidebar,
    .mobile-menu-toggle,
    nav,
    .header-right {
        display: none !important;
    }

    .dashboard-container {
        flex-direction: column;
    }

    .sidebar {
        display: none;
    }
}
