/* Visitor & Staff Attendance System - Main CSS */

/* ============================================
   General Styles
   ============================================ */

:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    min-height: 100vh;
    margin: 0;
}

#form1 {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

footer {
    margin-top: auto;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

/* ============================================
   Navigation
   ============================================ */

.navbar-brand {
    font-weight: 600;
    font-size: 1.5rem;
}

.navbar-dark .navbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.8);
    transition: color 0.3s ease;
}

.navbar-dark .navbar-nav .nav-link:hover {
    color: rgba(255, 255, 255, 1);
}

/* ============================================
   Cards & Panels
   ============================================ */

.card {
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    margin-bottom: 20px;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.card-header {
    background-color: var(--primary-color);
    color: white;
    border-bottom: none;
    font-weight: 600;
}

.card-body {
    padding: 1.5rem;
}

/* ============================================
   Buttons
   ============================================ */

.btn {
    border-radius: 4px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: #0056b3;
    border-color: #0056b3;
}

.btn-success {
    background-color: var(--success-color);
    border-color: var(--success-color);
}

.btn-success:hover {
    background-color: #218838;
    border-color: #218838;
}

.btn-danger {
    background-color: var(--danger-color);
    border-color: var(--danger-color);
}

.btn-danger:hover {
    background-color: #c82333;
    border-color: #c82333;
}

.btn-lg {
    padding: 12px 30px;
    font-size: 1.1rem;
}

/* ============================================
   Forms
   ============================================ */

.form-group {
    margin-bottom: 1.5rem;
}

.form-control {
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 0.75rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.form-control.is-invalid {
    border-color: var(--danger-color);
}

.invalid-feedback {
    display: block;
    color: var(--danger-color);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

label {
    font-weight: 500;
    margin-bottom: 0.5rem;
}

/* ============================================
   Tables
   ============================================ */

.table {
    background-color: white;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
}

.table thead th {
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    color: #333;
}

.table tbody td {
    vertical-align: middle;
    border-bottom: 1px solid #dee2e6;
}

.table-hover tbody tr:hover {
    background-color: #f5f5f5;
}

/* ============================================
   Alerts
   ============================================ */

.alert {
    border: none;
    border-radius: 4px;
    margin-bottom: 1.5rem;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border-left: 4px solid var(--success-color);
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
    border-left: 4px solid var(--danger-color);
}

.alert-warning {
    background-color: #fff3cd;
    color: #856404;
    border-left: 4px solid var(--warning-color);
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border-left: 4px solid var(--info-color);
}

/* ============================================
   Dashboard Cards
   ============================================ */

.stats-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    text-align: center;
    margin-bottom: 1.5rem;
}

.stats-card h3 {
    color: var(--primary-color);
    font-size: 2rem;
    font-weight: 700;
    margin: 0;
}

.stats-card p {
    color: #666;
    margin: 0.5rem 0 0 0;
    font-size: 0.95rem;
}

.stats-card.success h3 {
    color: var(--success-color);
}

.stats-card.danger h3 {
    color: var(--danger-color);
}

.stats-card.warning h3 {
    color: var(--warning-color);
}

.stats-card.info h3 {
    color: var(--info-color);
}

/* ============================================
   Large Action Buttons
   ============================================ */

.action-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: white;
    border: 2px solid #ddd;
    border-radius: 8px;
    text-decoration: none;
    color: #333;
    transition: all 0.3s ease;
    cursor: pointer;
    min-height: 200px;
    margin-bottom: 1.5rem;
}

.action-button:hover {
    border-color: var(--primary-color);
    background-color: #f8f9fa;
    color: var(--primary-color);
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.action-button i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.action-button h3 {
    margin: 0.5rem 0 0 0;
    font-weight: 600;
}

.action-button p {
    margin: 0.5rem 0 0 0;
    font-size: 0.9rem;
    color: #666;
}

/* ============================================
   Photo Display
   ============================================ */

.photo-display {
    width: 200px;
    height: 250px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.photo-thumbnail {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #ddd;
}

/* ============================================
   Validators
   ============================================ */

.validator-error {
    display: block;
    color: var(--danger-color);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* ============================================
   Pagination
   ============================================ */

.pagination {
    margin-top: 1.5rem;
}

.pagination a,
.pagination span {
    color: var(--primary-color);
    padding: 8px 12px;
    margin: 0 2px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-decoration: none;
}

.pagination a:hover {
    background-color: var(--primary-color);
    color: white;
}

.pagination .active span {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* ============================================
   Modal Styles
   ============================================ */

.modal-content {
    border: none;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    border-radius: 8px;
}

.modal-header {
    background-color: var(--primary-color);
    color: white;
    border-bottom: none;
    border-radius: 8px 8px 0 0;
}

.modal-header .btn-close {
    filter: brightness(0) invert(1);
}

/* ============================================
   Home Page
   ============================================ */

.home-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    text-align: center;
}

.home-time-bar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    margin-bottom: 1.5rem;
}

.home-time-bar .home-date {
    font-size: 1.05rem;
    color: #666;
}

.home-clock {
    font-size: 3.5rem;
    font-weight: 700;
    color: var(--primary-color);
    letter-spacing: 0.04em;
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}

.home-hero {
    margin-bottom: 2.5rem;
}

.home-hero i {
    font-size: 3.5rem;
    color: var(--primary-color);
    display: block;
    margin-bottom: 0.5rem;
}

.home-hero h1 {
    font-size: 1.6rem;
    font-weight: 700;
    color: #333;
    margin: 0;
}

.home-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    width: 100%;
    max-width: 640px;
    margin-bottom: 2rem;
}

.home-action-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.25rem;
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 14px;
    text-decoration: none !important;
    color: #333;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.home-action-card:hover,
.home-action-card:focus,
.home-action-card:active {
    border-color: var(--primary-color);
    box-shadow: 0 4px 16px rgba(0, 123, 255, 0.15);
    transform: translateY(-3px);
    color: #333;
}

.home-action-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: #e7f3ff;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.75rem;
    flex-shrink: 0;
}

.home-action-icon i {
    font-size: 2rem;
    color: var(--primary-color);
}

.home-action-card h2 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 0.25rem 0;
}

.home-action-card p {
    font-size: 0.85rem;
    color: #888;
    margin: 0;
}

.home-footer-link {
    margin-top: 1rem;
}

.home-footer-link a {
    color: #999;
    text-decoration: none;
    font-size: 0.9rem;
}

.home-footer-link a:hover {
    color: var(--primary-color);
}

/* iPad / tablets (768–1024px) */
@media (min-width: 768px) {
    .home-container {
        padding: 3rem 2rem;
    }

    .home-clock {
        font-size: 4.5rem;
    }

    .home-hero i {
        font-size: 4.5rem;
    }

    .home-hero h1 {
        font-size: 2rem;
    }

    .home-actions {
        max-width: 580px;
        gap: 1.5rem;
    }

    .home-action-card {
        padding: 2.5rem 1.5rem;
    }

    .home-action-icon {
        width: 84px;
        height: 84px;
    }

    .home-action-icon i {
        font-size: 2.4rem;
    }

    .home-action-card h2 {
        font-size: 1.25rem;
    }

    .home-action-card p {
        font-size: 0.9rem;
    }
}

/* Small phones (? 480px) */
@media (max-width: 480px) {
    .home-container {
        padding: 1.5rem 1rem;
        min-height: calc(100vh - 140px);
    }

    .home-clock {
        font-size: 2.5rem;
    }

    .home-hero i {
        font-size: 2.5rem;
    }

    .home-hero h1 {
        font-size: 1.3rem;
    }

    .home-actions {
        grid-template-columns: 1fr;
        max-width: 300px;
    }

    .home-action-card {
        padding: 1.5rem 1rem;
    }

    .home-action-icon {
        width: 60px;
        height: 60px;
    }

    .home-action-icon i {
        font-size: 1.6rem;
    }
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 768px) {
    .action-button {
        padding: 1.5rem;
        min-height: 150px;
    }

    .action-button i {
        font-size: 2rem;
    }

    .photo-display {
        width: 150px;
        height: 200px;
    }

    .stats-card h3 {
        font-size: 1.5rem;
    }

    .navbar-brand {
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    .card-body {
        padding: 1rem;
    }

    .btn-lg {
        padding: 10px 20px;
        font-size: 1rem;
    }

    .form-control {
        padding: 0.5rem;
    }

    .stats-card {
        padding: 1rem;
    }
}

/* ============================================
   Utility Classes
   ============================================ */

.text-muted {
    color: #6c757d;
}

.text-danger {
    color: var(--danger-color);
}

.text-success {
    color: var(--success-color);
}

.text-warning {
    color: var(--warning-color);
}

.text-info {
    color: var(--info-color);
}

.bg-light-blue {
    background-color: #e7f3ff;
}

.border-left {
    border-left: 4px solid var(--primary-color);
}

.shadow-sm {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.shadow {
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.175);
}

.cursor-pointer {
    cursor: pointer;
}

.d-flex {
    display: flex;
}

.flex-center {
    display: flex;
    justify-content: center;
    align-items: center;
}

.gap-2 {
    gap: 0.5rem;
}

.gap-3 {
    gap: 1rem;
}

/* ============================================
   Loading & Spinner
   ============================================ */

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

/* ============================================
   Badge Styles
   ============================================ */

.badge {
    padding: 0.35em 0.65em;
    border-radius: 0.25rem;
    font-weight: 600;
}

.badge-success {
    background-color: var(--success-color);
    color: white;
}

.badge-danger {
    background-color: var(--danger-color);
    color: white;
}

.badge-warning {
    background-color: var(--warning-color);
    color: #333;
}

.badge-info {
    background-color: var(--info-color);
    color: white;
}

/* ============================================
   Mobile Touch & Usability
   ============================================ */

@media (max-width: 768px) {
    /* Disable card hover lift on mobile to avoid sticky hover states */
    .card:hover {
        transform: none;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }

    /* Ensure touch-friendly input sizing (prevents iOS zoom) */
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="password"],
    input[type="number"],
    select,
    textarea,
    .form-control {
        font-size: 16px;
    }

    /* Touch-friendly tap targets */
    .btn {
        min-height: 44px;
    }

    .btn-sm {
        min-height: 36px;
    }

    /* Smooth scrolling for table overflow */
    .table-responsive {
        -webkit-overflow-scrolling: touch;
    }

    /* Photo/video elements */
    #video, #capturedPhoto {
        max-width: 100%;
        height: auto;
    }

    /* Card header text sizing */
    .card-header h4,
    .card-header h5 {
        font-size: 1.1rem;
    }

    /* Step headings in multi-step forms */
    .step h5 {
        font-size: 1.1rem;
    }

    /* Full-width buttons on small screens */
    .d-flex.gap-2 .btn {
        flex: 1;
    }
}
