/* ============================================================
   EduConnect Responsive Styles
   ============================================================ */

/* Extra Small Devices (phones, less than 576px) */
@media (max-width: 575.98px) {
    /* Typography */
    h1 { font-size: 1.8rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.2rem; }
    h4 { font-size: 1.1rem; }
    
    /* Layout */
    .container {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    /* Cards */
    .card-body {
        padding: 1rem;
    }
    
    /* Forms */
    .form-control, .form-select {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    /* Buttons */
    .btn {
        padding: 8px 16px;
        font-size: 0.9rem;
    }
    
    /* Tables */
    .table-responsive {
        font-size: 0.85rem;
    }
    
    /* Navbar */
    .navbar-brand {
        font-size: 1.2rem;
    }
    
    .navbar .nav-link {
        padding: 6px 12px;
    }
    
    /* Hero Section */
    .hero-section {
        padding: 40px 0;
    }
    
    .hero-section h1 {
        font-size: 1.8rem;
    }
    
    .hero-section .lead {
        font-size: 1rem;
    }
    
    /* Statistics */
    .stat-card .stat-number {
        font-size: 1.2rem;
    }
    
    /* Footer */
    footer {
        text-align: center;
    }
    
    .social-links {
        margin-top: 10px;
    }
}

/* Small Devices (landscape phones, 576px and up) */
@media (min-width: 576px) and (max-width: 767.98px) {
    .container {
        max-width: 540px;
    }
    
    h1 { font-size: 2rem; }
    h2 { font-size: 1.6rem; }
    
    .hero-section {
        padding: 50px 0;
    }
    
    .hero-section h1 {
        font-size: 2.2rem;
    }
}

/* Medium Devices (tablets, 768px and up) */
@media (min-width: 768px) and (max-width: 991.98px) {
    .container {
        max-width: 720px;
    }
    
    .hero-section h1 {
        font-size: 2.5rem;
    }
    
    /* Dashboard */
    .dashboard-stats .col-md-3 {
        flex: 0 0 50%;
        max-width: 50%;
    }
}

/* Large Devices (desktops, 992px and up) */
@media (min-width: 992px) and (max-width: 1199.98px) {
    .container {
        max-width: 960px;
    }
}

/* Extra Large Devices (large desktops, 1200px and up) */
@media (min-width: 1200px) {
    .container {
        max-width: 1140px;
    }
}

/* ============================================================
   Specific Component Responsive Fixes
   ============================================================ */

/* Material Cards */
@media (max-width: 767.98px) {
    .material-card .card-body {
        padding: 1rem;
    }
    
    .material-card .card-title {
        font-size: 0.95rem;
    }
}

/* Groups */
@media (max-width: 767.98px) {
    .group-card {
        margin-bottom: 1rem;
    }
    
    .group-chat {
        max-height: 300px !important;
    }
}

/* Admin Sidebar */
@media (max-width: 767.98px) {
    .admin-sidebar {
        width: 280px;
    }
    
    .admin-main {
        padding: 15px;
    }
    
    .admin-navbar {
        padding: 10px 16px;
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .admin-navbar .navbar-user .d-none {
        display: none !important;
    }
}

/* Modals */
@media (max-width: 575.98px) {
    .modal-dialog {
        margin: 10px;
    }
    
    .modal-body {
        padding: 1rem;
    }
    
    .modal-footer {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .modal-footer .btn {
        width: 100%;
    }
}

/* Tables */
@media (max-width: 767.98px) {
    .table-responsive {
        border: 0;
    }
    
    .table {
        font-size: 0.85rem;
    }
    
    .table td, .table th {
        padding: 8px 10px;
    }
    
    /* Card style tables on mobile */
    .table-card-style {
        display: block;
    }
    
    .table-card-style thead {
        display: none;
    }
    
    .table-card-style tbody tr {
        display: block;
        border: 1px solid #dee2e6;
        border-radius: 8px;
        margin-bottom: 10px;
        padding: 10px;
    }
    
    .table-card-style tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 6px 0;
        border: none;
        border-bottom: 1px solid #f8f9fa;
    }
    
    .table-card-style tbody td:last-child {
        border-bottom: none;
    }
    
    .table-card-style tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #6c757d;
        font-size: 0.8rem;
    }
}

/* Forms */
@media (max-width: 575.98px) {
    .form-group {
        margin-bottom: 1rem;
    }
    
    .input-group {
        flex-wrap: wrap;
    }
    
    .input-group .btn {
        width: 100%;
        border-radius: 8px !important;
        margin-top: 4px;
    }
}

/* Pagination */
@media (max-width: 575.98px) {
    .pagination {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .pagination .page-link {
        padding: 6px 10px;
        font-size: 0.85rem;
    }
}

/* Hero Section */
@media (max-width: 767.98px) {
    .hero-section .btn {
        display: block;
        width: 100%;
        margin-bottom: 8px;
    }
    
    .hero-section .btn + .btn {
        margin-left: 0;
    }
}

/* Footer */
@media (max-width: 767.98px) {
    footer .col-md-4,
    footer .col-md-2 {
        margin-bottom: 1.5rem;
    }
    
    footer .col-md-4:last-child {
        margin-bottom: 0;
    }
    
    footer .text-end {
        text-align: center !important;
    }
}

/* Search */
@media (max-width: 575.98px) {
    .search-form .input-group {
        flex-direction: column;
    }
    
    .search-form .input-group .btn {
        border-radius: 8px !important;
        margin-top: 4px;
        width: 100%;
    }
}

/* Dashboard */
@media (max-width: 575.98px) {
    .dashboard-card {
        padding: 12px;
    }
    
    .dashboard-card .card-icon {
        font-size: 1.5rem;
    }
}

/* Print Styles */
@media print {
    .navbar,
    .footer,
    .breadcrumb,
    .btn,
    .no-print {
        display: none !important;
    }
    
    .container {
        max-width: 100% !important;
    }
    
    .card {
        box-shadow: none !important;
        border: 1px solid #dee2e6 !important;
    }
    
    .table {
        font-size: 12px !important;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .dark-mode-support {
        background: #1a1a2e;
        color: #fff;
    }
    
    .dark-mode-support .card {
        background: #2d2d44;
        border-color: #3d3d5c;
    }
    
    .dark-mode-support .table {
        color: #fff;
    }
    
    .dark-mode-support .table thead th {
        background: #2d2d44;
        color: #aaa;
        border-color: #3d3d5c;
    }
    
    .dark-mode-support .table td,
    .dark-mode-support .table th {
        border-color: #3d3d5c;
    }
}

/* Loading States */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.8);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-overlay .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0d6efd;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Utility Classes */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.text-truncate-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.hover-shadow {
    transition: box-shadow 0.2s;
}

.hover-shadow:hover {
    box-shadow: 0 8px 25px rgba(0,0,0,0.1) !important;
}

.rounded-12 {
    border-radius: 12px;
}

.cursor-pointer {
    cursor: pointer;
}

.gap-2 {
    gap: 0.5rem;
}

.gap-3 {
    gap: 1rem;
}