/* ========================================
   UNIVERSAL RESPONSIVE CSS FOR ALL EDUFLOW PAGES
   Add this to any page's <style> section
   ======================================== */

/* Base Responsive Settings */
* {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html {
    font-size: 16px;
}

body {
    overflow-x: hidden;
}

/* Mobile First - Base styles already applied above 768px */

/* ========================================
   TABLET - Max Width 1024px
   ======================================== */
@media (max-width: 1024px) {
    /* Container adjustments */
    .container {
        max-width: 100%;
        padding: 30px 24px;
    }

    /* Navbar */
    .nav-container {
        padding: 0 24px;
    }

    .course-title-nav {
        max-width: 300px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* Stats Grid */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Courses Grid */
    .courses-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

    /* Sidebar */
    .sidebar {
        width: 320px;
    }

    /* Form rows */
    .form-row {
        gap: 16px;
    }

    /* Tables */
    table {
        font-size: 14px;
    }

    th, td {
        padding: 12px;
    }
}

/* ========================================
   MOBILE - Max Width 768px
   ======================================== */
@media (max-width: 768px) {
    /* Typography */
    .page-title {
        font-size: 28px;
    }

    .section-title {
        font-size: 20px;
    }

    .current-video-title {
        font-size: 18px;
    }

    /* Container */
    .container {
        padding: 24px 16px;
    }

    /* Navbar */
    .nav-container {
        padding: 0 16px;
        flex-wrap: wrap;
    }

    .nav-menu {
        gap: 4px;
    }

    .nav-item {
        padding: 10px 12px;
        font-size: 13px;
    }

    .nav-item span {
        display: none;
    }

    .course-title-nav {
        display: none;
    }

    .logo {
        font-size: 20px;
    }

    /* Hero Section */
    .hero {
        padding: 40px 16px;
    }

    .hero h1 {
        font-size: 32px;
    }

    .hero p {
        font-size: 16px;
    }

    /* Stats Grid */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .stat-card {
        padding: 20px;
    }

    /* Courses Grid */
    .courses-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    /* Auth Card */
    .auth-card {
        padding: 32px 24px;
    }

    /* Profile Header */
    .profile-header {
        padding: 24px;
    }

    .profile-header-content {
        flex-direction: column;
        text-align: center;
        gap: 20px;
    }

    .profile-stats {
        justify-content: center;
    }

    .profile-name {
        font-size: 24px;
    }

    /* Forms */
    .form-card,
    .profile-form-card,
    .password-section,
    .danger-zone {
        padding: 24px 16px;
    }

    .form-content {
        padding: 24px 16px;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .form-actions {
        flex-direction: column;
        gap: 12px;
        padding: 20px 16px;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    /* Video Player Layout */
    .main-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: 250px;
        border-right: none;
        border-bottom: 1px solid #3a3b40;
    }

    .video-controls {
        padding: 20px 16px;
    }

    .controls-row {
        flex-direction: column;
        gap: 12px;
    }

    .control-buttons {
        width: 100%;
        flex-direction: column;
    }

    .control-btn {
        width: 100%;
        justify-content: center;
    }

    /* Tables */
    .table-container {
        padding: 16px;
        overflow-x: auto;
    }

    .table-header {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }

    table {
        min-width: 600px;
        font-size: 13px;
    }

    th, td {
        padding: 10px 8px;
    }

    .user-cell {
        min-width: 200px;
    }

    /* Tabs */
    .tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .tab {
        padding: 10px 16px;
        font-size: 14px;
    }

    /* Category Pills */
    .category-pills {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
    }

    /* Modal */
    .modal {
        max-width: 100%;
        max-height: 95vh;
        margin: 0;
        border-radius: 16px 16px 0 0;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 24px 16px;
    }

    .modal-title {
        font-size: 20px;
    }

    .avatar-section {
        flex-direction: column;
        text-align: center;
    }

    .modal-footer {
        flex-direction: column;
    }

    /* Coupon Cards */
    .coupon-card {
        padding: 24px 16px;
    }

    .coupon-form {
        flex-direction: column;
    }

    .coupon-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .copy-btn {
        width: 100%;
    }

    /* Footer */
    .footer-content {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    /* Search Bar */
    .search-bar {
        max-width: 100%;
    }

    /* Section Header */
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    /* Video Meta */
    .video-meta {
        flex-wrap: wrap;
        gap: 16px;
    }

    /* Navigation Buttons */
    .navigation-buttons {
        flex-direction: column;
    }

    .nav-btn {
        width: 100%;
    }

    /* Social Buttons */
    .social-buttons {
        gap: 8px;
    }

    /* Breadcrumb */
    .breadcrumb {
        flex-wrap: wrap;
    }
}

/* ========================================
   SMALL MOBILE - Max Width 480px
   ======================================== */
@media (max-width: 480px) {
    /* Typography */
    html {
        font-size: 14px;
    }

    .page-title {
        font-size: 24px;
    }

    .hero h1 {
        font-size: 28px;
    }

    /* Container */
    .container {
        padding: 20px 12px;
    }

    /* Navbar */
    .nav-container {
        padding: 0 12px;
    }

    .logo {
        font-size: 18px;
    }

    .nav-item {
        padding: 8px 10px;
    }

    /* Cards */
    .auth-card,
    .form-card,
    .profile-header,
    .coupon-card {
        padding: 20px 12px;
    }

    .stat-card {
        padding: 16px;
    }

    /* Stats */
    .stat-value {
        font-size: 28px;
    }

    .stat-icon {
        width: 40px;
        height: 40px;
    }

    .stat-icon svg {
        width: 20px;
        height: 20px;
    }

    /* Avatar */
    .avatar,
    .user-avatar {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }

    .profile-header .avatar {
        width: 80px;
        height: 80px;
        font-size: 32px;
    }

    /* Forms */
    .form-group {
        margin-bottom: 16px;
    }

    input,
    select,
    textarea {
        padding: 10px 12px;
        font-size: 14px;
    }

    .btn {
        padding: 10px 16px;
        font-size: 14px;
    }

    /* Tables - Make scrollable */
    .table-container {
        padding: 12px;
    }

    table {
        font-size: 12px;
    }

    th, td {
        padding: 8px 6px;
    }

    /* Course Cards */
    .course-card {
        border-radius: 12px;
    }

    .course-title {
        font-size: 18px;
    }

    .course-price {
        font-size: 20px;
    }

    /* Video Player */
    .video-player {
        padding: 10px;
    }

    .video-controls {
        padding: 16px 12px;
    }

    /* Modal */
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 20px 12px;
    }

    /* Coupon Preview */
    .coupon-code-preview {
        font-size: 24px;
    }

    .coupon-discount-preview {
        font-size: 16px;
    }
}

/* ========================================
   TOUCH DEVICE OPTIMIZATIONS
   ======================================== */
@media (hover: none) and (pointer: coarse) {
    /* Increase touch targets */
    .btn,
    .nav-item,
    .tab,
    .video-item,
    .course-card,
    .coupon-item {
        min-height: 44px;
    }

    /* Remove hover effects on touch devices */
    .btn:hover,
    .nav-item:hover,
    .course-card:hover {
        transform: none;
    }

    /* Add active states instead */
    .btn:active {
        transform: scale(0.98);
    }

    .course-card:active {
        transform: scale(0.99);
    }
}

/* ========================================
   LANDSCAPE MOBILE - Max Height 500px
   ======================================== */
@media (max-height: 500px) and (orientation: landscape) {
    .video-player {
        height: 60vh;
    }

    .modal {
        max-height: 90vh;
    }

    .sidebar {
        height: 200px;
    }
}

/* ========================================
   PRINT STYLES (Optional)
   ======================================== */
@media print {
    nav,
    .nav-item,
    .btn,
    .modal-overlay,
    .video-player {
        display: none;
    }

    body {
        background-color: white;
        color: black;
    }

    .container {
        max-width: 100%;
    }
}

/* ========================================
   UTILITY CLASSES FOR RESPONSIVE BEHAVIOR
   ======================================== */

/* Hide on mobile */
.hide-mobile {
    display: block;
}

@media (max-width: 768px) {
    .hide-mobile {
        display: none !important;
    }
}

/* Show only on mobile */
.show-mobile {
    display: none;
}

@media (max-width: 768px) {
    .show-mobile {
        display: block !important;
    }
}

/* Responsive text alignment */
@media (max-width: 768px) {
    .text-center-mobile {
        text-align: center !important;
    }
}

/* Responsive margin/padding utilities */
@media (max-width: 768px) {
    .mb-mobile-0 {
        margin-bottom: 0 !important;
    }
    
    .p-mobile-small {
        padding: 12px !important;
    }
}