/* Admin Mobile Styles */
/* Load this file AFTER styles.css to ensure proper overrides */

/* Main Container */
.admin-dashboard {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 60px); /* Account for header */
    height: calc(100vh - 60px - env(safe-area-inset-bottom)); /* iOS safe area */
    overflow: hidden;
    position: relative;
}

.admin-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    max-height: 100%;
}

/* Navigation */
.admin-nav-mobile {
    display: flex;
    gap: 8px;
    padding: 12px;
    background: var(--white-primary);
    border-bottom: 1px solid var(--system-gray-2);
    flex-shrink: 0;
}

.admin-nav-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 8px;
    background: var(--system-gray-1);
    color: var(--system-gray-5);
    border: none;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.admin-nav-btn.active {
    background: var(--blue-primary);
    color: var(--white-primary);
}

.admin-nav-btn:active {
    transform: scale(0.95);
}

.nav-icon {
    font-size: 20px;
}

.nav-label {
    font-size: 11px;
}

/* Search and Filter */
.admin-search-bar {
    display: flex;
    gap: 8px;
    padding: 12px;
    background: var(--white-primary);
    border-bottom: 1px solid var(--system-gray-2);
    flex-shrink: 0;
}

.search-input {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid var(--system-gray-3);
    border-radius: 10px;
    font-size: 16px;
    background: var(--white-primary) !important;
    background-color: var(--white-primary) !important;
    color: var(--black-primary) !important;
    -webkit-appearance: none;
    appearance: none;
}

.search-input:focus {
    background: var(--white-primary) !important;
    background-color: var(--white-primary) !important;
    border-color: var(--blue-primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

.filter-btn {
    padding: 10px 14px;
    background: var(--white-primary);
    border: 1px solid var(--system-gray-3);
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--system-gray-5);
    transition: all 0.2s ease;
}

.filter-btn:active {
    background: var(--system-gray-1);
    transform: scale(0.95);
}

.filter-btn.active {
    background: var(--blue-primary);
    color: var(--white-primary);
    border-color: var(--blue-primary);
}

.filter-panel {
    padding: 16px;
    background: var(--white-primary);
    border-bottom: 1px solid var(--system-gray-3);
    flex-shrink: 0;
}

.filter-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.filter-row label {
    min-width: 80px;
    font-size: 14px;
    color: var(--system-gray-5);
}

.filter-date-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--system-gray-3);
    border-radius: 8px;
    font-size: 14px;
    background: var(--white-primary) !important;
    background-color: var(--white-primary) !important;
    color: var(--black-primary) !important;
    -webkit-appearance: none;
    appearance: none;
}

.filter-date-input:focus {
    background: var(--white-primary) !important;
    background-color: var(--white-primary) !important;
    border-color: var(--blue-primary);
    outline: none;
}

.filter-apply-btn {
    width: 100%;
    padding: 12px;
    background: var(--blue-primary);
    color: var(--white-primary);
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}

/* Content Area */
.admin-content-mobile {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 12px;
    padding-bottom: 80px;
}

.cards-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Data Cards */
.data-card {
    background: var(--white-primary);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: transform 0.2s ease;
}

.data-card:active {
    transform: scale(0.98);
}

.data-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    cursor: pointer;
    background: var(--white-primary);
}

.card-main-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.card-room {
    font-size: 16px;
    font-weight: 600;
    color: var(--black-primary);
}

.card-date {
    font-size: 13px;
    color: var(--system-gray-4);
}

.expand-arrow {
    color: var(--system-gray-4);
    transition: transform 0.3s ease;
}

.card-quick-info {
    display: flex;
    gap: 16px;
    padding: 0 16px 14px;
    background: var(--white-primary);
}

.quick-stat {
    font-size: 14px;
    color: var(--black-primary);
}

.stat-label {
    color: var(--system-gray-4);
    font-weight: 500;
}

.card-details {
    padding: 16px;
    background: #f8f8f8;
    border-top: 1px solid var(--system-gray-2);
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 8px 0;
    font-size: 14px;
    gap: 12px;
    color: var(--black-primary);
}

.detail-row span:last-child {
    flex: 1;
    text-align: right;
    word-break: break-word;
    color: var(--black-primary);
}

.detail-label {
    color: var(--system-gray-5);
    font-weight: 500;
    flex-shrink: 0;
}

.value-highlight {
    font-weight: 600;
    color: var(--blue-primary);
}

/* Ensure all text in cards is readable */
.data-card,
.data-card * {
    color: var(--black-primary);
}

/* Force all admin inputs to have white background */
.admin-dashboard input[type="text"],
.admin-dashboard input[type="date"],
.admin-dashboard input[type="password"],
.admin-dashboard input[type="number"],
.admin-dashboard select,
.admin-dashboard textarea {
    background: var(--white-primary) !important;
    background-color: var(--white-primary) !important;
    color: var(--black-primary) !important;
    -webkit-text-fill-color: var(--black-primary) !important;
}

.admin-dashboard input:focus,
.admin-dashboard select:focus,
.admin-dashboard textarea:focus {
    background: var(--white-primary) !important;
    background-color: var(--white-primary) !important;
    color: var(--black-primary) !important;
    -webkit-text-fill-color: var(--black-primary) !important;
}

/* Specific overrides for autofill */
.admin-dashboard input:-webkit-autofill,
.admin-dashboard input:-webkit-autofill:hover,
.admin-dashboard input:-webkit-autofill:focus,
.admin-dashboard input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px var(--white-primary) inset !important;
    -webkit-text-fill-color: var(--black-primary) !important;
    box-shadow: 0 0 0 30px var(--white-primary) inset !important;
}

.data-card .detail-label {
    color: var(--system-gray-5);
}

.data-card .card-date {
    color: var(--system-gray-4);
}

/* User Cards */
.user-card {
    padding: 16px;
}

.card-header-simple {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.card-title h3 {
    font-size: 18px;
    margin: 0 0 4px 0;
    color: var(--black-primary);
}

.card-subtitle {
    font-size: 14px;
    color: var(--system-gray-4);
}

.role-badge {
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.role-badge.admin {
    background: var(--red-destructive);
    color: var(--white-primary);
}

.role-badge.user {
    background: var(--green-confirm);
    color: var(--white-primary);
}

.card-info {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    font-size: 14px;
}

.info-label {
    color: var(--system-gray-5);
}

/* Card Actions */
.card-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.card-action-btn {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.card-action-btn.edit {
    background: var(--blue-primary);
    color: var(--white-primary);
}

.card-action-btn.delete {
    background: var(--system-gray-2);
    color: var(--system-gray-5);
}

.card-action-btn:active {
    transform: scale(0.95);
}

/* Load More Button */
.load-more-btn {
    width: 100%;
    padding: 14px;
    margin-top: 16px;
    background: var(--system-gray-1);
    color: var(--blue-primary);
    border: 2px solid var(--system-gray-2);
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}

.load-more-btn:active {
    background: var(--system-gray-2);
}

/* Floating Add Button */
.floating-add-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    background: var(--green-confirm);
    color: var(--white-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    z-index: 100;
    transition: transform 0.2s ease;
}

.floating-add-btn:active {
    transform: scale(0.9);
}

/* Modal Adjustments */
.modal-mobile {
    width: 90%;
    max-width: 400px;
    max-height: 85vh;
    border-radius: 16px;
    overflow: hidden;
}

.modal-title {
    font-size: 20px;
    margin: 0 0 20px 0;
    color: var(--black-primary);
}

.modal-form {
    max-height: calc(85vh - 160px);
    overflow-y: auto;
    padding-right: 8px;
}

.modal-scrollable {
    scrollbar-width: thin;
    scrollbar-color: var(--system-gray-3) transparent;
}

.modal-scrollable::-webkit-scrollbar {
    width: 6px;
}

.modal-scrollable::-webkit-scrollbar-track {
    background: transparent;
}

.modal-scrollable::-webkit-scrollbar-thumb {
    background: var(--system-gray-3);
    border-radius: 3px;
}

.modal-message {
    font-size: 16px;
    line-height: 1.5;
    color: var(--system-gray-5);
    margin-bottom: 24px;
}

.zones-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* Error Card */
.error-card {
    padding: 24px;
    text-align: center;
    color: var(--red-destructive);
}

.error-card p {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 8px 0;
}

.error-card small {
    font-size: 14px;
    color: var(--system-gray-5);
}

/* No Results Card */
.no-results-card {
    padding: 48px 24px;
    text-align: center;
    color: var(--system-gray-5);
    background: var(--white-primary);
    border-radius: 12px;
    margin: 24px 0;
}

.no-results-card p {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 8px 0;
    color: var(--system-gray-5);
}

.no-results-card small {
    font-size: 14px;
    color: var(--system-gray-4);
}

/* Responsive adjustments */
@media (max-width: 375px) {
    .admin-nav-btn {
        padding: 8px 6px;
    }
    
    .nav-icon {
        font-size: 18px;
    }
    
    .nav-label {
        font-size: 10px;
    }
    
    .floating-add-btn {
        width: 48px;
        height: 48px;
        bottom: 20px;
        right: 20px;
    }
}

/* Portrait mode adjustments */
@media (orientation: portrait) {
    .admin-dashboard {
        height: calc(100vh - 60px);
        height: calc(100vh - 60px - env(safe-area-inset-bottom));
    }
    
    .admin-container {
        height: 100%;
    }
    
    /* Ensure search bar doesn't overlap navigation */
    .admin-search-bar {
        position: relative;
        top: 0;
    }
}

/* Landscape adjustments */
@media (orientation: landscape) {
    .admin-dashboard {
        height: calc(100vh - 50px);
        height: calc(100vh - 50px - env(safe-area-inset-bottom));
    }
    
    .admin-nav-mobile {
        padding: 8px 12px;
    }
    
    .admin-nav-btn {
        padding: 8px 10px;
    }
    
    /* Compact mode for very short landscapes */
    @media (max-height: 500px) {
        .admin-nav-btn {
            padding: 6px 8px;
        }
        
        .nav-icon {
            font-size: 16px;
        }
        
        .nav-label {
            display: none;
        }
        
        .admin-search-bar {
            padding: 8px 12px;
        }
        
        .cards-container {
            gap: 8px;
        }
        
        .data-card {
            margin-bottom: 4px;
        }
    }
    
    .modal-mobile {
        max-height: 95vh;
    }
    
    .modal-form {
        max-height: calc(95vh - 140px);
    }
}

/* Hide old table styles on mobile */
@media (max-width: 768px) {
    .data-table {
        display: none;
    }
    
    .admin-nav {
        display: none;
    }
}

/* CRITICAL: Final overrides to ensure inputs are never black */
input.search-input,
input.filter-date-input,
.admin-dashboard input,
.admin-dashboard select,
.admin-dashboard textarea {
    background: white !important;
    background-color: white !important;
    color: black !important;
    -webkit-text-fill-color: black !important;
    opacity: 1 !important;
}

/* Handle iOS/Safari specific input styling */
@supports (-webkit-touch-callout: none) {
    .search-input,
    .filter-date-input,
    .admin-dashboard input,
    .admin-dashboard select {
        background: white !important;
        background-color: white !important;
        -webkit-appearance: none !important;
        appearance: none !important;
    }
}

/* Dark mode support - removed to prevent black background issues */
/* Users can enable dark mode through system settings if needed */