/* ===================================
   MOBILE RESPONSIVE FRAMEWORK
   =================================== */

/* Base mobile-first approach */
* {
    box-sizing: border-box;
}

/* Mobile Grid System */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -10px;
}

.col {
    padding: 0 10px;
    flex: 1;
}

/* Column classes */
.col-1 { flex: 0 0 8.333%; }
.col-2 { flex: 0 0 16.666%; }
.col-3 { flex: 0 0 25%; }
.col-4 { flex: 0 0 33.333%; }
.col-5 { flex: 0 0 41.666%; }
.col-6 { flex: 0 0 50%; }
.col-7 { flex: 0 0 58.333%; }
.col-8 { flex: 0 0 66.666%; }
.col-9 { flex: 0 0 75%; }
.col-10 { flex: 0 0 83.333%; }
.col-11 { flex: 0 0 91.666%; }
.col-12 { flex: 0 0 100%; }

/* Mobile Navigation */
.mobile-menu-toggle {
    display: none;
    background: #C9A23F;
    color: #1A1A1A;
    border: none;
    padding: 12px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 18px;
    margin: 10px;
}

.mobile-menu {
    display: none;
    position: fixed;
    top: 0;
    left: -100%;
    width: 280px;
    height: 100vh;
    background: #1A1A1A;
    z-index: 9999;
    transition: left 0.3s ease;
    overflow-y: auto;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
}

.mobile-menu.active {
    left: 0;
}

.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
}

.mobile-menu-overlay.active {
    display: block;
}

/* Mobile Tables */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.mobile-table {
    width: 100%;
    min-width: 600px; /* Minimum width for horizontal scroll */
}

/* Mobile Cards (alternative to tables) */
.mobile-card {
    background: #2A2A2A;
    border: 1px solid #444;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.mobile-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #444;
}

.mobile-card-title {
    font-weight: 600;
    color: #F9F5E6;
    font-size: 16px;
}

.mobile-card-actions {
    display: flex;
    gap: 8px;
}

.mobile-card-body {
    color: #ccc;
    line-height: 1.5;
}

.mobile-card-footer {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid #444;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Mobile Forms */
.mobile-form {
    width: 100%;
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 5px;
    color: #F9F5E6;
    font-weight: 500;
    font-size: 14px;
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #444;
    border-radius: 6px;
    background: #333;
    color: #F9F5E6;
    font-size: 16px; /* Prevents zoom on iOS */
    transition: border-color 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: #C9A23F;
    box-shadow: 0 0 0 2px rgba(201, 162, 63, 0.2);
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 20px;
    padding-right: 40px;
}

.form-row {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.form-col {
    flex: 1;
    min-width: 200px;
}

/* Mobile Buttons */
.btn {
    display: inline-block;
    padding: 12px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    transition: all 0.3s ease;
    min-height: 44px; /* Touch-friendly */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-primary {
    background: #C9A23F;
    color: #1A1A1A;
}

.btn-primary:hover {
    background: #B89136;
    transform: translateY(-1px);
}

.btn-secondary {
    background: #444;
    color: #F9F5E6;
}

.btn-secondary:hover {
    background: #555;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
}

.btn-sm {
    padding: 8px 15px;
    font-size: 12px;
    min-height: 36px;
}

.btn-lg {
    padding: 15px 25px;
    font-size: 16px;
    min-height: 52px;
}

.btn-block {
    width: 100%;
    display: block;
}

/* Mobile Dashboard */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.stat-card {
    background: linear-gradient(135deg, #2A2A2A, #333);
    border: 1px solid #444;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 15px;
    font-size: 24px;
    color: white;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #F9F5E6;
    margin-bottom: 5px;
}

.stat-label {
    color: #ccc;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Mobile Alerts */
.alert {
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    border-left: 4px solid;
    font-size: 14px;
    line-height: 1.5;
}

.alert-success {
    background: rgba(40, 167, 69, 0.1);
    border-left-color: #28a745;
    color: #28a745;
}

.alert-warning {
    background: rgba(255, 193, 7, 0.1);
    border-left-color: #ffc107;
    color: #ffc107;
}

.alert-error {
    background: rgba(220, 53, 69, 0.1);
    border-left-color: #dc3545;
    color: #dc3545;
}

.alert-info {
    background: rgba(23, 162, 184, 0.1);
    border-left-color: #17a2b8;
    color: #17a2b8;
}

/* ===================================
   TABLET AND UP (768px and above)
   =================================== */
@media (min-width: 768px) {
    .container {
        padding: 0 20px;
    }
    
    .mobile-menu-toggle {
        display: none;
    }
    
    .mobile-menu {
        display: none !important;
    }
    
    .mobile-menu-overlay {
        display: none !important;
    }
    
    .form-row {
        flex-wrap: nowrap;
    }
    
    .dashboard-stats {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: 20px;
    }
    
    .stat-card {
        padding: 25px;
    }
}

/* ===================================
   DESKTOP (1024px and above)
   =================================== */
@media (min-width: 1024px) {
    .dashboard-stats {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .mobile-card {
        display: none; /* Hide mobile cards on desktop, show tables */
    }
    
    .table-responsive {
        overflow-x: visible;
    }
    
    .mobile-table {
        min-width: auto;
    }
}

/* ===================================
   LARGE DESKTOP (1200px and above)
   =================================== */
@media (min-width: 1200px) {
    .container {
        padding: 0 25px;
    }
}

/* ===================================
   MOBILE SPECIFIC (767px and below)
   =================================== */
@media (max-width: 767px) {
    .container {
        padding: 0 10px;
    }
    
    .mobile-menu-toggle {
        display: block;
    }
    
    /* Hide desktop navigation */
    .desktop-nav {
        display: none;
    }
    
    /* Stack columns */
    .row {
        flex-direction: column;
        margin: 0;
    }
    
    .col {
        padding: 0;
        margin-bottom: 15px;
        flex: 1 1 100%;
    }
    
    .col-1, .col-2, .col-3, .col-4, .col-5, .col-6,
    .col-7, .col-8, .col-9, .col-10, .col-11, .col-12 {
        flex: 1 1 100%;
    }
    
    /* Mobile form adjustments */
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .form-col {
        min-width: auto;
        margin-bottom: 15px;
    }
    
    /* Mobile button adjustments */
    .btn {
        font-size: 16px; /* Prevents zoom */
        padding: 14px 20px;
    }
    
    /* Mobile dashboard */
    .dashboard-stats {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .stat-card {
        padding: 20px 15px;
    }
    
    .stat-value {
        font-size: 24px;
    }
    
    /* Mobile table to cards */
    .desktop-table {
        display: none;
    }
    
    .mobile-card {
        display: block;
    }
}

/* ===================================
   SMALL MOBILE (480px and below)
   =================================== */
@media (max-width: 480px) {
    .container {
        padding: 0 5px;
    }
    
    .stat-card {
        padding: 15px 10px;
    }
    
    .stat-icon {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
    
    .stat-value {
        font-size: 20px;
    }
    
    .stat-label {
        font-size: 12px;
    }
    
    .btn {
        padding: 12px 15px;
        font-size: 14px;
    }
    
    .form-control {
        padding: 10px 12px;
        font-size: 16px;
    }
    
    .alert {
        padding: 12px;
        font-size: 13px;
    }
}

/* ===================================
   TOUCH DEVICE OPTIMIZATIONS
   =================================== */
@media (hover: none) and (pointer: coarse) {
    .btn:hover {
        transform: none;
    }
    
    .stat-card:hover {
        transform: none;
    }
    
    .notification-bell:hover {
        transform: none;
    }
}

/* ===================================
   ACCESSIBILITY
   =================================== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===================================
   DARK MODE SUPPORT
   =================================== */
@media (prefers-color-scheme: dark) {
    /* Already using dark theme, but ensure consistency */
    .form-control {
        background: #2A2A2A;
        color: #F9F5E6;
    }
    
    .mobile-card {
        background: #2A2A2A;
        border-color: #444;
    }
}
