/* =========================================================
   MITSURI ABSENSI - MODERN MOBILE-FIRST CSS
   Subfolder: /absensi/
   ========================================================= */

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

:root {
    --primary: #0284c7;
    --primary-hover: #0369a1;
    --primary-light: #e0f2fe;
    --success: #10b981;
    --success-light: #d1fae5;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --dark: #0f172a;
    --dark-card: #1e293b;
    --text-main: #334155;
    --text-muted: #64748b;
    --bg-body: #f8fafc;
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
    --radius-lg: 20px;
    --radius-md: 14px;
    --radius-sm: 8px;
    --shadow-soft: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.03);
    --shadow-glow: 0 0 20px rgba(2, 132, 199, 0.25);
}

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

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 0;
    -webkit-font-smoothing: antialiased;
}

/* Mobile App Wrapper */
.mobile-app-container {
    width: 100%;
    max-width: 480px;
    min-height: 100vh;
    background: #ffffff;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    position: relative;
    padding-bottom: 30px;
}

/* Top App Header */
.app-header {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    color: #ffffff;
    padding: 20px 20px 24px 20px;
    border-bottom-left-radius: 24px;
    border-bottom-right-radius: 24px;
    box-shadow: 0 10px 20px rgba(2, 132, 199, 0.15);
    position: relative;
    overflow: hidden;
}

.app-header::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 200px;
    height: 200px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    pointer-events: none;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.brand-badge {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-icon {
    width: 38px;
    height: 38px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(8px);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #ffffff;
}

.brand-title {
    font-family: 'Outfit', sans-serif;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 0.5px;
    line-height: 1.1;
}

.brand-subtitle {
    font-size: 11px;
    opacity: 0.85;
    font-weight: 400;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-header-icon {
    background: rgba(255, 255, 255, 0.18);
    border: none;
    color: #ffffff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-header-icon:hover {
    background: rgba(255, 255, 255, 0.3);
    color: #ffffff;
    transform: scale(1.05);
}

/* User Profile Mini Bar */
.user-profile-bar {
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    padding: 12px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 42px;
    height: 42px;
    background: #ffffff;
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.user-name {
    font-weight: 700;
    font-size: 15px;
    line-height: 1.2;
}

.user-sub {
    font-size: 12px;
    opacity: 0.85;
}

.role-badge {
    background: rgba(255, 255, 255, 0.25);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Main Content Area */
.app-body {
    padding: 18px 16px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* Digital Clock Card */
.clock-card {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: #ffffff;
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-soft);
}

.time-big {
    font-family: 'Outfit', sans-serif;
    font-size: 26px;
    font-weight: 800;
    letter-spacing: 1px;
    color: #38bdf8;
    line-height: 1.1;
}

.date-small {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 2px;
}

/* Card Sections */
.app-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 18px;
    box-shadow: var(--shadow-soft);
    position: relative;
}

.card-header-clean {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.card-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-title i {
    color: var(--primary);
}

/* =========================================================
   LIVE CAMERA & SELFIE COMPONENT
   ========================================================= */
.camera-container {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    background: #0f172a;
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

/* Face Alignment Guide Frame */
.face-guide-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60%;
    height: 75%;
    border: 2.5px dashed rgba(255, 255, 255, 0.7);
    border-radius: 50%;
    pointer-events: none;
    box-shadow: 0 0 0 9999px rgba(15, 23, 42, 0.35);
}

.face-guide-text {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(4px);
    color: #ffffff;
    font-size: 11px;
    padding: 4px 12px;
    border-radius: 20px;
    white-space: nowrap;
    pointer-events: none;
}

#photo-preview-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-md);
}

.camera-actions {
    margin-top: 12px;
    display: flex;
    justify-content: center;
    gap: 10px;
}

.btn-snap {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    color: #ffffff;
    border: none;
    padding: 10px 24px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.3);
    transition: all 0.2s;
}

.btn-snap:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(2, 132, 199, 0.4);
}

.btn-retake {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
    padding: 10px 20px;
    border-radius: 30px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.btn-retake:hover {
    background: #e2e8f0;
}

/* =========================================================
   GEOFENCING & LEAFLET MAP
   ========================================================= */
.map-box {
    width: 100%;
    height: 220px;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-color);
    position: relative;
    background: #e2e8f0;
}

#map {
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* Status Badges */
.status-badge {
    padding: 8px 14px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.status-badge.success {
    background-color: var(--success-light);
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.status-badge.danger {
    background-color: var(--danger-light);
    color: #991b1b;
    border: 1px solid #fecaca;
}

.status-badge.warning {
    background-color: var(--warning-light);
    color: #92400e;
    border: 1px solid #fde68a;
}

.status-badge.error {
    background-color: #f1f5f9;
    color: #64748b;
    border: 1px solid #cbd5e1;
}

.gps-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 12px;
}

.gps-info-item {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    padding: 10px 12px;
    border-radius: var(--radius-sm);
}

.gps-info-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
}

.gps-info-value {
    font-size: 14px;
    font-weight: 700;
    color: var(--dark);
    margin-top: 2px;
}

/* Map Markers Styling */
.pin-marker {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 16px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    position: relative;
}

.pin-marker.office {
    background: #0284c7;
    border: 2px solid #ffffff;
}

.pin-marker.user {
    background: #10b981;
    border: 2px solid #ffffff;
}

/* Pulse Animation for Live GPS */
.pulse-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 3px solid #10b981;
    animation: pulseRadar 2s infinite;
    pointer-events: none;
}

@keyframes pulseRadar {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(2.2); opacity: 0; }
}

/* =========================================================
   TODAY STATUS CARD & ACTION BUTTONS
   ========================================================= */
.today-summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.today-summary-card {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    padding: 12px;
    border-radius: var(--radius-md);
    text-align: center;
}

.today-summary-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}

.today-summary-card .val {
    font-size: 18px;
    font-weight: 800;
    margin-top: 4px;
    font-family: 'Outfit', sans-serif;
}

.attendance-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.btn-absen {
    border: none;
    padding: 14px 12px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s;
    text-align: center;
}

.btn-absen i {
    font-size: 20px;
}

.btn-absen.masuk {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff;
    box-shadow: 0 6px 14px rgba(16, 185, 129, 0.3);
}

.btn-absen.masuk:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(16, 185, 129, 0.4);
}

.btn-absen.pulang {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: #ffffff;
    box-shadow: 0 6px 14px rgba(59, 130, 246, 0.3);
}

.btn-absen.pulang:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(59, 130, 246, 0.4);
}

.btn-absen:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    filter: grayscale(0.7);
    box-shadow: none !important;
    transform: none !important;
}

.btn-izin-link {
    display: block;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    margin-top: 10px;
    cursor: pointer;
}

.btn-izin-link:hover {
    color: var(--primary);
}

/* =========================================================
   HISTORY LIST ITEMS
   ========================================================= */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: background 0.2s;
}

.history-item:hover {
    background: #f1f5f9;
}

.history-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.history-icon-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #ffffff;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
}

.history-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--dark);
}

.history-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.history-distance {
    font-size: 10px;
    font-weight: 600;
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    margin-top: 3px;
}

.history-distance.badge-in-radius {
    background: var(--success-light);
    color: #065f46;
}

.history-distance.badge-out-radius {
    background: var(--danger-light);
    color: #991b1b;
}

.history-photo-thumb {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    object-fit: cover;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    transition: transform 0.2s;
}

.history-photo-thumb:hover {
    transform: scale(1.1);
}

/* =========================================================
   LOGIN & AUTH SECTION
   ========================================================= */
.auth-wrapper {
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 100vh;
}

.auth-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 28px 22px;
    box-shadow: var(--shadow-soft);
}

.auth-header {
    text-align: center;
    margin-bottom: 24px;
}

.auth-logo {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    color: #ffffff;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    margin: 0 auto 14px auto;
    box-shadow: 0 8px 20px rgba(2, 132, 199, 0.3);
}

.auth-title {
    font-family: 'Outfit', sans-serif;
    font-size: 22px;
    font-weight: 800;
    color: var(--dark);
}

.auth-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 6px;
}

.form-control-custom {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s;
    background: #f8fafc;
}

.form-control-custom:focus {
    outline: none;
    border-color: var(--primary);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.btn-primary-custom {
    width: 100%;
    padding: 13px;
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.25);
    transition: all 0.2s;
}

.btn-primary-custom:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(2, 132, 199, 0.35);
}

.demo-account-pills {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px dashed var(--border-color);
}

.demo-pills-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 8px;
    text-align: center;
}

.demo-buttons-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.btn-demo-pill {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    font-size: 11px;
    font-weight: 600;
    color: var(--dark);
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
}

.btn-demo-pill:hover {
    background: #e2e8f0;
    border-color: var(--primary);
}

/* =========================================================
   CUSTOM TOAST ALERTS
   ========================================================= */
#toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 420px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.custom-toast {
    pointer-events: auto;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    background: #ffffff;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: slideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    border-left: 4px solid var(--primary);
    font-size: 13px;
    font-weight: 600;
}

.custom-toast.toast-success { border-left-color: var(--success); color: #065f46; background: #ecfdf5; }
.custom-toast.toast-danger { border-left-color: var(--danger); color: #991b1b; background: #fef2f2; }
.custom-toast.toast-warning { border-left-color: var(--warning); color: #92400e; background: #fffbeb; }

.toast-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: inherit;
    opacity: 0.6;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-out {
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s;
}
