/* ==================================================
   GLOBAL RESET
================================================== */

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(59, 130, 246, 0.18), transparent 30%),
        linear-gradient(135deg, #f8fafc, #dbeafe);
    font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    color: #0f172a;
    padding-bottom: env(safe-area-inset-bottom);
}

button,
input,
select,
textarea {
    font-family: inherit;
}

.hidden {
    display: none !important;
}


/* ==================================================
   SPLASH SCREEN
================================================== */

.splash-screen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: linear-gradient(135deg, #2563eb, #1e40af);
    color: white;
    display: grid;
    place-content: center;
    text-align: center;
    transition: opacity 0.55s ease, visibility 0.55s ease;
}

.splash-screen.hide {
    opacity: 0;
    visibility: hidden;
}

.splash-logo {
    width: 112px;
    height: 112px;
    border-radius: 32px;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.25);
    display: grid;
    place-items: center;
    margin: 0 auto 18px;
    font-size: 58px;
    box-shadow: 0 18px 55px rgba(0, 0, 0, 0.22);
}

.splash-screen h1 {
    font-size: 34px;
    font-weight: 900;
    margin: 0;
    letter-spacing: -0.04em;
}

.splash-screen p {
    margin: 8px 0 22px;
    color: rgba(255, 255, 255, 0.84);
    font-weight: 500;
}

.splash-loader {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    border: 5px solid rgba(255, 255, 255, 0.25);
    border-top-color: white;
    animation: spin 0.9s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}


/* ==================================================
   PWA INSTALL BANNER
================================================== */

.install-banner {
    display: none;
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: 16px;
    z-index: 3000;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: 22px;
    padding: 14px 16px;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    box-shadow: 0 18px 50px rgba(15, 23, 42, 0.18);
}

.install-banner b {
    display: block;
    color: #0f172a;
    font-size: 15px;
    line-height: 1.2;
}

.install-banner span {
    display: block;
    font-size: 13px;
    color: #64748b;
    margin-top: 2px;
}

.install-banner button {
    border: 0;
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    color: white;
    border-radius: 14px;
    padding: 10px 18px;
    font-weight: 800;
    box-shadow: 0 10px 22px rgba(37, 99, 235, 0.25);
}


/* ==================================================
   MAIN LAYOUT
================================================== */

.page-shell {
    width: min(980px, 100%);
    margin: 0 auto;
    padding: 24px;
}


/* ==================================================
   HEADER CARD
================================================== */

.app-header-card {
    background: linear-gradient(135deg, #2563eb, #1e40af);
    border-radius: 30px;
    padding: 30px;
    color: white;
    box-shadow: 0 24px 60px rgba(37, 99, 235, 0.28);
    margin-bottom: 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    overflow: hidden;
    position: relative;
}

.app-header-card::after {
    content: "";
    position: absolute;
    right: -80px;
    top: -80px;
    width: 230px;
    height: 230px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 50%;
}

.badge-soft {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.25);
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 14px;
    margin-bottom: 14px;
    position: relative;
    z-index: 1;
}

.app-header-card h1 {
    font-size: clamp(30px, 4vw, 46px);
    font-weight: 900;
    margin: 0;
    letter-spacing: -0.05em;
    position: relative;
    z-index: 1;
}

.app-header-card p {
    max-width: 620px;
    margin: 8px 0 0;
    color: rgba(255, 255, 255, 0.88);
    position: relative;
    z-index: 1;
    font-weight: 500;
}

.header-icon {
    width: 108px;
    height: 108px;
    display: grid;
    place-items: center;
    border-radius: 30px;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.25);
    font-size: 50px;
    position: relative;
    z-index: 1;
}


/* ==================================================
   CARDS
================================================== */

.panel-card,
.user-card {
    background: rgba(255, 255, 255, 0.93);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.65);
    border-radius: 28px;
    padding: 24px;
    box-shadow: 0 18px 50px rgba(15, 23, 42, 0.08);
    margin-bottom: 18px;
}

.security-note {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    background: #eff6ff;
    color: #1e40af;
    border-radius: 16px;
    padding: 12px 14px;
    margin-bottom: 18px;
    font-weight: 600;
    line-height: 1.45;
}

.security-note i {
    margin-top: 2px;
    flex-shrink: 0;
}


/* ==================================================
   USER CARD
================================================== */

.user-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.user-card span,
.user-card small {
    color: #64748b;
    font-size: 13px;
    display: block;
}

.user-card b {
    font-size: 20px;
    color: #0f172a;
    display: block;
    margin-top: 2px;
}

.user-card button {
    border: 0;
    border-radius: 14px;
    padding: 10px 14px;
    background: #fff1f2;
    color: #e11d48;
    font-weight: 800;
    white-space: nowrap;
}


/* ==================================================
   SECTION TITLE
================================================== */

.section-title {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 20px;
}

.section-title.compact {
    margin-bottom: 14px;
}

.section-title h4 {
    margin: 0;
    font-weight: 850;
    letter-spacing: -0.02em;
    color: #0f172a;
}

.section-title p {
    margin: 4px 0 0;
    color: #64748b;
    line-height: 1.45;
}

.section-title > i {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    background: #eff6ff;
    color: #2563eb;
    font-size: 22px;
    flex-shrink: 0;
}


/* ==================================================
   FORM
================================================== */

label {
    font-weight: 700;
    color: #334155;
    margin-bottom: 8px;
    font-size: 14px;
}

.input-icon {
    position: relative;
}

.input-icon > i {
    position: absolute;
    top: 50%;
    left: 15px;
    transform: translateY(-50%);
    color: #64748b;
    z-index: 2;
    pointer-events: none;
}

.form-control,
.form-select {
    min-height: 52px;
    border-radius: 16px;
    border: 1px solid #dbe3ef;
    padding-left: 44px;
    background-color: #ffffff;
    color: #0f172a;
    font-weight: 500;
}

.form-control::placeholder {
    color: #94a3b8;
}

.form-control:focus,
.form-select:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.13);
}


/* ==================================================
   REGISTER BUTTON
================================================== */

.btn-register {
    width: 100%;
    margin-top: 24px;
    min-height: 56px;
    border-radius: 18px;
    border: 0;
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    color: white;
    font-weight: 900;
    box-shadow: 0 14px 28px rgba(37, 99, 235, 0.28);
}


/* ==================================================
   CHECKTYPE BUTTONS
================================================== */

.attendance-type-panel {
    margin-bottom: 18px;
}

.checktype-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.check-btn {
    min-height: 112px;
    border: 2px solid #e2e8f0;
    border-radius: 26px;
    background: #ffffff;
    color: #334155;
    display: grid;
    place-items: center;
    gap: 2px;
    font-weight: 900;
    transition: 0.2s ease;
    cursor: pointer;
}

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

.check-btn i {
    font-size: 34px;
}

.check-btn span {
    font-size: 22px;
}

.check-btn small {
    color: #64748b;
    font-weight: 700;
}

.check-btn.active {
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 16px 36px rgba(15, 23, 42, 0.16);
}

.check-btn.active small {
    color: rgba(255, 255, 255, 0.82);
}

.check-btn.datang.active {
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    border-color: transparent;
}

.check-btn.pulang.active {
    background: linear-gradient(135deg, #f97316, #ef4444);
    border-color: transparent;
}


/* ==================================================
   ACTION BUTTONS
================================================== */

.action-row {
    display: grid;
    grid-template-columns: 1fr 1.4fr;
    gap: 14px;
    margin-top: 20px;
}

.btn {
    min-height: 54px;
    border-radius: 18px;
    font-weight: 850;
    border: none;
}

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

.btn-location {
    background: #eff6ff;
    color: #2563eb;
}

.btn-location:hover {
    background: #dbeafe;
    color: #1d4ed8;
}

.btn-execute {
    background: linear-gradient(135deg, #16a34a, #22c55e);
    color: white;
    box-shadow: 0 12px 28px rgba(34, 197, 94, 0.28);
}

.btn-execute:hover {
    color: white;
}


/* ==================================================
   MAP
================================================== */

#map {
    height: 420px;
    width: 100%;
    border-radius: 24px;
    overflow: hidden;
    border: 4px solid white;
    box-shadow: 0 12px 36px rgba(15, 23, 42, 0.10);
}

.leaflet-container {
    font-family: "Segoe UI", system-ui, sans-serif;
}

.leaflet-control-zoom {
    border: none !important;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14) !important;
}

.leaflet-control-zoom a {
    border: none !important;
}


/* ==================================================
   SWEETALERT
================================================== */

.swal2-popup {
    border-radius: 24px !important;
}

.swal2-title {
    letter-spacing: -0.03em;
}

.swal2-confirm {
    border-radius: 14px !important;
    font-weight: 800 !important;
}


/* ==================================================
   RESPONSIVE TABLET
================================================== */

@media (max-width: 992px) {
    .page-shell {
        padding: 20px;
    }

    .app-header-card {
        border-radius: 26px;
    }

    #map {
        height: 360px;
    }
}


/* ==================================================
   RESPONSIVE MOBILE
================================================== */

@media (max-width: 768px) {
    body {
        background:
            radial-gradient(circle at top left, rgba(59, 130, 246, 0.16), transparent 28%),
            linear-gradient(135deg, #f8fafc, #dbeafe);
    }

    .page-shell {
        padding: 14px;
    }

    .app-header-card {
        padding: 24px;
        border-radius: 24px;
    }

    .header-icon {
        display: none;
    }

    .app-header-card h1 {
        font-size: 30px;
    }

    .app-header-card p {
        font-size: 14px;
    }

    .panel-card,
    .user-card {
        padding: 20px;
        border-radius: 24px;
    }

    .user-card {
        align-items: flex-start;
        gap: 14px;
    }

    .user-card button {
        padding: 9px 12px;
        font-size: 13px;
    }

    .section-title {
        gap: 10px;
    }

    .section-title > i {
        width: 42px;
        height: 42px;
        font-size: 20px;
    }

    .checktype-buttons {
        gap: 10px;
    }

    .check-btn {
        min-height: 96px;
        border-radius: 22px;
    }

    .check-btn i {
        font-size: 28px;
    }

    .check-btn span {
        font-size: 18px;
    }

    .check-btn small {
        font-size: 12px;
    }

    .action-row {
        grid-template-columns: 1fr;
    }

    #map {
        height: 310px;
    }

    .install-banner {
        left: 12px;
        right: 12px;
        bottom: 12px;
        border-radius: 18px;
    }
}


/* ==================================================
   SMALL MOBILE
================================================== */

@media (max-width: 420px) {
    .page-shell {
        padding: 10px;
    }

    .app-header-card {
        padding: 20px;
    }

    .badge-soft {
        font-size: 12px;
        padding: 7px 11px;
    }

    .app-header-card h1 {
        font-size: 26px;
    }

    .panel-card,
    .user-card {
        padding: 16px;
    }

    .form-control,
    .form-select {
        min-height: 50px;
        font-size: 14px;
    }

    .btn {
        min-height: 52px;
        font-size: 14px;
    }

    #map {
        height: 280px;
    }
}
