@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
    --primary: #10b981; /* Emerald Green */
    --primary-rgb: 16, 185, 129;
    --primary-hover: #059669;
    --primary-light: #ecfdf5;
    --primary-dark: #064e3b;
    --accent: #f59e0b; /* Amber Accent */
    --dark: #0f172a; /* Slate 900 */
    --gray-bg: #f8fafc; /* Slate 50 */
    --card-border: rgba(226, 232, 240, 0.8);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 8px 20px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 15px 35px rgba(0, 0, 0, 0.08);
    --shadow-primary: 0 10px 25px rgba(16, 185, 129, 0.2);
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Plus Jakarta Sans', sans-serif;
    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 24px;
}

body {
    background-color: var(--gray-bg);
    color: var(--dark);
    font-family: var(--font-body);
    font-size: 0.95rem;
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 700;
}

/* Header & Banner Styles */
.app-header {
    background: linear-gradient(135deg, var(--primary-dark) 0%, #047857 50%, #065f46 100%);
    color: white;
    padding: 3rem 1rem;
    border-bottom-left-radius: var(--radius-lg);
    border-bottom-right-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.app-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -20%;
    width: 80%;
    height: 180%;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.15) 0%, transparent 60%);
    pointer-events: none;
}

.app-header::after {
    content: '';
    position: absolute;
    bottom: -30%;
    right: -10%;
    width: 60%;
    height: 120%;
    background: radial-gradient(circle, rgba(245, 158, 11, 0.08) 0%, transparent 70%);
    pointer-events: none;
}

.logo-container {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    padding: 1rem 2rem;
    border-radius: var(--radius-md);
    display: inline-block;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

.logo-container:hover {
    transform: translateY(-3px);
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: var(--shadow-md);
}

.logo-img {
    height: 70px;
    width: auto;
    object-fit: contain;
    max-width: 300px;
}

/* Premium Card Styles */
.premium-card {
    background: white;
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.premium-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.card-header-green {
    background-color: var(--primary-light);
    color: var(--primary-dark);
    font-family: var(--font-heading);
    font-weight: 700;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(16, 185, 129, 0.1);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Form Styles */
.form-label-premium {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--dark);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-control-premium {
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    background-color: #f8fafc;
    transition: all 0.2s ease;
}

.form-control-premium:focus {
    background-color: white;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.15);
    outline: none;
}

/* Button Styles */
.btn-premium-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    padding: 0.75rem 1.5rem;
    font-family: var(--font-heading);
    font-weight: 600;
    letter-spacing: 0.5px;
    box-shadow: var(--shadow-primary);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-premium-primary:hover {
    background: linear-gradient(135deg, var(--primary-hover) 0%, #047857 100%);
    transform: translateY(-2px);
    box-shadow: 0 15px 30px rgba(16, 185, 129, 0.3);
    color: white;
}

.btn-premium-primary:active {
    transform: translateY(0);
}

.btn-premium-secondary {
    background-color: white;
    color: #475569;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-sm);
    padding: 0.75rem 1.5rem;
    font-family: var(--font-heading);
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn-premium-secondary:hover {
    background-color: #f1f5f9;
    color: var(--dark);
    border-color: #94a3b8;
}

/* Geolocation Map */
#leaflet-map {
    height: 300px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--card-border);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.06);
    z-index: 1;
}

.radius-indicator {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.85rem;
}

.radius-inside {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.radius-outside {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

/* Camera Live View and Photo Preview */
.camera-container {
    position: relative;
    background-color: #1e293b;
    border-radius: var(--radius-sm);
    overflow: hidden;
    aspect-ratio: 4/3;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 4px 10px rgba(0,0,0,0.3);
}

#camera-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-preview-box {
    display: none;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.camera-overlay {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    color: white;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    border-radius: 20px;
    z-index: 2;
}

/* Signature Pad Styles */
.signature-wrapper {
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-sm);
    background-color: #f8fafc;
    position: relative;
    overflow: hidden;
}

#signature-canvas {
    width: 100%;
    height: 180px;
    display: block;
    cursor: crosshair;
    background-color: white;
}

.signature-buttons {
    background-color: #f1f5f9;
    padding: 0.5rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #e2e8f0;
}

/* Visitors Section */
.visitor-list-table th {
    background-color: var(--primary-light);
    color: var(--primary-dark);
    font-family: var(--font-heading);
    font-weight: 700;
    border-bottom: 2px solid rgba(16, 185, 129, 0.1);
}

.visitor-photo-thumb {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid var(--primary);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.visitor-photo-thumb:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-md);
}

.visitor-signature-thumb {
    height: 35px;
    object-fit: contain;
    background-color: #f1f5f9;
    border-radius: 4px;
    padding: 2px;
}

.badge-status {
    padding: 0.4rem 0.8rem;
    font-weight: 600;
    border-radius: 20px;
    font-size: 0.85rem;
}

.badge-status-inside {
    background-color: #d1fae5;
    color: #065f46;
}

.badge-status-outside {
    background-color: #fee2e2;
    color: #991b1b;
}

/* Footer Section */
footer {
    background-color: var(--dark);
    color: #94a3b8;
    padding: 2rem 0;
    margin-top: auto;
    font-size: 0.85rem;
    border-top: 5px solid var(--primary);
}

footer a {
    color: var(--primary);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Bootstrap Modal — ensure clickable above all layout elements */
.modal { z-index: 1055; }
.modal-backdrop { z-index: 1050; }

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

.animated-fade-in {
    animation: fadeIn 0.5s ease forwards;
}

.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }

/* ==========================================================================
   ADMIN PANEL STYLES
   ========================================================================== */

/* --- Admin Layout: Sidebar + Main --- */
.admin-layout {
    display: flex;
    flex: 1;
    min-height: 0;
    gap: 0;
}

/* --- Sidebar --- */
.admin-sidebar {
    width: 260px;
    min-width: 260px;
    background: linear-gradient(180deg, var(--primary-dark) 0%, #064e3b 100%);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.admin-sidebar-header {
    padding: 1.5rem;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.admin-sidebar-nav {
    flex: 1;
    padding: 1rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.admin-nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-weight: 500;
    font-family: var(--font-heading);
    font-size: 0.9rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    cursor: pointer;
}

.admin-nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.admin-nav-link.active {
    background: var(--primary);
    color: white;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}

.admin-nav-link i {
    width: 20px;
    text-align: center;
    font-size: 0.95rem;
}

.admin-sidebar-footer {
    padding: 1rem 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* --- Main Content Area --- */
.admin-main {
    flex: 1;
    padding-left: 1.5rem;
    min-width: 0;
}

/* --- Stat Cards --- */
.admin-stat-card {
    background: white;
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    height: 100%;
}

.admin-stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.admin-stat-card .stat-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.admin-stat-card .stat-value {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 2rem;
    margin: 0;
    line-height: 1;
}

.admin-stat-card .stat-label {
    font-size: 0.85rem;
    color: #64748b;
    font-weight: 500;
    margin-top: 0.25rem;
    display: block;
}

/* Stat card color variants */
.stat-card-blue .stat-icon {
    background-color: #eff6ff;
    color: #3b82f6;
}
.stat-card-blue .stat-value { color: #3b82f6; }

.stat-card-green .stat-icon {
    background-color: var(--primary-light);
    color: var(--primary);
}
.stat-card-green .stat-value { color: var(--primary); }

.stat-card-emerald .stat-icon {
    background-color: #d1fae5;
    color: #065f46;
}
.stat-card-emerald .stat-value { color: #065f46; }

.stat-card-red .stat-icon {
    background-color: #fee2e2;
    color: #ef4444;
}
.stat-card-red .stat-value { color: #ef4444; }

/* --- 7-Day Bar Chart --- */
.chart-container {
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    height: 200px;
    padding: 0 0.5rem;
}

.chart-bar-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    height: 100%;
    justify-content: flex-end;
}

.chart-bar-value {
    margin-bottom: 4px;
}

.chart-bar {
    width: 36px;
    max-width: 80%;
    background-color: #e2e8f0;
    border-radius: 6px 6px 0 0;
    min-height: 4px;
    transition: all 0.3s ease;
}

.chart-bar-active {
    background: linear-gradient(180deg, var(--primary) 0%, var(--primary-hover) 100%);
}

.chart-bar-active:hover {
    opacity: 0.8;
}

.chart-bar-label {
    margin-top: 4px;
}

/* --- Recent Visitors List --- */
.recent-visitor-item {
    transition: all 0.15s ease;
    border-left: 3px solid transparent;
}

.recent-visitor-item:hover {
    background-color: var(--primary-light);
    border-left-color: var(--primary);
}

.recent-visitor-photo {
    border: 2px solid var(--primary);
    box-shadow: var(--shadow-sm);
}

/* --- Admin Visitor Table --- */
.admin-visitor-table th {
    background-color: var(--primary-light);
    color: var(--primary-dark);
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.85rem;
    white-space: nowrap;
}

.admin-visitor-table td {
    vertical-align: middle;
}

/* --- Detail Table --- */
.detail-table td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid #f1f5f9;
}

.detail-table tr:last-child td {
    border-bottom: none;
}

/* --- Responsive Sidebar --- */
@media (max-width: 991.98px) {
    .admin-layout {
        flex-direction: column;
    }

    .admin-sidebar {
        width: 100%;
        min-width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        border-radius: var(--radius-sm);
    }

    .admin-sidebar-header {
        width: 100%;
        padding: 1rem;
    }

    .admin-sidebar-nav {
        flex-direction: row;
        flex-wrap: wrap;
        padding: 0.5rem;
        gap: 0.25rem;
    }

    .admin-nav-link {
        font-size: 0.8rem;
        padding: 0.5rem 0.75rem;
    }

    .admin-sidebar-footer {
        width: 100%;
    }

    .admin-main {
        padding-left: 0;
        margin-top: 1rem;
    }
}

@media (max-width: 575.98px) {
    .admin-stat-card {
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
        padding: 1rem;
    }

    .admin-stat-card .stat-value {
        font-size: 1.5rem;
    }

    .chart-bar {
        width: 20px;
    }
}
