/* Responsive styles for School Management System */

/* General container and padding adjustments */
@media (max-width: 1200px) {
  .container, .container-narrow {
    max-width: 98vw;
    padding: 1.5rem;
  }
}

@media (max-width: 991px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    width: 250px;
    z-index: 1001;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }
  .sidebar.show {
    transform: translateX(0);
  }
  .sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
  }
  .sidebar-backdrop.show {
    display: block;
  }
  .content-wrapper {
    margin-left: 0 !important;
  }
  .navbar {
    padding: 1rem;
  }
}

@media (max-width: 768px) {
  .container, .container-narrow {
    padding: 1rem;
    margin: 1rem auto;
  }
  .grid.grid-2, .grid.grid-3, .grid.grid-4 {
    grid-template-columns: 1fr !important;
  }
  .summary-card, .quick-action-card {
    flex-direction: column;
    align-items: flex-start;
    padding: 1rem;
  }
  .navbar .nav-links {
    gap: 0.75rem;
  }
  .feature-card, .dashboard-card, .card {
    padding: 1rem;
  }
  .accounts-table th, .accounts-table td {
    padding: 0.5rem;
    font-size: 0.95rem;
  }
  .modal-content, .modal-lg .modal-content {
    width: 98vw !important;
    max-width: 98vw !important;
    padding: 1rem !important;
  }
}

@media (max-width: 600px) {
  .navbar {
    flex-direction: column;
    align-items: flex-start;
    padding: 0.5rem 1rem;
  }
  .navbar .logo {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
  }
  .sidebar {
    width: 200px;
    padding: 0.5rem;
  }
  .sidebar-header, .sidebar-profile {
    padding: 0.5rem;
  }
  .sidebar-logo {
    font-size: 1.1rem;
  }
  .profile-avatar-small {
    width: 32px;
    height: 32px;
    font-size: 1rem;
  }
  .card, .feature-card, .dashboard-card {
    padding: 0.75rem;
    margin-bottom: 1rem;
  }
  .accounts-table th, .accounts-table td {
    padding: 0.35rem;
    font-size: 0.9rem;
  }
  .btn, .btn-primary, .btn-outline, .btn-secondary {
    padding: 0.5rem 1rem;
    font-size: 0.95rem;
  }
  .modal-content, .modal-lg .modal-content {
    padding: 0.5rem !important;
  }
}

/* Unify navbar border color for all roles on all breakpoints */
.navbar {
  border-bottom: 3px solid var(--primary);
}

/* Responsive table: stack cells on mobile */
@media (max-width: 600px) {
  .accounts-table, .accounts-table thead, .accounts-table tbody, .accounts-table th, .accounts-table td, .accounts-table tr {
    display: block;
    width: 100%;
  }
  .accounts-table thead {
    display: none;
  }
  .accounts-table tr {
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--border);
  }
  .accounts-table td {
    padding-left: 50%;
    position: relative;
    text-align: left;
    border: none;
    border-bottom: 1px solid var(--border);
  }
  .accounts-table td:before {
    position: absolute;
    left: 0;
    width: 45%;
    padding-left: 1rem;
    white-space: nowrap;
    font-weight: 600;
    color: var(--primary);
    content: attr(data-label);
  }
}

/* Hide sidebar on print */
@media print {
  .sidebar, .sidebar-backdrop, .navbar, .theme-toggle, .menu-toggle {
    display: none !important;
  }
  .content-wrapper, .container, .container-narrow {
    margin: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
    background: #fff !important;
  }
}

/* Chat responsive styles */
@media (max-width:880px){
    .page{padding:0}
    .chat-list{width:100%;height:100vh;border-radius:0}
    .chat-panel{position:fixed;inset:0;margin-left:100%;transition:margin .25s ease}
    .chat-panel.active{margin-left:0}
    .chat-top .back{display:inline-flex;padding:8px;border-radius:6px;background:var(--hover-bg);cursor:pointer}
}

/* Challan Generator Responsive */
@media (max-width: 991px) {
    .challan-copy {
        min-width: 220px;
        max-width: 100%;
        width: 100%;
        margin-right: 0;
        margin-bottom: 1rem;
        display: block;
    }
    #challan-output {
        display: block;
    }
}
@media (max-width: 600px) {
    .challan-header, .challan-footer {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }
    .challan-header-left, .challan-header-right, .challan-footer-left, .challan-footer-right {
        width: 100% !important;
        text-align: left !important;
        padding: 0 !important;
    }
    .challan-copy {
        padding: 0.5rem !important;
        min-width: 0 !important;
        max-width: 100vw !important;
        width: 100% !important;
        margin-bottom: 1rem !important;
    }
    .school-logo {
        height: 40px;
        width: 40px;
    }
    .challan-fee-table th, .challan-fee-table td {
        font-size: 0.95rem;
        padding: 0.35rem 0.5rem;
    }
}

/* Attendance Responsive Styles */
@media (max-width: 1200px) {
    .container {
        max-width: 98vw;
        padding: 1.5rem;
    }
}

@media (max-width: 991px) {
    .container {
        padding: 1rem;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
        margin: 1rem auto;
    }
    .header {
        padding: 1rem;
        font-size: 1.2rem;
    }
    .controls {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }
    .calendar-table th, .calendar-table td {
        padding: 0.5rem;
        font-size: 0.95rem;
    }
    .student {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    .report {
        margin-top: 1rem;
    }
}

@media (max-width: 600px) {
    .header {
        padding: 0.5rem;
        font-size: 1rem;
    }
    .container {
        padding: 0.5rem;
    }
    .calendar-table th, .calendar-table td {
        padding: 0.35rem;
        font-size: 0.9rem;
    }
    .btn, .btn-primary, .btn-outline, .btn-secondary {
        padding: 0.5rem 1rem;
        font-size: 0.95rem;
    }
}

/* ========================================
   MODERN DASHBOARD RESPONSIVE STYLES
   ======================================== */

/* Tablet and smaller - Toggle sidebar */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .content-wrapper {
        margin-left: 0;
    }
    
    .navbar {
        padding: 0 20px;
    }
    
    .dashboard-container {
        padding: 24px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
        gap: 20px;
    }
    
    .quick-actions-grid {
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    }
}

/* Mobile optimization */
@media (max-width: 768px) {
    .sidebar {
        width: 280px;
    }
    
    .navbar {
        height: 60px;
        padding: 0 12px;
    }
    
    .navbar-left {
        gap: 10px;
    }
    
    .page-title-header {
        font-size: 20px;
    }
    
    .breadcrumb {
        display: none;
    }
    
    .navbar-right {
        gap: 8px;
    }
    
    .nav-icon-btn {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
    
    .dashboard-container {
        padding: 16px;
    }
    
    .welcome-banner {
        padding: 24px 20px;
        border-radius: 16px;
    }
    
    .welcome-content h1 {
        font-size: 22px;
        margin-bottom: 8px;
    }
    
    .welcome-content p {
        font-size: 14px;
        margin-bottom: 16px;
    }
    
    .welcome-stats {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
        margin-top: 16px;
    }
    
    .welcome-stat-item {
        padding: 14px;
    }
    
    .welcome-stat-item .number {
        font-size: 20px;
    }
    
    .welcome-stat-item .label {
        font-size: 11px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 16px;
        margin-bottom: 24px;
    }
    
    .stat-card {
        padding: 20px;
    }
    
    .stat-icon {
        width: 48px;
        height: 48px;
        font-size: 22px;
    }
    
    .stat-number {
        font-size: 28px;
    }
    
    .section-title {
        font-size: 18px;
        margin-bottom: 16px;
    }
    
    .quick-actions-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .action-card {
        padding: 24px;
    }
    
    .action-icon {
        width: 64px;
        height: 64px;
        font-size: 28px;
    }
}

/* Small phones */
@media (max-width: 480px) {
    .navbar {
        height: 56px;
        padding: 0 8px;
    }
    
    .page-title-header {
        font-size: 18px;
    }
    
    .nav-icon-btn {
        width: 34px;
        height: 34px;
        font-size: 15px;
        border-radius: 8px;
    }
    
    .dashboard-container {
        padding: 12px;
    }
    
    .welcome-banner {
        padding: 20px 16px;
        margin-bottom: 20px;
    }
    
    .welcome-content h1 {
        font-size: 20px;
    }
    
    .welcome-content p {
        font-size: 13px;
    }
    
    .welcome-stats {
        gap: 10px;
    }
    
    .welcome-stat-item {
        padding: 12px;
        border-radius: 10px;
    }
    
    .welcome-stat-item .number {
        font-size: 18px;
    }
    
    .welcome-stat-item .label {
        font-size: 10px;
    }
    
    .stats-grid {
        gap: 12px;
    }
    
    .stat-card {
        padding: 16px;
        border-radius: 12px;
    }
    
    .stat-card-header {
        margin-bottom: 14px;
    }
    
    .stat-icon {
        width: 44px;
        height: 44px;
        font-size: 20px;
        border-radius: 10px;
    }
    
    .stat-number {
        font-size: 24px;
    }
    
    .stat-label {
        font-size: 13px;
    }
    
    .section-title {
        font-size: 16px;
    }
    
    .quick-actions-grid {
        gap: 12px;
    }
    
    .action-card {
        padding: 20px;
        border-radius: 12px;
    }
    
    .action-icon {
        width: 56px;
        height: 56px;
        font-size: 24px;
        margin-bottom: 14px;
    }
    
    .action-card h3 {
        font-size: 16px;
    }
    
    .action-card p {
        font-size: 13px;
    }
}

/* Very small phones */
@media (max-width: 360px) {
    .sidebar {
        width: 260px;
    }
    
    .welcome-stats {
        grid-template-columns: 1fr;
    }
    
    .welcome-stat-item .number {
        font-size: 16px;
    }
    
    .navbar-right .nav-icon-btn:nth-child(2) {
        display: none;
    }
}

