/**
 * Time Attendance System - Styles
 * Mobile-first Responsive Design
 */

/* ===== Container ===== */
.attendance-container,
.attendance-admin-container {
    max-width: 100%;
    padding: 1rem;
    margin: 0 auto;
}

@media (min-width: 768px) {
    .attendance-container {
        max-width: 600px;
    }
    .attendance-admin-container {
        max-width: 1200px;
    }
}

/* ===== Header ===== */
.attendance-header,
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.page-header {
    flex-wrap: wrap;
    gap: 1rem;
}

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

/* ===== User Info Card ===== */
.user-info-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-avatar {
    font-size: 3rem;
    color: #4a90e2;
}

.user-details h3 {
    margin: 0 0 0.25rem 0;
    font-size: 1.25rem;
}

.user-details p {
    margin: 0;
    font-size: 0.9rem;
}

/* ===== Status Card ===== */
.status-card {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.status-checked-in {
    border-left: 5px solid #28a745;
}

.status-not-checked {
    border-left: 5px solid #6c757d;
}

.status-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.status-checked-in .status-icon {
    color: #28a745;
}

.status-not-checked .status-icon {
    color: #6c757d;
}

.status-text h4 {
    margin: 0 0 0.5rem 0;
    font-size: 1.5rem;
}

.status-text p {
    margin: 0.25rem 0;
    font-size: 0.95rem;
}

/* ===== Current Time Card ===== */
.current-time-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    text-align: center;
    font-size: 1.1rem;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.current-time-card i {
    margin-right: 0.5rem;
}

/* ===== GPS Status ===== */
.gps-status {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    text-align: center;
    font-weight: 500;
}

.gps-status.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.gps-status.warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.gps-status i {
    margin-right: 0.5rem;
}

/* ===== Action Buttons ===== */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1rem;
}

.btn-large {
    padding: 1.25rem 2rem;
    font-size: 1.25rem;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.btn-checkin {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.4);
}

.btn-checkin:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.5);
}

.btn-checkout {
    background: linear-gradient(135deg, #dc3545 0%, #e83e8c 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.4);
}

.btn-checkout:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(220, 53, 69, 0.5);
}

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

.quick-actions .btn {
    flex: 1;
}

/* ===== Photo Capture Modal ===== */
.photo-capture-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 1rem;
}

.photo-capture-modal .modal-content {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    max-width: 500px;
    width: 100%;
}

.photo-capture-modal h3 {
    margin: 0 0 1rem 0;
    text-align: center;
}

#cameraVideo {
    width: 100%;
    border-radius: 8px;
    margin-bottom: 1rem;
}

#capturedPreview img {
    width: 100%;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.camera-controls,
.preview-controls {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

/* ===== History Modal ===== */
.history-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 1rem;
}

.history-modal .modal-content {
    background: white;
    border-radius: 12px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

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

.modal-header h3 {
    margin: 0;
}

.btn-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #6c757d;
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.history-item {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
}

.history-date {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #495057;
}

.history-times {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}

.time-in {
    color: #28a745;
}

.time-out {
    color: #dc3545;
}

.history-hours {
    font-size: 0.9rem;
    color: #6c757d;
}

/* ===== Admin Tabs ===== */
.admin-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #dee2e6;
    overflow-x: auto;
}

/* .tab-btn styles handled by Tailwind utilities in JS — legacy color rules removed
   (they were overriding text-white with #4a90e2 blue due to CSS specificity) */

.tab-pane {
    animation: fadeIn 0.3s ease;
}

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

/* ===== Monitor Controls ===== */
.monitor-controls {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.date-selector {
    margin-bottom: 1rem;
}

.date-selector label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.date-selector input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ced4da;
    border-radius: 4px;
}

.monitor-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.attendance-container .stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.attendance-container .stat-card i {
    font-size: 2rem;
}

.attendance-container .stat-label {
    display: block;
    font-size: 0.85rem;
    opacity: 0.9;
}

.attendance-container .stat-value {
    display: block;
    font-size: 1.75rem;
    font-weight: 700;
}

/* ===== Records Table ===== */
.records-table-container {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow-x: auto;
}

.records-table {
    width: 100%;
    border-collapse: collapse;
}

.records-table th {
    background: #f8f9fa;
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid #dee2e6;
}

.records-table td {
    padding: 0.75rem;
    border-bottom: 1px solid #dee2e6;
}

.user-cell {
    display: flex;
    flex-direction: column;
}

.user-cell small {
    color: #6c757d;
    font-size: 0.85rem;
}

.photo-link {
    display: inline-block;
    margin-left: 0.5rem;
    color: #4a90e2;
}

/* ===== Locations Grid ===== */
.locations-header {
    margin-bottom: 1.5rem;
}

.locations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.location-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

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

.location-header h4 {
    margin: 0;
}

.location-details {
    margin-bottom: 1rem;
}

.location-details p {
    margin: 0.25rem 0;
    font-size: 0.9rem;
    color: #6c757d;
}

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

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #6c757d;
}

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

/* ===== Loading Spinner ===== */
.loading-spinner {
    text-align: center;
    padding: 2rem;
    color: #6c757d;
}

.loading-spinner i {
    font-size: 2rem;
}

/* ===== Badges ===== */
.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
}

.badge-success {
    background: #d4edda;
    color: #155724;
}

.badge-warning {
    background: #fff3cd;
    color: #856404;
}

.badge-secondary {
    background: #e2e3e5;
    color: #383d41;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .monitor-stats {
        grid-template-columns: 1fr;
    }

    .records-table {
        font-size: 0.85rem;
    }

    .records-table th,
    .records-table td {
        padding: 0.5rem;
    }

    .locations-grid {
        grid-template-columns: 1fr;
    }

    .action-buttons {
        gap: 0.75rem;
    }

    .btn-large {
        font-size: 1.1rem;
        padding: 1rem 1.5rem;
    }
}

/* ===== Utilities ===== */
.text-muted {
    color: #6c757d;
}

.text-center {
    text-align: center;
}

.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-primary {
    background: #4a90e2;
    color: white;
}

.btn-primary:hover {
    background: #357abd;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}
