/* Mobile App-like Design */
@media (max-width: 768px) {
    /* App Container */
    body {
        padding-bottom: 80px; /* Space for bottom navigation */
        background: #f5f5f5;
    }

    .main-container {
        padding: 0;
    }

    .container-fluid {
        padding: 0;
    }

    /* App Header */
    .app-header {
        position: sticky;
        top: 0;
        z-index: 1000;
        background: linear-gradient(135deg, #1a5f5f 0%, #2d7a7a 100%);
        color: white;
        padding: 1rem;
        box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    }

    .app-header h1 {
        font-size: 1.5rem;
        margin: 0;
        font-weight: 600;
    }

    .app-header p {
        font-size: 0.9rem;
        margin: 0.25rem 0 0 0;
        opacity: 0.9;
    }

    /* Bottom Navigation Bar */
    .bottom-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        border-top: 1px solid #e0e0e0;
        padding: 0.5rem 0;
        z-index: 1000;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
        display: flex;
        justify-content: space-around;
        align-items: center;
    }

    .bottom-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-decoration: none;
        color: #666;
        font-size: 0.75rem;
        padding: 0.5rem;
        min-width: 60px;
        transition: all 0.3s;
    }

    .bottom-nav-item.active {
        color: #1a5f5f;
    }

    .bottom-nav-item i {
        font-size: 1.5rem;
        margin-bottom: 0.25rem;
    }

    /* Card Design for Mobile */
    .card-modern {
        border-radius: 12px;
        margin-bottom: 1rem;
        box-shadow: 0 2px 6px rgba(0,0,0,0.06);
        border: 1px solid #dee2e6;
    }

    .card-header {
        border-radius: 12px 12px 0 0 !important;
        padding: 1rem;
    }

    .card-body {
        padding: 1rem;
    }

    /* Stat Cards */
    .stat-card {
        border-radius: 16px;
        padding: 1.5rem;
        margin-bottom: 1rem;
        box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    }

    .stat-card-small {
        border-radius: 12px;
        padding: 1rem;
        margin-bottom: 1rem;
    }

    /* Buttons */
    .btn {
        border-radius: 10px;
        padding: 0.75rem 1.5rem;
        font-weight: 500;
        font-size: 0.95rem;
    }

    .btn-group {
        width: 100%;
    }

    .btn-group .btn {
        flex: 1;
    }

    /* List Items */
    .list-group-item {
        border-radius: 10px;
        margin-bottom: 0.5rem;
        border: 1px solid #e0e0e0;
        padding: 1rem;
    }

    /* Forms */
    .form-control,
    .form-select {
        border-radius: 10px;
        padding: 0.75rem;
        border: 1px solid #e0e0e0;
    }

    /* Page Header */
    .page-header {
        background: white;
        padding: 1rem;
        margin-bottom: 1rem;
        border-radius: 0;
        box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    }

    .page-header h1 {
        font-size: 1.5rem;
        margin: 0;
    }

    /* Quick Actions Grid */
    .quick-actions {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
        padding: 1rem;
    }

    .quick-action-btn {
        background: white;
        border: 1px solid #e0e0e0;
        border-radius: 12px;
        padding: 1.5rem 1rem;
        text-align: center;
        text-decoration: none;
        color: #333;
        display: flex;
        flex-direction: column;
        align-items: center;
        transition: all 0.3s;
        box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    }

    .quick-action-btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 8px rgba(0,0,0,0.1);
        color: #1a5f5f;
    }

    .quick-action-btn i {
        font-size: 2rem;
        margin-bottom: 0.5rem;
        color: #1a5f5f;
    }

    /* Student Card */
    .student-card {
        background: white;
        border-radius: 12px;
        padding: 1rem;
        margin-bottom: 1rem;
        box-shadow: 0 2px 6px rgba(0,0,0,0.06);
        border: 1px solid #dee2e6;
        display: flex;
        align-items: center;
        gap: 1rem;
    }

    .student-avatar {
        width: 50px;
        height: 50px;
        border-radius: 50%;
        background: linear-gradient(135deg, #1a5f5f 0%, #2d7a7a 100%);
        display: flex;
        align-items: center;
        justify-content: center;
        color: white;
        font-weight: bold;
        font-size: 1.2rem;
    }

    .student-info {
        flex: 1;
    }

    .student-name {
        font-weight: 600;
        font-size: 1rem;
        margin-bottom: 0.25rem;
    }

    .student-details {
        font-size: 0.85rem;
        color: #666;
    }

    /* Attendance Status */
    .attendance-status {
        display: inline-block;
        padding: 0.25rem 0.75rem;
        border-radius: 20px;
        font-size: 0.8rem;
        font-weight: 500;
    }

    .status-present {
        background: #d4edda;
        color: #155724;
    }

    .status-absent {
        background: #f8d7da;
        color: #721c24;
    }

    .status-late {
        background: #fff3cd;
        color: #856404;
    }

    /* Progress Bar */
    .progress {
        height: 8px;
        border-radius: 10px;
        background: #e0e0e0;
    }

    .progress-bar {
        border-radius: 10px;
    }

    /* Swipe Actions */
    .swipeable-item {
        position: relative;
        overflow: hidden;
    }

    .swipe-actions {
        position: absolute;
        right: 0;
        top: 0;
        bottom: 0;
        display: flex;
        align-items: center;
        padding: 0 1rem;
        background: #dc3545;
        color: white;
        transform: translateX(100%);
        transition: transform 0.3s;
    }

    /* Floating Action Button */
    .fab {
        position: fixed;
        bottom: 100px;
        left: 50%;
        transform: translateX(-50%);
        width: 56px;
        height: 56px;
        border-radius: 50%;
        background: linear-gradient(135deg, #1a5f5f 0%, #2d7a7a 100%);
        color: white;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 4px 12px rgba(0,0,0,0.3);
        z-index: 999;
        font-size: 1.5rem;
        text-decoration: none;
    }

    /* Hide desktop elements */
    .navbar {
        display: none !important;
    }

    .footer {
        display: none !important;
    }

    /* Hide desktop page headers */
    .page-header.d-none.d-md-block {
        display: none !important;
    }

    /* Ensure app header is visible */
    .app-header {
        display: block !important;
    }

    /* General app styling */
    html, body {
        height: 100%;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
    }

    /* Safe area for iOS */
    .app-header {
        padding-top: env(safe-area-inset-top);
    }

    .bottom-nav {
        padding-bottom: env(safe-area-inset-bottom);
    }

    /* Smooth scrolling */
    * {
        -webkit-tap-highlight-color: transparent;
    }

    /* Better touch targets */
    .btn, .card, .list-group-item {
        min-height: 44px;
        touch-action: manipulation;
    }

    /* Pull to refresh indicator */
    .pull-to-refresh {
        text-align: center;
        padding: 1rem;
        color: #666;
    }

    /* Full width on mobile */
    .row {
        margin: 0;
    }

    .row > * {
        padding: 0.5rem;
    }

    /* Ensure all content has proper spacing */
    .container-fluid > * {
        margin-left: 0.5rem;
        margin-right: 0.5rem;
    }

    /* Cards should be full width on mobile */
    .card-modern {
        margin-left: 0.5rem;
        margin-right: 0.5rem;
    }

    /* Stat cards spacing */
    .stat-card {
        margin-left: 0.5rem;
        margin-right: 0.5rem;
    }

    /* Alerts spacing */
    .alert {
        margin-left: 0.5rem;
        margin-right: 0.5rem;
    }

    /* Tables should scroll horizontally */
    .table-responsive {
        margin-left: 0.5rem;
        margin-right: 0.5rem;
    }

    /* Forms spacing */
    form {
        margin-left: 0.5rem;
        margin-right: 0.5rem;
    }

    /* Lists spacing */
    .list-group {
        margin-left: 0.5rem;
        margin-right: 0.5rem;
    }

    /* Better spacing for quick actions */
    .quick-actions {
        margin: 0;
        padding: 1rem;
    }

    /* Ensure proper z-index stacking */
    .app-header {
        z-index: 1000;
    }

    .bottom-nav {
        z-index: 1000;
    }

    .fab {
        z-index: 999;
    }

    /* Prevent text selection on buttons */
    .btn, .bottom-nav-item, .quick-action-btn {
        user-select: none;
        -webkit-user-select: none;
    }

    /* Loading states */
    .loading {
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 2rem;
    }

    .spinner {
        width: 40px;
        height: 40px;
        border: 4px solid #f3f3f3;
        border-top: 4px solid #1a5f5f;
        border-radius: 50%;
        animation: spin 1s linear infinite;
    }

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

    /* Table responsive */
    .table-responsive {
        border-radius: 12px;
        overflow: hidden;
    }

    .table {
        margin: 0;
    }

    /* Modal full screen on mobile */
    .modal-dialog {
        margin: 0;
        max-width: 100%;
        height: 100%;
    }

    .modal-content {
        height: 100%;
        border-radius: 0;
    }

    /* Search bar */
    .search-bar {
        background: white;
        padding: 1rem;
        margin-bottom: 1rem;
        border-radius: 0;
    }

    .search-box {
        border-radius: 25px;
        padding: 0.75rem 1.5rem;
    }
}

/* Student card and card-modern on desktop (Teacher area) */
@media (min-width: 769px) {
    .student-card {
        border: 1px solid #dee2e6;
        border-radius: 12px;
        background: #fff;
        padding: 1rem;
        display: flex;
        align-items: center;
        gap: 1rem;
        box-shadow: 0 2px 6px rgba(0,0,0,0.06);
    }
    .card-modern {
        border-radius: 12px;
        box-shadow: 0 2px 6px rgba(0,0,0,0.06);
    }
}

/* Tablet adjustments */
@media (min-width: 769px) and (max-width: 1024px) {
    .quick-actions {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Animation for mobile */
@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.mobile-slide-up {
    animation: slideUp 0.3s ease-out;
}

