/* Mobile Responsiveness Fixes */

/* ==========================================
   Table Responsiveness
   ========================================== */

.table-responsive-mobile {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    position: relative;
}

.table-responsive-mobile::after {
    content: '→ Scroll horizontally to see more';
    position: absolute;
    bottom: 0;
    right: 0;
    background: rgba(0, 123, 255, 0.1);
    color: #0d6efd;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    border-radius: 0.25rem 0 0.375rem 0;
    display: none;
}

@media (max-width: 768px) {
    .table-responsive-mobile::after {
        display: block;
    }
    
    .table-responsive-mobile td,
    .table-responsive-mobile th {
        min-width: 120px;
        white-space: nowrap;
        padding: 0.5rem 0.25rem;
    }
    
    .table-responsive-mobile .btn {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }
}

/* ==========================================
   Modal Mobile Optimization
   ========================================== */

@media (max-width: 576px) {
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
        max-height: calc(100vh - 1rem);
        display: flex;
        align-items: center;
    }
    
    .modal-content {
        max-height: calc(100vh - 2rem);
        overflow-y: auto;
    }
    
    .modal-body {
        max-height: calc(100vh - 200px);
        overflow-y: auto;
        padding: 1rem;
    }
    
    .modal-header {
        padding: 0.75rem 1rem;
        flex-shrink: 0;
    }
    
    .modal-footer {
        padding: 0.75rem 1rem;
        flex-shrink: 0;
    }
    
    /* Session timeout modal specific */
    #sessionTimeoutModal .modal-dialog {
        align-items: flex-start;
        margin-top: 2rem;
    }
}

/* ==========================================
   Touch-Friendly Elements
   ========================================== */

@media (max-width: 768px) {
    .btn, .nav-link, .dropdown-item {
        min-height: 44px;
        padding: 0.5rem 1rem;
        display: flex;
        align-items: center;
        line-height: 1.2;
    }
    
    .btn-sm {
        min-height: 36px;
        padding: 0.375rem 0.9rem;
    }
    
    .btn-xs {
        min-height: 32px;
        padding: 0.25rem 0.5rem;
        font-size: 0.9rem;
    }
    
    /* Dropdown improvements */
    .dropdown-menu {
        min-width: 200px;
        box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    }
    
    .dropdown-item {
        padding: 0.75rem 1rem;
        font-size: 1rem;
    }
    
    /* Navigation improvements */
    .navbar-nav .nav-link {
        padding: 0.75rem 1rem;
    }
    
    .navbar-toggler {
        padding: 0.5rem;
        font-size: 1.25rem;
    }
}

/* ==========================================
   Form Improvements
   ========================================== */

@media (max-width: 768px) {
    .form-control, .form-select {
        min-height: 44px;
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 0.75rem;
    }
    
    .form-check-input {
        transform: scale(1.2);
        margin-right: 0.75rem;
    }
    
    .form-check-label {
        margin-left: 0.25rem;
        font-size: 1rem;
        line-height: 1.5;
    }
    
    /* File input styling */
    .form-control[type="file"] {
        padding: 0.5rem;
    }
    
    /* Form validation feedback */
    .invalid-feedback, .valid-feedback {
        font-size: 0.875rem;
        margin-top: 0.25rem;
    }
}

/* ==========================================
   Card and Content Adjustments
   ========================================== */

@media (max-width: 768px) {
    .card {
        margin-bottom: 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .card-header {
        padding: 0.75rem 1rem;
    }
    
    .card-footer {
        padding: 0.75rem 1rem;
    }
    
    /* Container padding adjustments */
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    /* Alert improvements */
    .alert {
        margin-bottom: 1rem;
        padding: 1rem;
        font-size: 0.9rem;
    }
    
    .alert .btn-close {
        padding: 0.75rem;
    }
}

/* ==========================================
   Typography and Spacing
   ========================================== */

@media (max-width: 768px) {
    h1, .h1 { font-size: 1.75rem; }
    h2, .h2 { font-size: 1.5rem; }
    h3, .h3 { font-size: 1.25rem; }
    h4, .h4 { font-size: 1.1rem; }
    h5, .h5 { font-size: 1rem; }
    h6, .h6 { font-size: 0.9rem; }
    
    .display-6 { font-size: 1.5rem; }
    
    /* Spacing adjustments */
    .py-4 { padding-top: 1.5rem !important; padding-bottom: 1.5rem !important; }
    .py-3 { padding-top: 1rem !important; padding-bottom: 1rem !important; }
    .my-4 { margin-top: 1.5rem !important; margin-bottom: 1.5rem !important; }
    .my-3 { margin-top: 1rem !important; margin-bottom: 1rem !important; }
}

/* ==========================================
   Avatar and Image Improvements
   ========================================== */

@media (max-width: 768px) {
    .avatar-sm {
        width: 32px;
        height: 32px;
        object-fit: cover;
        border-radius: 50%;
    }
    
    .avatar-md {
        width: 48px;
        height: 48px;
        object-fit: cover;
        border-radius: 50%;
    }
    
    /* Logo adjustments */
    .navbar-brand img {
        max-height: 40px;
        width: auto;
    }
}

/* ==========================================
   Badge and Status Improvements
   ========================================== */

@media (max-width: 768px) {
    .badge {
        font-size: 0.75rem;
        padding: 0.375rem 0.5rem;
    }
    
    .badge.bg-info.text-dark,
    .badge.bg-warning.text-dark {
        color: #000 !important;
    }
}

/* ==========================================
   Loading and Progress Indicators
   ========================================== */

.progress-mobile {
    height: 8px;
    border-radius: 4px;
    background-color: #e9ecef;
    overflow: hidden;
}

.progress-mobile .progress-bar {
    transition: width 0.3s ease;
    background-color: #0d6efd;
}

@media (max-width: 768px) {
    .spinner-border-sm {
        width: 1.5rem;
        height: 1.5rem;
    }
    
    .loading-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(255, 255, 255, 0.9);
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 9999;
    }
}

/* ==========================================
   Utility Classes for Mobile
   ========================================== */

@media (max-width: 768px) {
    .d-mobile-none { display: none !important; }
    .d-mobile-block { display: block !important; }
    .d-mobile-flex { display: flex !important; }
    
    .text-mobile-center { text-align: center !important; }
    .text-mobile-left { text-align: left !important; }
    
    .w-mobile-100 { width: 100% !important; }
    .h-mobile-auto { height: auto !important; }
}

/* ==========================================
   Enhanced Alert Animations
   ========================================== */

.alert-enhanced {
    position: relative;
    overflow: hidden;
    border-left: 4px solid;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border-radius: 0.5rem;
}

.alert-enhanced.alert-success {
    border-left-color: #198754;
}

.alert-enhanced.alert-danger {
    border-left-color: #dc3545;
}

.alert-enhanced.alert-warning {
    border-left-color: #ffc107;
}

.alert-enhanced.alert-info {
    border-left-color: #0dcaf0;
}

.alert-enhanced.alert-primary {
    border-left-color: #0d6efd;
}

.alert-enhanced .alert-content {
    display: flex;
    align-items: center;
    line-height: 1.5;
}

.alert-enhanced .alert-content i {
    flex-shrink: 0;
    font-size: 1.1em;
    margin-right: 0.5rem;
}

/* Animation for alert appearance */
.alert-enhanced {
    animation: slideInDown 0.3s ease-out;
}

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

/* Responsive adjustments for alerts */
@media (max-width: 576px) {
    .alert-enhanced {
        margin: 0.5rem;
        font-size: 0.9rem;
    }
    
    .alert-enhanced .alert-content i {
        font-size: 1em;
        margin-right: 0.375rem;
    }
}

/* ==========================================
   Accessibility Improvements
   ========================================== */

@media (prefers-reduced-motion: reduce) {
    .alert-enhanced {
        transition: none !important;
    }
    
    .progress-mobile .progress-bar {
        transition: none !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .alert-enhanced {
        border-width: 2px;
        border-style: solid;
    }
    
    .table-responsive-mobile {
        border-width: 2px;
    }
}

/* Focus improvements for keyboard navigation */
.btn:focus,
.form-control:focus,
.form-select:focus {
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
    border-color: #86b7fe;
}

@media (max-width: 768px) {
    .btn:focus,
    .form-control:focus,
    .form-select:focus {
        box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.5);
    }
} 