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

:root {
    --font-primary: 'Plus Jakarta Sans', sans-serif;
    
    /* Clean Professional Light Mode Theme */
    --bg-primary: #f8fafc;
    --bg-gradient: linear-gradient(180deg, #f8fafc 0%, #e2e8f0 100%);
    
    --text-main: #0f172a;
    --text-muted: #475569;
    --text-light: #64748b;
    
    --accent-indigo: #2563eb; /* Clean Corporate Blue */
    --accent-indigo-hover: #1d4ed8;
    --accent-teal: #0d9488;
    --accent-teal-hover: #0f766e;
    --accent-rose: #dc2626;
    
    --card-bg: #ffffff; /* Solid White for high contrast and professional look */
    --card-border: #cbd5e1;
    --card-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 16px -6px rgba(15, 23, 42, 0.04);
    
    --input-bg: #ffffff;
    --input-border: #cbd5e1;
    --input-focus: #2563eb;
    
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-full: 9999px;
    
    --transition-smooth: all 0.2s ease-in-out;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-primary);
    background-color: var(--bg-primary);
    background-image: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--text-main);
    min-height: 100vh;
    line-height: 1.5;
}

/* Layout centering for Client / Authentication pages */
body.client-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 0;
}

/* Layout standard for Admin pages */
body.admin-layout {
    display: block;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.25;
}

a {
    color: var(--accent-indigo);
    text-decoration: none;
    transition: var(--transition-smooth);
}

a:hover {
    color: var(--accent-indigo-hover);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--text-light);
    border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Glassmorphism Card Container */
.glass-container {
    max-width: 480px;
    width: 90%;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: 2.5rem 2.25rem;
    box-shadow: var(--card-shadow);
    transition: var(--transition-smooth);
    animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.glass-container-wide {
    max-width: 1200px;
    width: 95%;
    margin: 2rem auto;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--card-shadow);
    animation: fadeIn 0.4s ease-out;
}

/* Headers & Branding */
.brand-header {
    text-align: center;
    margin-bottom: 2rem;
}

.brand-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--accent-indigo), var(--accent-teal));
    color: white;
    border-radius: var(--radius-lg);
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 0.75rem;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.2);
}

.brand-title {
    font-size: 1.75rem;
    color: var(--text-main);
    margin-bottom: 0.25rem;
    font-weight: 800;
}

.brand-subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
    text-align: left;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    font-family: var(--font-primary);
    font-size: 0.95rem;
    color: var(--text-main);
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--radius-md);
    outline: none;
    transition: var(--transition-smooth);
}

.form-control:focus {
    border-color: var(--input-focus);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1.25rem;
    padding-right: 2.5rem;
}

/* Interactive Canvas for Signatures */
.canvas-wrapper {
    position: relative;
    border: 1px solid var(--input-border);
    border-radius: var(--radius-md);
    background: #f8fafc;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.signature-canvas {
    width: 100%;
    height: 180px;
    display: block;
    cursor: crosshair;
    touch-action: none; /* Prevents scrolling when drawing */
}

.canvas-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

/* Camera selfie preview styling */
.camera-wrapper {
    position: relative;
    border: 1px solid var(--input-border);
    border-radius: var(--radius-md);
    background: #000;
    overflow: hidden;
    aspect-ratio: 4/3;
    display: flex;
    align-items: center;
    justify-content: center;
}

.camera-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1); /* Mirror camera stream */
}

.camera-preview-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.camera-placeholder {
    position: absolute;
    color: #94a3b8;
    text-align: center;
    padding: 1rem;
    z-index: 1;
}

.camera-placeholder svg {
    width: 40px;
    height: 40px;
    margin-bottom: 0.5rem;
    opacity: 0.7;
}

.camera-controls {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

/* Geolocation Info Panel */
.geo-panel {
    background: rgba(37, 99, 235, 0.05);
    border: 1px solid rgba(37, 99, 235, 0.15);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-muted);
}

.geo-panel svg {
    color: var(--accent-indigo);
    animation: pulse 2s infinite;
    flex-shrink: 0;
}

.geo-status-active {
    color: var(--accent-teal);
    font-weight: 700;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-primary);
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0.65rem 1.25rem;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: var(--transition-smooth);
    gap: 0.5rem;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background-color: var(--accent-indigo);
    color: white;
}

.btn-primary:hover {
    background-color: var(--accent-indigo-hover);
}

.btn-secondary {
    background-color: #f1f5f9;
    border: 1px solid var(--input-border);
    color: var(--text-main);
}

.btn-secondary:hover {
    background-color: #e2e8f0;
}

.btn-danger {
    background-color: var(--accent-rose);
    color: white;
}

.btn-danger:hover {
    background-color: #be123c;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    border-radius: var(--radius-sm);
}

.btn-block {
    width: 100%;
}

/* Alert notifications */
.alert {
    padding: 0.85rem 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    border: 1px solid transparent;
}

.alert-danger {
    background-color: #fef2f2;
    border-color: #fee2e2;
    color: var(--accent-rose);
}

.alert-success {
    background-color: #f0fdf4;
    border-color: #dcfce7;
    color: var(--accent-teal);
}

.alert-warning {
    background-color: #fffbeb;
    border-color: #fef3c7;
    color: #b45309;
}

.alert svg {
    flex-shrink: 0;
    margin-top: 0.15rem;
}

/* Admin Dashboard layout */
.admin-navbar {
    background: #ffffff;
    border-bottom: 1px solid var(--card-border);
    padding: 0.75rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.admin-nav-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 800;
    font-size: 1.25rem;
}

.admin-nav-logo {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--accent-indigo), var(--accent-teal));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 800;
}

.admin-nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.admin-nav-link {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-light);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.admin-nav-link.active {
    color: var(--accent-indigo);
}

.admin-user-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Dashboard Statistics Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.75rem;
}

.stat-card {
    background: #ffffff;
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: rgba(37, 99, 235, 0.08);
    color: var(--accent-indigo);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.stat-icon-teal {
    background: rgba(13, 148, 136, 0.08);
    color: var(--accent-teal);
}

.stat-icon-rose {
    background: rgba(220, 38, 38, 0.08);
    color: var(--accent-rose);
}

.stat-title {
    font-size: 0.75rem;
    color: var(--text-light);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-main);
}

/* Layout Split Panels */
.panel-split {
    display: grid;
    grid-template-columns: 1fr 2.25fr;
    gap: 1.75rem;
}

@media (max-width: 768px) {
    .panel-split {
        grid-template-columns: 1fr;
    }
    .hide-mobile {
        display: none !important;
    }
}

/* Tables styling */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--card-border);
    margin-bottom: 1.5rem;
    background: #ffffff;
}

.table,
.table-custom {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
}

.table th,
.table-custom th {
    background: #f8fafc;
    padding: 0.75rem 1rem;
    font-weight: 700;
    color: var(--text-main);
    border-bottom: 1.5px solid var(--card-border);
}

.table td,
.table-custom td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid #e2e8f0;
    color: var(--text-main);
    vertical-align: middle;
}

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

.table tr:hover td,
.table-custom tr:hover td {
    background: #f8fafc;
}

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: var(--radius-sm);
}

.badge-success {
    background-color: #dcfce7;
    color: #15803d;
}

.badge-danger {
    background-color: #fee2e2;
    color: #b91c1c;
}

.badge-warning {
    background-color: #fef3c7;
    color: #a16207;
}

.badge-info {
    background-color: #dbeafe;
    color: #1d4ed8;
}

/* Action Dropdown Menu */
.dropdown-menu-wrapper {
    position: relative;
    display: inline-block;
}

.dropdown-menu-content {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 6px;
    background: #ffffff;
    min-width: 175px;
    border-radius: var(--radius-md, 8px);
    border: 1.5px solid var(--card-border, #e2e8f0);
    box-shadow: 0 12px 30px -4px rgba(0, 0, 0, 0.22), 0 6px 12px -4px rgba(0, 0, 0, 0.12);
    padding: 0.4rem 0;
    z-index: 999999 !important;
    text-align: left;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 0.9rem;
    font-size: 0.83rem;
    color: var(--text-main, #1e293b);
    text-decoration: none;
    font-weight: 500;
    transition: background 0.15s ease, color 0.15s ease;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
}

.dropdown-item i {
    width: 16px;
    text-align: center;
    font-size: 0.88rem;
    color: var(--accent-indigo, #6366f1);
}

.dropdown-item:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.dropdown-item.text-danger {
    color: #ef4444 !important;
}

.dropdown-item.text-danger i {
    color: #ef4444 !important;
}

.dropdown-item.text-danger:hover {
    background: #fef2f2;
    color: #dc2626 !important;
}

/* Pagination */
.pagination-wrapper {
    margin-top: 1.5rem;
    width: 100%;
}

.pagination-wrapper nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding-top: 1rem;
    border-top: 1px solid var(--card-border);
}

/* Hide duplicate mobile-only text pagination block */
.pagination-wrapper nav > div:first-child {
    display: none !important;
}

/* Structure desktop pagination container */
.pagination-wrapper nav > div:last-child {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

/* Results text (e.g. "Showing 1 to 15 of 17 results") */
.pagination-wrapper nav > div:last-child p {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
    margin: 0;
}

/* Pagination buttons container */
.pagination-wrapper nav span.relative.z-0 {
    display: inline-flex;
    border-radius: var(--radius-sm);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    background: #ffffff;
    border: 1px solid var(--card-border);
    overflow: hidden;
}

/* Style each pagination button link/span */
.pagination-wrapper nav span.relative.z-0 a,
.pagination-wrapper nav span.relative.z-0 span[aria-current="page"],
.pagination-wrapper nav span.relative.z-0 span[disabled],
.pagination-wrapper nav span.relative.z-0 span.relative {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.25rem;
    height: 2.25rem;
    padding: 0 0.75rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
    border-right: 1px solid var(--card-border);
    background: #ffffff;
    transition: var(--transition-smooth);
    text-decoration: none;
}

.pagination-wrapper nav span.relative.z-0 a:last-child,
.pagination-wrapper nav span.relative.z-0 span:last-child {
    border-right: none;
}

.pagination-wrapper nav span.relative.z-0 a:hover {
    background-color: #f1f5f9;
    color: var(--text-main);
}

.pagination-wrapper nav span.relative.z-0 span[aria-current="page"] {
    background-color: var(--accent-indigo);
    color: #ffffff;
    border-color: var(--accent-indigo);
}

.pagination-wrapper nav span[aria-disabled="true"] {
    color: #cbd5e1;
    cursor: not-allowed;
    background-color: #f8fafc;
}

/* Size geocoding/navigation SVGs in pagination */
.pagination-wrapper nav svg {
    width: 1.25rem;
    height: 1.25rem;
    display: inline-block;
    vertical-align: middle;
}

@media (max-width: 640px) {
    .pagination-wrapper nav > div:last-child {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
}

/* Custom modal or inline modal form */
.form-modal-inline {
    background: #ffffff;
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    height: fit-content;
}

/* Shareable Link display widget */
.share-widget {
    background: #f8fafc;
    border: 1px solid var(--input-border);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    padding: 0.5rem 0.5rem 0.5rem 1rem;
    margin-top: 0.5rem;
}

.share-link-text {
    font-family: monospace;
    font-size: 0.85rem;
    color: var(--text-light);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex-grow: 1;
}

/* Success Animations */
.success-checkmark {
    width: 64px;
    height: 64px;
    margin: 0 auto 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    background: #dcfce7;
    color: var(--accent-teal);
    font-size: 2rem;
    animation: scaleIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.15) forwards;
}

/* PWA custom install banner */
.pwa-banner {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 450px;
    background: #0f172a;
    color: white;
    border-radius: var(--radius-md);
    padding: 1rem;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    z-index: 999;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    animation: slideUp 0.4s ease-out;
}

.pwa-banner-text {
    font-size: 0.85rem;
}

.pwa-banner-title {
    font-weight: 700;
}

.pwa-banner-desc {
    color: #94a3b8;
}

.pwa-banner-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* Animations declarations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.7); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes pulse {
    0% { opacity: 0.6; transform: scale(0.97); }
    50% { opacity: 1; transform: scale(1.03); }
    100% { opacity: 0.6; transform: scale(0.97); }
}

/* Footers */
.app-footer {
    text-align: center;
    padding: 1.5rem 0;
    margin-top: 1.5rem;
    font-size: 0.8rem;
    color: var(--text-light);
    font-weight: 500;
}

/* ============================================================
   Reusable Grid Helpers (classname-based, responsive-friendly)
   ============================================================ */

.time-grid-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.filter-form-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto;
    gap: 0.75rem;
    align-items: flex-end;
}

/* ============================================================
   RESPONSIVE — Tablet (≤ 1024px)
   ============================================================ */

@media (max-width: 1024px) {
    .glass-container-wide {
        width: 98%;
        padding: 1.5rem;
        margin: 1rem auto;
    }

    .panel-split {
        grid-template-columns: 1fr 2fr;
        gap: 1.25rem;
    }
}

/* ============================================================
   RESPONSIVE — Mobile (≤ 768px)
   ============================================================ */

@media (max-width: 768px) {
    /* Admin Navbar — collapse to compact bar */
    .admin-navbar {
        padding: 0.65rem 1rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .admin-nav-links {
        gap: 0.85rem;
        order: 3;
        width: 100%;
        border-top: 1px solid var(--card-border);
        padding-top: 0.5rem;
    }

    .admin-nav-link {
        font-size: 0.82rem;
    }

    .admin-user-menu {
        gap: 0.5rem;
    }

    .hide-mobile {
        display: none !important;
    }

    /* Wide container — edge-to-edge on small screens */
    .glass-container-wide {
        width: 100%;
        margin: 0;
        border-radius: 0;
        border-left: none;
        border-right: none;
        padding: 1rem;
    }

    /* Panel split — table/list on top, forms below on mobile */
    .panel-split {
        display: flex;
        flex-direction: column-reverse;
        gap: 1.5rem;
    }

    /* Filter search form — stack rows */
    .filter-form-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.6rem;
    }

    .filter-form-grid > div:first-child {
        grid-column: 1 / -1; /* Search bar full width */
    }

    .filter-form-grid > div:last-child {
        grid-column: 1 / -1; /* Action buttons full width */
    }

    /* Stats grid — 1 column on very small screens */
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 0.75rem;
        margin-bottom: 1.25rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-value {
        font-size: 1.35rem;
    }

    /* Tables — horizontal scroll on mobile */
    .table-responsive {
        border-radius: 0;
        border-left: none;
        border-right: none;
        margin-left: -1rem;
        margin-right: -1rem;
        width: calc(100% + 2rem);
    }

    .table-custom th,
    .table-custom td {
        padding: 0.65rem 0.75rem;
        font-size: 0.83rem;
        white-space: nowrap;
    }

    /* Time picker grid — keep 2 cols on mobile */
    .time-grid-cols {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }

    /* Client check-in form — reduce padding & fix layout to prevent scroll */
    .glass-container {
        width: 100%;
        height: 100vh;
        min-height: 100vh;
        border-radius: 0;
        padding: 1.25rem;
        border: none;
        box-shadow: none;
        overflow: hidden;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
    }

    body.client-layout {
        padding: 0;
        justify-content: flex-start;
        overflow: hidden;
        position: fixed;
        width: 100%;
        height: 100vh;
    }

    .form-group {
        margin-bottom: 0.85rem;
    }

    .brand-title {
        font-size: 1.5rem;
    }

    /* Signature canvas — shorter on mobile */
    .signature-canvas {
        height: 140px;
    }

    /* Form modal inline (add participant panel) */
    .form-modal-inline {
        padding: 1rem;
    }
}

/* ============================================================
   RESPONSIVE — Small Mobile (≤ 480px)
   ============================================================ */

@media (max-width: 480px) {
    .filter-form-grid {
        grid-template-columns: 1fr;
    }

    .filter-form-grid > div:first-child {
        grid-column: 1;
    }

    .admin-navbar {
        padding: 0.6rem 0.85rem;
    }

    .admin-nav-links {
        gap: 0.6rem;
    }

    .btn {
        font-size: 0.875rem;
        padding: 0.6rem 1rem;
    }

    .btn-sm {
        padding: 0.35rem 0.6rem;
        font-size: 0.8rem;
    }

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

    .share-widget {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .glass-container-wide {
        padding: 0.85rem;
    }
}

/* ============================================================
   GLOBAL KEBAB MENU DROPDOWN
   ============================================================ */
.dropdown-kebab {
    position: relative;
    display: inline-block;
}

.kebab-btn {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    font-size: 1.15rem;
    padding: 0.35rem 0.6rem;
    border-radius: var(--radius-sm);
    transition: var(--transition-smooth);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.kebab-btn:hover {
    background: #f1f5f9;
    color: var(--text-main);
}

.dropdown-menu-content {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background: #ffffff;
    min-width: 120px;
    border: 1px solid var(--card-border);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
    border-radius: var(--radius-md);
    z-index: 100;
    padding: 0.3rem 0;
    animation: fadeIn 0.15s ease-out;
    text-align: left;
}

.dropdown-menu-content button, 
.dropdown-menu-content a {
    background: none;
    border: none;
    width: 100%;
    padding: 0.45rem 1rem;
    font-size: 0.85rem;
    font-family: var(--font-primary);
    font-weight: 600;
    color: var(--text-muted);
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition-smooth);
    text-decoration: none;
}

.dropdown-menu-content button:hover, 
.dropdown-menu-content a:hover {
    background-color: #f1f5f9;
    color: var(--text-main);
}

.dropdown-menu-content form {
    margin: 0;
}

.dropdown-menu-content button.delete-btn,
.dropdown-menu-content a.delete-btn {
    color: var(--accent-rose);
}

.dropdown-menu-content button.delete-btn:hover,
.dropdown-menu-content a.delete-btn:hover {
    background-color: #fef2f2;
    color: var(--accent-rose);
}

/* ============================================================
   ADMIN SIDEBAR LAYOUT
   ============================================================ */

body.admin-sidebar-layout {
    display: block;
    overflow-x: hidden;
}

.admin-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ── */
.admin-sidebar {
    width: 260px;
    min-width: 260px;
    background: #ffffff;
    border-right: 1px solid var(--card-border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 200;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 2px 0 12px rgba(15, 23, 42, 0.04);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem 1.25rem 1rem;
    border-bottom: 1px solid var(--card-border);
}

.sidebar-brand-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--accent-indigo), var(--accent-teal));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.sidebar-brand-name {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1;
}

.sidebar-brand-sub {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.sidebar-close-btn {
    margin-left: auto;
    background: none;
    border: none;
    font-size: 1.1rem;
    color: var(--text-light);
    cursor: pointer;
    display: none;
    padding: 0.25rem;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.9rem 1.25rem;
    background: #f8fafc;
    border-bottom: 1px solid var(--card-border);
}
.sidebar-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(99, 102, 241, 0.1);
    color: #4f46e5;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    flex-shrink: 0;
    line-height: 1;
}

.sidebar-user-name {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.sidebar-user-role {
    font-size: 0.7rem;
    color: var(--text-muted);
    line-height: 1.2;
}

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

.sidebar-nav-label {
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-light);
    padding: 0 0.5rem;
    margin-bottom: 0.25rem;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.85rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    transition: var(--transition-smooth);
    position: relative;
    cursor: pointer;
}

.sidebar-nav-item:hover {
    background: #f1f5f9;
    color: var(--text-main);
}

.sidebar-nav-item.active {
    background: rgba(37, 99, 235, 0.08);
    color: var(--accent-indigo);
}

.sidebar-nav-item i {
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-badge-warn {
    margin-left: auto;
    width: 18px;
    height: 18px;
    border-radius: var(--radius-full);
    background: var(--accent-rose);
    color: white;
    font-size: 0.65rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-badge-ok {
    margin-left: auto;
    width: 18px;
    height: 18px;
    border-radius: var(--radius-full);
    background: #10b981;
    color: white;
    font-size: 0.55rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-footer {
    padding: 0.75rem;
    border-top: 1px solid var(--card-border);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.sidebar-logout-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.6rem 0.85rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--accent-rose);
    background: none;
    border: none;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.sidebar-logout-btn:hover {
    background: #fef2f2;
}

/* ── Main Content Area ── */
.admin-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
}

.admin-content-area {
    flex: 1;
    padding: 2rem;
}

.page-header {
    margin-bottom: 1.75rem;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.page-subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    font-weight: 500;
}

/* ── Global Admin Topbar ── */
.admin-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 2rem;
    min-height: 60px;
    background: #ffffff;
    border-bottom: 1px solid var(--card-border);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.03);
    position: sticky;
    top: 0;
    z-index: 150;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.topbar-brand-indicator {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--text-main);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.35rem 0.85rem 0.35rem 0.45rem;
    background: #f8fafc;
    border: 1px solid var(--card-border);
    border-radius: var(--radius-full);
    transition: background 0.15s ease, border-color 0.15s ease;
    cursor: pointer;
}

.topbar-user:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.topbar-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(99, 102, 241, 0.1);
    color: var(--accent-indigo);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    flex-shrink: 0;
}

.topbar-user-info {
    display: flex;
    flex-direction: column;
    text-align: left;
}

.topbar-user-name {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.2;
    white-space: nowrap;
}

.topbar-user-role {
    font-size: 0.68rem;
    color: var(--text-muted);
    font-weight: 500;
    line-height: 1.1;
}

/* ── Topbar Dropdown Menu ── */
.topbar-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 250px;
    background: #ffffff;
    border-radius: var(--radius-md);
    border: 1px solid var(--card-border);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    padding: 0.4rem 0;
    z-index: 500;
    animation: fadeIn 0.15s ease;
}

.topbar-dropdown-menu.show {
    display: block;
}

.topbar-dropdown-header {
    padding: 0.75rem 1rem 0.5rem;
}

.topbar-dropdown-divider {
    height: 1px;
    background: var(--card-border);
    margin: 0.35rem 0;
}

.topbar-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1rem;
    font-size: 0.82rem;
    color: var(--text-main);
    text-decoration: none;
    transition: background 0.15s ease;
}

.topbar-dropdown-item:hover {
    background: #f8fafc;
}

.topbar-dropdown-item i {
    font-size: 1rem;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.topbar-dropdown-item.text-danger:hover {
    background: #fef2f2;
}

.sidebar-toggle-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text-main);
    padding: 0.25rem;
    display: none;
    align-items: center;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    z-index: 180;
}

@media (max-width: 1024px) {
    .admin-topbar {
        padding: 0.65rem 1.25rem;
    }
    .sidebar-toggle-btn {
        display: flex !important;
    }
    .topbar-brand-indicator span:last-child {
        display: none;
    }
}

@media (max-width: 640px) {
    .topbar-user-info {
        display: none;
    }
    .topbar-user {
        padding: 0.25rem;
        background: none;
        border: none;
    }
}

.sidebar-overlay.active {
    display: block;
}

/* ============================================================
   APEL LOCATION PAGE
   ============================================================ */

.location-status-card {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.75rem;
    border: 1.5px solid;
}

.status-configured {
    background: rgba(16, 185, 129, 0.06);
    border-color: rgba(16, 185, 129, 0.25);
}

.status-not-configured {
    background: rgba(234, 179, 8, 0.06);
    border-color: rgba(234, 179, 8, 0.3);
}

.status-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.status-icon-green {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.status-icon-warn {
    background: rgba(234, 179, 8, 0.15);
    color: #d97706;
}

.status-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
}

.status-desc {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

.status-meta {
    font-size: 0.75rem;
    color: var(--text-light);
    margin-top: 0.2rem;
}

.location-panel-split {
    display: grid;
    grid-template-columns: 1.7fr 1fr;
    gap: 1.75rem;
    align-items: start;
}

.location-map-wrapper {
    background: #ffffff;
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.map-header {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.85rem 1.1rem;
    background: #f8fafc;
    border-bottom: 1px solid var(--card-border);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

.map-header .btn {
    margin-left: auto;
}

.leaflet-map-container {
    height: 440px;
    width: 100%;
    cursor: crosshair;
}

.map-hint {
    padding: 0.65rem 1.1rem;
    font-size: 0.77rem;
    color: var(--text-light);
    background: #f8fafc;
    border-top: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.location-form-wrapper {
    background: #ffffff;
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
}

.form-section-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.coords-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.85rem;
}

.radius-slider {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: linear-gradient(to right, var(--accent-indigo), var(--accent-teal));
    border-radius: var(--radius-full);
    outline: none;
    cursor: pointer;
    margin-top: 0.35rem;
}

.radius-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: var(--radius-full);
    background: var(--accent-indigo);
    cursor: pointer;
    border: 3px solid white;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}

.radius-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    color: var(--text-light);
    margin-top: 0.25rem;
}

.coord-preview {
    background: #f8fafc;
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    margin-top: 0.5rem;
}

.coord-preview-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.82rem;
    font-family: monospace;
    color: var(--text-main);
    font-weight: 600;
}

.map-marker-pin {
    width: 36px;
    height: 36px;
    background: var(--accent-rose);
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid white;
    box-shadow: 0 3px 8px rgba(0,0,0,0.25);
}

.map-marker-pin i {
    transform: rotate(45deg);
    color: white;
    font-size: 0.85rem;
}

/* Disabled submit button */
.btn-primary:disabled {
    background-color: #94a3b8;
    cursor: not-allowed;
    transform: none;
    opacity: 0.7;
}

/* ============================================================
   RESPONSIVE — Sidebar Mobile (≤ 1024px)
   ============================================================ */

@media (max-width: 1024px) {
    .admin-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        transform: translateX(-100%);
        z-index: 200;
    }

    .admin-sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(15, 23, 42, 0.15);
    }

    .sidebar-close-btn {
        display: flex;
    }

    .admin-mobile-topbar {
        display: flex;
    }

    .admin-content-area {
        padding: 1.25rem;
    }

    .location-panel-split {
        grid-template-columns: 1fr;
    }

    .leaflet-map-container {
        height: 320px;
    }
}

@media (max-width: 768px) {
    .admin-content-area {
        padding: 1rem;
    }
    .coords-grid {
        grid-template-columns: 1fr;
    }
    .page-title {
        font-size: 1.25rem;
    }
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}
