/**
 * Premium Custom Stylesheet - Aplikasi Absensi GPS
 * Modern UI/UX dengan Glassmorphism, Micro-animations, & Premium Typography
 */

:root {
    --primary-color: #0f172a;
    /* Slate 900 */
    --secondary-color: #1e293b;
    /* Slate 800 */
    --accent-color: #ffc107;
    /* Warning / Gold */
    --accent-hover: #e0a800;
    --accent-glow: rgba(255, 193, 7, 0.4);

    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-dark: #1e293b;
    --text-muted: #64748b;

    --bg-light: #f1f5f9;
    --bg-white: #ffffff;

    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(255, 255, 255, 0.3);

    --sidebar-width: 280px;
    --transition-speed: 0.3s;

    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.025);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 10px 10px -5px rgba(0, 0, 0, 0.02);
    --shadow-hover: 0 25px 35px -5px rgba(15, 23, 42, 0.1), 0 15px 15px -5px rgba(15, 23, 42, 0.06);
}

/* ==========================================
   GLOBAL & TYPOGRAPHY
   ========================================== */
body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-dark);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Base Animations */
.fade-in {
    animation: fadeIn 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.slide-up {
    animation: slideUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    opacity: 0;
}

.delay-100 {
    animation-delay: 100ms;
}

.delay-200 {
    animation-delay: 200ms;
}

.delay-300 {
    animation-delay: 300ms;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 var(--accent-glow);
    }

    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(255, 193, 7, 0);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 193, 7, 0);
    }
}

.animate-pulse {
    animation: pulse 2.5s infinite cubic-bezier(0.66, 0, 0, 1);
}

/* ==========================================
   LAYOUT WRAPPER & SIDEBAR
   ========================================== */
#wrapper {
    overflow-x: hidden;
    min-height: 100vh;
}

#sidebar-wrapper {
    min-height: 100vh;
    width: var(--sidebar-width);
    margin-left: calc(-1 * var(--sidebar-width));
    transition: margin var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
    background: linear-gradient(145deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.05);
    z-index: 1000;
    position: relative;
    overflow: hidden;
}

/* Dekorasi Sidebar */
#sidebar-wrapper::before {
    content: '';
    position: absolute;
    top: -50px;
    right: -50px;
    width: 150px;
    height: 150px;
    background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

#sidebar-wrapper .sidebar-heading {
    letter-spacing: 1.5px;
    font-size: 1.4rem;
    position: relative;
    z-index: 2;
}

.profile-summary {
    background: rgba(255, 255, 255, 0.02);
    backdrop-filter: blur(5px);
    position: relative;
    z-index: 2;
}

.profile-pic-nav {
    border: 3px solid var(--accent-color);
    padding: 3px;
    background-color: var(--primary-color);
    width: 68px;
    height: 68px;
    object-fit: cover;
    box-shadow: 0 4px 15px var(--accent-glow);
    transition: transform 0.3s ease;
}

.profile-pic-nav:hover {
    transform: rotate(5deg) scale(1.05);
}

/* Sidebar Menu Items */
#sidebar-wrapper .list-group-item {
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
    color: var(--text-secondary) !important;
    position: relative;
    z-index: 2;
    margin-bottom: 0.25rem !important;
    border-radius: 12px;
}

#sidebar-wrapper .list-group-item:hover {
    color: var(--text-primary) !important;
    background-color: rgba(255, 255, 255, 0.06) !important;
    transform: translateX(5px);
}

/* Menu Item Aktif */
#sidebar-wrapper .list-group-item.active-menu {
    color: var(--primary-color) !important;
    background: linear-gradient(90deg, var(--accent-color) 0%, #ffd54f 100%) !important;
    box-shadow: 0 4px 15px var(--accent-glow);
    font-weight: 700;
    transform: scale(1.02);
}

#sidebar-wrapper .list-group-item.active-menu i {
    color: var(--primary-color) !important;
}

.nav-header-small {
    font-size: 0.75rem;
    letter-spacing: 2px;
    font-weight: 700;
    opacity: 0.6;
}

/* Page Content Wrapper */
#page-content-wrapper {
    min-width: 100vw;
    transition: margin var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
}

#wrapper.toggled #sidebar-wrapper {
    margin-left: 0;
}

@media (min-width: 992px) {
    #sidebar-wrapper {
        margin-left: 0;
    }

    #page-content-wrapper {
        min-width: 0;
        width: 100%;
    }

    #wrapper.toggled #sidebar-wrapper {
        margin-left: calc(-1 * var(--sidebar-width));
    }
}

/* Di bawah 992px, #page-content-wrapper dipaksa min-width:100vw agar konten tidak
   ikut menyempit. Kalau sidebar tetap mengandalkan margin-left di dalam flexbox yang
   sama, flexbox akan "meremas" sidebar sampai nyaris 0px karena tidak ada ruang
   tersisa (menu-toggle terlihat aktif tapi sidebar jadi tak kasat mata). Solusinya:
   lepas sidebar dari alur flex sepenuhnya dan jadikan ia overlay di atas konten. */
.sidebar-backdrop {
    display: none;
}

@media (max-width: 991.98px) {
    #sidebar-wrapper {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        margin-left: 0;
        transform: translateX(-100%);
        transition: transform var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 1050;
    }

    #wrapper.toggled #sidebar-wrapper {
        transform: translateX(0);
    }

    .sidebar-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.5);
        z-index: 1040;
    }

    #wrapper.toggled .sidebar-backdrop {
        display: block;
    }
}

/* ==========================================
   LOGIN PAGE (Animated Background)
   ========================================== */
.login-bg {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(-45deg, #0f172a, #1e293b, #334155, #0f172a);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    position: relative;
    overflow: hidden;
}

@keyframes gradientBG {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* Orbs dekoratif di belakang kartu login */
.login-bg::before,
.login-bg::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    z-index: 0;
    animation: floatOrb 10s infinite alternate cubic-bezier(0.4, 0, 0.2, 1);
}

.login-bg::before {
    width: 400px;
    height: 400px;
    background: rgba(255, 193, 7, 0.15);
    top: -100px;
    right: -100px;
}

.login-bg::after {
    width: 300px;
    height: 300px;
    background: rgba(56, 189, 248, 0.1);
    bottom: -50px;
    left: -50px;
    animation-delay: -5s;
}

@keyframes floatOrb {
    0% {
        transform: translate(0, 0) scale(1);
    }

    100% {
        transform: translate(-30px, 50px) scale(1.1);
    }
}

.login-card {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 24px;
    border: 1px solid var(--glass-border);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
    width: 100%;
    max-width: 420px;
    padding: 3.5rem 2.5rem;
    position: relative;
    z-index: 10;
    animation: slideUp 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.login-card .form-control {
    background-color: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(0, 0, 0, 0.05);
    padding: 0.75rem 1rem;
    transition: all 0.3s;
}

.login-card .form-control:focus {
    background-color: #fff;
    box-shadow: 0 0 0 4px var(--accent-glow);
    border-color: var(--accent-color);
}

.login-card .input-group-text {
    background-color: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

/* ==========================================
   CARDS & COMPONENTS
   ========================================== */
.card {
    background: var(--bg-white);
    border: none;
    border-radius: 20px;
    box-shadow: var(--shadow-md);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

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

/* Untuk Card Glassmorphism transparan (opsional jika ditaruh di bg yang kompleks) */
.card-glass {
    background: rgba(255, 255, 255, 0.7) !important;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.card-icon {
    font-size: 2.2rem;
    border-radius: 16px;
    width: 65px;
    height: 65px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.15) 0%, rgba(255, 193, 7, 0.05) 100%);
    color: var(--accent-color);
    position: relative;
}

/* Efek kilap pada icon */
.card-icon::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.4), transparent);
    transform: skewX(-25deg);
    animation: shine 3s infinite;
}

@keyframes shine {
    0% {
        left: -100%;
    }

    20% {
        left: 200%;
    }

    100% {
        left: 200%;
    }
}

/* ==========================================
   TABLES (REKAP & RIWAYAT)
   ========================================== */
.table-responsive {
    border-radius: 16px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    border-collapse: separate;
    border-spacing: 0 10px;
    margin-bottom: 0;
}

@media (max-width: 991.98px) {
    /* Cegah kolom "diperas" jadi sempit/tak terbaca di layar kecil - biarkan tabel
       selebar kontennya sendiri (mengikuti jumlah kolom), lalu .table-responsive
       di atas yang menyediakan scroll horizontal. Tidak mengecilkan font maupun
       menyembunyikan kolom apa pun. */
    .table-responsive > .table {
        white-space: nowrap;
    }
}

.table thead th {
    border: none;
    background-color: transparent !important;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 1px;
    color: var(--text-muted);
    padding: 1rem 1.5rem;
}

.table tbody tr {
    background-color: var(--bg-white);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
    transition: all 0.3s ease;
}

.table tbody tr:hover {
    transform: scale(1.01) translateY(-2px);
    box-shadow: var(--shadow-md);
    z-index: 2;
    position: relative;
}

.table td {
    border: none;
    padding: 1.25rem 1.5rem;
    vertical-align: middle;
    color: var(--text-dark);
}

.table tr td:first-child {
    border-top-left-radius: 16px;
    border-bottom-left-radius: 16px;
}

.table tr td:last-child {
    border-top-right-radius: 16px;
    border-bottom-right-radius: 16px;
}

/* Badges */
.badge {
    padding: 0.5em 0.8em;
    border-radius: 8px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* ==========================================
   COMPANY BADGE (Logo + Nama Perusahaan) - komponen reusable
   Dipakai di: sidebar, header dashboard, popup peta absen, dll.
   Lihat templates/company_badge.php
   ========================================== */
.company-info {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.company-info .company-logo {
    width: var(--company-badge-size, 40px);
    height: var(--company-badge-size, 40px);
    object-fit: contain;
    background-color: #fff;
    border-radius: 8px;
    padding: 4px;
    flex-shrink: 0;
}

.company-info .company-name {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Sidebar: sudut logo lebih kecil & warna nama menyesuaikan latar gelap sidebar */
#sidebar-wrapper .company-info {
    margin-bottom: 0.85rem;
}

#sidebar-wrapper .company-info .company-logo {
    border-radius: 6px;
    padding: 3px;
}

#sidebar-wrapper .company-info .company-name {
    color: #b89e14;
    font-weight: 700;
    font-size: 1.15rem;
    white-space: normal;
    line-height: 1.2;
}

@media (max-width: 991.98px) {
    #sidebar-wrapper .company-info .company-logo {
        width: 40px;
        height: 40px;
    }
    #sidebar-wrapper .company-info .company-name {
        font-size: 1rem;
    }
}

/* Badge perusahaan di Welcome Card Dashboard (karyawan) */
.dashboard-welcome-company .company-name {
    color: #b89e14;
    font-weight: 700;
    font-size: 1.15rem;
    white-space: normal;
    line-height: 1.2;
}

/* ==========================================
   RINGKASAN PERUSAHAAN (Dashboard Admin)
   ========================================== */
.company-summary-stat-label {
    font-size: 0.72rem;
}

/* Card perusahaan: logo besar + nama sebagai fokus utama */
.company-summary-card {
    padding: 24px;
    min-height: 190px;
}

.company-summary-card .company-info {
    display: flex;
    align-items: center;
    gap: 18px;
}

.company-summary-card .company-logo {
    width: 72px;
    height: 72px;
    object-fit: contain;
    background-color: #fff;
    border-radius: 8px;
    padding: 4px;
    flex-shrink: 0;
}

.company-summary-card .company-name {
    display: block;
    font-size: 22px;
    font-weight: 700;
    color: #b89e14;
    text-transform: uppercase;
    line-height: 1.2;
    white-space: normal;
}

.company-summary-card .employee-count {
    color: #6c757d;
    font-size: 0.9rem;
}

@media (max-width: 991.98px) {
    .company-summary-card .company-logo {
        width: 60px;
        height: 60px;
    }

    .company-summary-card .company-name {
        font-size: 22px;
    }
}

@media (max-width: 767.98px) {
    .company-summary-card .company-logo {
        width: 48px;
        height: 48px;
    }

    .company-summary-card .company-name {
        font-size: 18px;
    }
}

.company-summary-toggle {
    cursor: pointer;
}

.company-summary-chevron {
    transition: transform 0.2s ease;
}

.company-summary-toggle[aria-expanded="true"] .company-summary-chevron {
    transform: rotate(180deg);
}

.employee-mini-row {
    border-bottom: 1px solid #f1f5f9;
}

.employee-mini-row:last-child {
    border-bottom: none;
}

.min-width-0 {
    min-width: 0;
}

/* ==========================================
   LOGO PERUSAHAAN (Data Perusahaan - admin)
   ========================================== */
.logo-thumb {
    width: 56px;
    height: 56px;
    object-fit: contain;
    background-color: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 4px;
}

.logo-thumb-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 1.4rem;
}

.logo-thumb-lg {
    width: 96px;
    height: 96px;
    object-fit: contain;
    background-color: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 6px;
    font-size: 2rem;
}

/* ==========================================
   BUTTONS
   ========================================== */
.btn {
    border-radius: 12px;
    font-weight: 600;
    padding: 0.6rem 1.2rem;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn:hover {
    transform: translateY(-2px);
}

.btn:active {
    transform: translateY(1px);
}

.btn-warning {
    background: linear-gradient(135deg, #ffc107 0%, #ffb300 100%);
    border: none;
    color: var(--primary-color) !important;
    box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-warning:hover {
    background: linear-gradient(135deg, #ffb300 0%, #ffa000 100%);
    box-shadow: 0 8px 25px rgba(255, 193, 7, 0.5);
}

/* ==========================================
   CAMERA & MAP VIEWS
   ========================================== */
#my-map {
    height: 400px;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    border: 4px solid #fff;
    z-index: 10;
}

.camera-container {
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    background: #000;
    height: 320px;
    box-shadow: var(--shadow-lg);
    border: 4px solid #fff;
}

.camera-container video {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
}

.camera-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    height: 82%;
    width: 55%;
    max-width: 220px;
    border: 3px dashed rgba(255, 255, 255, 0.7);
    border-radius: 50%;
    pointer-events: none;
    box-sizing: border-box;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.35);
    transition: all 0.3s ease;
}

.camera-overlay.face-detected {
    border: 3px solid #2ecc71 !important;
    box-shadow: 0 0 25px rgba(46, 204, 113, 0.7), 0 0 0 9999px rgba(0, 0, 0, 0.35) !important;
}

.camera-overlay.face-missing {
    border: 3px dashed #e74c3c !important;
    box-shadow: 0 0 15px rgba(231, 76, 60, 0.5), 0 0 0 9999px rgba(0, 0, 0, 0.35) !important;
}