/**
 * Civil Engineering Farewell Portal - Styles
 * Mobile-first responsive design
 */

/* === CSS Variables === */
:root {
    --primary-color: #1976d2;
    --primary-dark: #115293;
    --primary-light: #4791db;
    
    --secondary-color: #424242;
    --secondary-light: #6d6d6d;
    
    --success-color: #388e3c;
    --success-light: #d4edda;
    
    --warning-color: #f57c00;
    --warning-light: #fff3cd;
    
    --danger-color: #d32f2f;
    --danger-light: #f8d7da;
    
    --info-color: #0288d1;
    --info-light: #d1ecf1;
    
    --bg-color: #f5f5f5;
    --card-bg: #ffffff;
    --text-primary: #212121;
    --text-secondary: #757575;
    --border-color: #e0e0e0;
    
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.15);
    
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    
    --transition: all 0.3s ease;
}

/* === Reset & Base === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    /* Increase touch targets on touch devices */
    .btn, button, a {
        min-height: 44px;
    }
    
    /* Remove hover effects on touch devices */
    .btn:hover,
    .stat-card:hover,
    .student-card:hover,
    .batch-tab:hover {
        transform: none;
    }
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* === Header === */
.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 1.5rem 0;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.subtitle {
    font-size: 0.875rem;
    opacity: 0.9;
    font-weight: 300;
}

/* === Main Content === */
.main-content {
    padding: 2rem 0;
    min-height: calc(100vh - 120px);
}

.section-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

/* === Dashboard Stats === */
.dashboard-section {
    margin-bottom: 2rem;
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 0;
    width: 100%;
}

.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    padding: 0.05rem;
    box-shadow: var(--shadow-sm);
    display:flexbox;
    align-items: center;
    gap: 0.05rem;
    transition: var(--transition);
    border-left: 1px solid var(--primary-color);
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-card.success {
    border-left-color: var(--success-color);
}

.stat-card.warning {
    border-left-color: var(--warning-color);
}

.stat-card.info {
    border-left-color: var(--info-color);
}

.stat-card.extra {
    border-left-color: #9333ea; /* Purple color for extra amount */
    background: linear-gradient(135deg, rgba(147, 51, 234, 0.05) 0%, rgba(147, 51, 234, 0.02) 100%);
}

.stat-card.extra .stat-icon {
    background: linear-gradient(135deg, #9333ea 0%, #c084fc 100%);
}

/* === Batch Analytics === */
.batch-analytics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    background: var(--card-bg);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    animation: slideDown 0.4s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chart-container {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.chart-container canvas {
    max-width: 350px;
    max-height: 350px;
}

.batch-stats-cards {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.batch-stat-card {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 30%);
    border-radius: var(--radius-md);
    border-left: 1px solid;
    transition: var(--transition);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.batch-stat-card:hover {
    transform: translateX(1px);
    box-shadow: var(--shadow-sm);
}

.batch-stat-card.e1 { border-left-color: #ff6384; }
.batch-stat-card.e2 { border-left-color: #36a2eb; }
.batch-stat-card.e3 { border-left-color: #ffce56; }
.batch-stat-card.e4 { border-left-color: #4bc0c0; }

.batch-stat-info h4 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.batch-stat-details {
    display: flex;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.batch-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

@media (max-width: 768px) {
    .batch-analytics {
        grid-template-columns: 1fr;
    }
    
    .chart-container canvas {
        max-width: 100%;
        max-height: 300px;
    }
}

.stat-icon {
    font-size: 1.75rem;
    opacity: 0.9;
}

.stat-info {
    flex: 1;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* === Batch Tabs === */
.batch-section {
    margin-bottom: 2rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.batch-filter {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
}

.batch-filter label {
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

.batch-select {
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    background: var(--card-bg);
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
    min-width: 200px;
    font-weight: 500;
}

.batch-select:hover {
    border-color: var(--primary-light);
}

.batch-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.1);
}

.batch-tabs {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    flex: 1;
}

.export-controls {
    display: flex;
    gap: 0.5rem;
}

.batch-tab {
    padding: 0.75rem 1.5rem;
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
    white-space: nowrap;
}

.batch-tab:hover {
    border-color: var(--primary-light);
    background: var(--primary-light);
    color: white;
}

.batch-tab.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

/* === Filters & Search === */
.filters-section {
    margin-bottom: 2rem;
}

.filters-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.search-box {
    flex: 1;
}

.search-input {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    transition: var(--transition);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.1);
}

.sort-controls {
    display: flex;
    gap: 0.5rem;
}

.sort-select {
    flex: 1;
    padding: 0.875rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    background: white;
    cursor: pointer;
    transition: var(--transition);
}

.sort-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* === Students Container === */
.students-section {
    margin-bottom: 2rem;
}

.students-container {
    min-height: 300px;
}

.students-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

/* Student Card */
.student-card {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    border-left: 4px solid var(--border-color);
}

.student-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.student-card.status-FULLY_PAID {
    border-left-color: var(--success-color);
}

.student-card.status-PARTIALLY_PAID {
    border-left-color: var(--warning-color);
}

.student-card.status-NOT_STARTED {
    border-left-color: var(--danger-color);
}

.student-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 1rem;
}

.student-name {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.student-meta {
    display: flex;
    gap: 0.75rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-batch {
    background: var(--info-light);
    color: var(--info-color);
}

.badge-status {
    padding: 0.375rem 0.875rem;
    border-radius: var(--radius-lg);
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-status.FULLY_PAID {
    background: var(--success-light);
    color: var(--success-color);
}

.badge-status.PARTIALLY_PAID {
    background: var(--warning-light);
    color: var(--warning-color);
}

.badge-status.NOT_STARTED {
    background: var(--danger-light);
    color: var(--danger-color);
}

.payment-info {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

.payment-item {
    display: flex;
    flex-direction: column;
}

.payment-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.payment-value {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.payment-value.success {
    color: var(--success-color);
}

.payment-value.warning {
    color: var(--warning-color);
}

.payment-value.extra {
    color: #9b59b6;
    font-weight: 600;
}

.star-badge {
    display: inline-block;
    margin-left: 0.5rem;
    font-size: 1.2rem;
    animation: sparkle 2s infinite;
}

@keyframes sparkle {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.8; }
}

.student-card.overpaid {
    border: 2px solid #9b59b6;
    box-shadow: 0 4px 12px rgba(155, 89, 182, 0.2);
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border-color);
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--success-color), var(--info-color));
    transition: width 0.5s ease;
}

.student-actions {
    display: flex;
    gap: 0.5rem;
}

/* === Buttons === */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: var(--secondary-light);
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #b71c1c;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-outline:hover {
    background: var(--primary-color);
    color: white;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.813rem;
}

.btn-icon {
    padding: 0.5rem;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* === Modal === */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    overflow-y: auto;
    padding: 1rem;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalSlideIn 0.3s ease;
}

.modal-large {
    max-width: 800px;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.75rem;
    cursor: pointer;
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
}

.close-btn:hover {
    background: var(--border-color);
}

.modal-body {
    padding: 1.5rem;
}

/* === Forms === */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-family: inherit;
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

/* === Student Info Card === */
.student-info-card {
    background: var(--info-light);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.student-info-card h4 {
    margin-bottom: 0.5rem;
    color: var(--info-color);
}

.student-info-card p {
    margin: 0.25rem 0;
    font-size: 0.875rem;
}

/* === Installment History === */
.installments-list {
    margin-top: 1.5rem;
}

.installment-item {
    background: var(--bg-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.installment-details {
    flex: 1;
}

.installment-amount {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--success-color);
}

.installment-meta {
    font-size: 0.813rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.installment-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.btn-icon {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: var(--border-color);
    transform: scale(1.1);
}

.btn-icon.btn-danger:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* === Loading & Empty States === */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* === Toast Notification === */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--text-primary);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transform: translateY(100px);
    transition: var(--transition);
    z-index: 2000;
    max-width: 400px;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast.success {
    background: var(--success-color);
}

.toast.error {
    background: var(--danger-color);
}

/* === Responsive Design === */

/* Tablet */
@media (min-width: 768px) {
    .logo h1 {
        font-size: 1.75rem;
    }
    
    .filters-container {
        flex-direction: row;
    }
    
    .students-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .sort-controls {
        max-width: 400px;
    }
}

/* Desktop */
@media (min-width: 1024px) {
    .main-content {
        padding: 3rem 0;
    }
    
    .section-title {
        font-size: 1.75rem;
    }
    
    .students-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .toast {
        bottom: 3rem;
        right: 3rem;
    }
}

/* Print Styles */
@media print {
    .header-actions,
    .filters-section,
    .student-actions,
    .batch-tabs,
    .btn {
        display: none !important;
    }
    
    .student-card {
        break-inside: avoid;
    }
}

/* === Loading Spinner === */
.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.spinner-overlay.active {
    opacity: 1;
    visibility: visible;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    color: white;
    margin-top: 1rem;
    font-size: 1rem;
    font-weight: 500;
}

/* === PWA Install Button === */
.install-pwa-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(25, 118, 210, 0.4);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    animation: slideUp 0.5s ease;
}

.install-pwa-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(25, 118, 210, 0.5);
}

.install-pwa-button:active {
    transform: translateY(-1px);
}

@keyframes slideUp {
    from {
        transform: translateY(100px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* === Update Banner === */
.update-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, var(--success-color), #2e7d32);
    color: white;
    padding: 1rem;
    z-index: 9999;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    animation: slideDown 0.3s ease;
    text-align: center;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
    }
    to {
        transform: translateY(0);
    }
}

.update-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.update-content p {
    margin: 0;
    font-weight: 500;
}

.update-content button {
    padding: 8px 16px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
}

.update-content .btn-primary {
    background: white;
    color: var(--success-color);
}

.update-content .btn-primary:hover {
    transform: scale(1.05);
}

.update-content .btn-secondary {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.update-content .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* === RESPONSIVE DESIGN === */

/* Large tablets and small desktops */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .students-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .batch-analytics {
        grid-template-columns: 1fr;
    }
}

/* Tablets */
@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }
    
    .header {
        padding: 1rem 0;
    }
    
    .header-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .logo h1 {
        font-size: 1.25rem;
    }
    
    .subtitle {
        font-size: 0.75rem;
    }
    
    .header-actions {
        width: 100%;
        justify-content: flex-start;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .students-grid {
        grid-template-columns: 1fr;
    }
    
    .section-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .batch-filter {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    
    .batch-select {
        width: 100%;
    }
    
    .export-controls {
        width: 100%;
    }
    
    .export-controls .btn {
        width: 100%;
    }
    
    .section-title {
        font-size: 1.25rem;
    }
    
    .modal-content {
        width: 95%;
        max-width: 500px;
        margin: 1rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* Mobile devices */
@media (max-width: 480px) {
    body {
        font-size: 14px;
    }
    
    .header {
        padding: 0.75rem 0;
    }
    
    .header-content {
        gap: 0.75rem;
    }
    
    .logo h1 {
        font-size: 1.1rem;
        margin-bottom: 0.125rem;
    }
    
    .subtitle {
        font-size: 0.7rem;
    }
    
    /* Navbar buttons in single line with compact sizing */
    .header-actions {
        display: flex;
        gap: 1.4rem;
        width: 100%;
        justify-content: space-between;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    
    .header-actions::-webkit-scrollbar {
        display: none;
    }
    
    .header-actions .btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.75rem;
        white-space: nowrap;
        flex-shrink: 0;
        min-width: auto;
        border-radius: 6px;
    }
    
    .header-actions .btn span {
        font-size: 0.875rem;
        margin-right: 0.25rem;
    }
    
    /* Make buttons width based on content */
    .header-actions #addStudentBtn {
        flex: 0 0 auto;
    }
    
    .header-actions #statsBtn {
        flex: 0 0 auto;
    }
    
    .header-actions #accessBtn {
        flex: 0 0 auto;
        margin-left: 0 !important;
    }
    
    .header-actions #logoutBtn {
        flex: 0 0 auto;
        margin-left: 0 !important;
    }
    
    .main-content {
        padding: 1rem 0;
    }
    
    .section-title {
        font-size: 1.1rem;
        margin-bottom: 1rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .stat-card {
        padding: 0.2rem;
        flex-direction: column;
        align-items: flex-start;
    }
    
    .stat-icon {
        font-size: 1.5rem;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    .stat-label {
        font-size: 0.75rem;
    }
    
    .student-card {
        padding: 1rem;
    }
    
    .student-name {
        font-size: 1rem;
    }
    
    .payment-info {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .student-actions {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .student-actions .btn {
        width: 100%;
        justify-content: center;
    }
    
    .modal-content {
        width: 100%;
        margin: 0.5rem;
        padding: 1.5rem;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .modal-header h2 {
        font-size: 1.25rem;
    }
    
    .form-group input,
    .form-group select {
        font-size: 14px;
        padding: 0.625rem;
    }
    
    .installment-card {
        padding: 1rem;
    }
    
    .installment-header h4 {
        font-size: 0.875rem;
    }
    
    .batch-analytics {
        gap: 1rem;
    }
    
    .chart-container {
        padding: 1rem;
        max-width: 100%;
    }
    
    .chart-container canvas {
        max-height: 250px !important;
    }
    
    .batch-stat-card {
        padding: 0.875rem;
    }
    
    .batch-stat-card h3 {
        font-size: 1rem;
    }
    
    .search-filter-bar {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .search-box {
        width: 100%;
    }
    
    .filter-group {
        width: 100%;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .filter-group select {
        width: 100%;
    }
    
    .toast {
        bottom: 1rem;
        right: 1rem;
        left: 1rem;
        min-width: auto;
        font-size: 0.875rem;
        padding: 0.75rem 1rem;
    }
    
    .install-pwa-button {
        bottom: 15px;
        right: 15px;
        padding: 10px 18px;
        font-size: 14px;
    }
}

/* Extra small devices */
@media (max-width: 360px) {
    .logo h1 {
        font-size: 1rem;
    }
    
    .header-actions .btn {
        padding: 0.4rem 0.6rem;
        font-size: 0.7rem;
    }
    
    .header-actions .btn span {
        font-size: 0.75rem;
    }
    
    .stat-value {
        font-size: 1.25rem;
    }
    
    .section-title {
        font-size: 1rem;
    }
}

/* PWA Install Card - Minimal White Design */
.install-popup {
    position: fixed !important;
    top: 16px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    z-index: 99999 !important;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.install-popup.show {
    opacity: 1;
}

.install-card {
    background: #ffffff !important;
    border-radius: 8px;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.12);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 280px;
}

.install-content {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.install-icon {
    font-size: 1.5rem;
    line-height: 1;
}

.install-text {
    font-size: 0.95rem;
    font-weight: 500;
    color: #333;
}

.install-buttons {
    display: flex;
    gap: 8px;
}

.install-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.install-btn:hover {
    transform: scale(1.05);
}

.cancel-btn {
    background: #f5f5f5;
    color: #666;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.cancel-btn:hover {
    background: #e9ecef;
    color: #495057;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .install-popup {
        top: 10px;
        left: 10px;
        right: 10px;
        transform: translateY(-150px);
    }
    
    .install-popup.show {
        transform: translateY(0);
    }
    
    .install-card {
        min-width: auto;
        width: 100%;
        padding: 0.875rem 1rem;
    }
    
    .install-icon {
        font-size: 1.5rem;
    }
    
    .install-text strong {
        font-size: 0.9rem;
    }
    
    .install-text span {
        font-size: 0.75rem;
    }
    
    .install-btn {
        padding: 0.45rem 1rem;
        font-size: 0.85rem;
    }
}

/* Old PWA styles - remove */
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.install-popup-buttons .btn-primary {
    background: white;
    color: #667eea;
}

.install-popup-buttons .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.3);
}

.install-popup-buttons .btn-close {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    line-height: 1;
}

.install-popup-buttons .btn-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .install-popup-card {
        flex-wrap: wrap;
        padding: 0.875rem;
    }
    
    .install-popup-icon {
        font-size: 1.75rem;
    }
    
    .install-popup-text h3 {
        font-size: 0.95rem;
    }
    
    .install-popup-text p {
        font-size: 0.8rem;
    }
    
    .install-popup-buttons .btn {
        padding: 0.4rem 0.75rem;
        font-size: 0.85rem;
    }
}

/* Toast Notifications */
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
}

.install-popup-buttons .btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.install-popup-buttons .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.5);
}

.install-popup-buttons .btn-secondary {
    background: #f8f9fa;
    color: #666;
}

.install-popup-buttons .btn-secondary:hover {
    background: #e9ecef;
    color: #333;
}
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.5);
}

.install-popup-buttons .btn-secondary {
    background: #f0f0f0;
    color: #666;
}

.install-popup-buttons .btn-secondary:hover {
    background: #e0e0e0;
    color: #333;
}

/* Mobile responsive for install popup */
@media (max-width: 480px) {
    .install-popup-content {
        padding: 1.5rem;
        max-width: 95%;
        border-radius: 12px;
    }
    
    .install-popup-icon {
        font-size: 2.5rem;
    }
    
    .install-popup-content h3 {
        font-size: 1.25rem;
    }
    
    .install-popup-content p {
        font-size: 0.9rem;
    }
    
    .feature-item {
        padding: 0.625rem;
        font-size: 0.9rem;
    }
    
    .feature-item span:first-child {
        font-size: 1.1rem;
    }
    
    .install-popup-buttons button {
        padding: 0.75rem 1.25rem;
        font-size: 0.95rem;
    }
}

