/**
 * Presensia Employee — app layout shell (header, bottom nav, theme-employee base)
 * Loaded after presensia-foundation.css on layouts.app
 */

:root {
    --primary: #3B82F6;
    --header-dark: #1E3A5F;
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --bg: #F5F7FB;
    --card: #FFFFFF;
    --border: #E5E7EB;
    --radius: 16px;
    --shadow: 0 10px 25px rgba(0,0,0,0.08);
    --navy: #1e3a5f;
    --navy-light: #2d5a87;
    --navy-bg: #162d4a;
    --card-bg: rgba(255,255,255,0.1);
    --card-border: rgba(255,255,255,0.1);
    --text: #fff;
    --text-muted: rgba(255,255,255,0.85);
    --radius: 12px;
    --radius-lg: 16px;
    --transition: all 0.2s ease;
    --employee-bottom-nav-space: calc(112px + env(safe-area-inset-bottom, 0px));
}
[class$="-back"] svg { width: 20px; height: 20px; }
.bottom-nav-fab svg { width: 24px; height: 24px; }
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: 'Inter', 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(165deg, var(--navy-bg) 0%, var(--navy) 40%, var(--navy-light) 100%);
    min-height: 100vh;
    color: var(--text);
    padding: 0 16px 20px;
    padding-bottom: env(safe-area-inset-bottom, 24px);
    overflow-x: hidden;
}
body.theme-employee {
    padding: 0;
    padding-bottom: 0;
}

.app-header {
    padding: 16px 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}
.app-header-custom {
    position: relative;
    width: 100%;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.app-header-custom__main {
    flex: 1;
    min-width: 0;
}
.app-header-custom__main > [class$="-header"],
.app-header-custom__main > .gh-header {
    width: 100%;
}
.app-header-notif-slot {
    position: relative;
    top: auto;
    right: auto;
    flex-shrink: 0;
    align-self: flex-start;
    z-index: 40;
}
.app-header-custom:has(.gh-header) > .app-header-notif-slot,
.app-header-custom .gh-header ~ .app-header-notif-slot {
    display: none !important;
}
.app-header-brand { font-size: 18px; font-weight: 700; color: var(--text); text-decoration: none; display: flex; align-items: center; gap: 8px; }
.app-header-brand img {
    height: 36px;
    width: auto;
    object-fit: contain;
}
.app-header-links { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.demo-readonly-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #065f46;
    background: rgba(16,185,129,0.14);
    border: 1px solid rgba(16,185,129,0.35);
    white-space: nowrap;
}
.btn-header {
    padding: 8px 14px;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    color: var(--text);
    font-size: 13px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
}
.btn-header:hover { background: rgba(255,255,255,0.2); color: var(--text); }
.btn-block {
    display: block;
    width: 100%;
    text-align: center;
}

.app-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid var(--card-border);
}
.app-card-lg { padding: 28px; }

.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 14px;
}
.alert-success { background: rgba(76,175,80,0.25); border: 1px solid rgba(76,175,80,0.5); }
.alert-error { background: rgba(244,67,54,0.25); border: 1px solid rgba(244,67,54,0.5); }

.page-title { font-size: 19px; font-weight: 700; margin-bottom: 4px; }
.page-subtitle { font-size: 14px; opacity: 0.9; margin-bottom: 20px; }
.back-link {
    display: inline-flex; align-items: center; gap: 6px;
    color: var(--text-muted); text-decoration: none; font-size: 15px; font-weight: 500;
}
.back-link:hover { color: var(--text); }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; opacity: 0.95; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: 12px 16px;
    border-radius: 10px; border: 2px solid rgba(255,255,255,0.25);
    background: rgba(255,255,255,0.1); color: var(--text);
    font-size: 15px; font-family: inherit;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none; border-color: rgba(255,255,255,0.4);
}
.form-group select option { background: var(--navy-light); color: var(--text); }
.period-select select {
    width: 100%; padding: 14px 16px;
    background: var(--navy-light); border: 1px solid rgba(255,255,255,0.2);
    border-radius: 12px; color: var(--text); font-size: 15px; font-weight: 500;
    cursor: pointer; appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.8)' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 14px center;
    padding-right: 44px;
}
.period-select select option { background: var(--navy-light); color: var(--text); }
.text-error { font-size: 12px; color: #ffcdd2; margin-top: 4px; }

.btn-primary {
    display: block; width: 100%; padding: 14px 20px;
    background: var(--success); color: #fff;
    border: none; border-radius: 12px;
    font-size: 16px; font-weight: 600; cursor: pointer;
    text-align: center; text-decoration: none;
}
.btn-primary:active { transform: scale(0.98); }
.btn-secondary {
    display: inline-block; padding: 10px 18px;
    background: rgba(255,255,255,0.2);
    color: var(--text); border-radius: 10px;
    text-decoration: none; font-weight: 600; font-size: 14px;
}
.btn-secondary:hover { background: rgba(255,255,255,0.25); }

.empty-state {
    text-align: center; padding: 48px 24px;
    background: rgba(255,255,255,0.06);
    border-radius: var(--radius-lg);
    font-size: 15px; color: var(--text-muted); line-height: 1.6;
}

.list { display: flex; flex-direction: column; gap: 12px; }
.list-item {
    background: var(--card-bg); backdrop-filter: blur(12px);
    border-radius: var(--radius-lg); padding: 16px;
    border: 1px solid var(--card-border);
}
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -0.5rem; }
.table-wrap table { width: 100%; min-width: 640px; border-collapse: collapse; font-size: 0.875rem; }
.table-wrap th { text-align: left; padding: 10px 12px; border-bottom: 1px solid rgba(255,255,255,0.12); white-space: nowrap; }
.table-wrap td { padding: 10px 12px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.dataTables_wrapper { color: var(--text); }
.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.25);
    background: rgba(255,255,255,0.12);
    color: var(--text);
}
.dataTables_wrapper .dataTables_filter { margin-bottom: 8px; }
.dataTables_wrapper .dataTables_length { margin-bottom: 8px; }
.dataTables_wrapper .dataTables_paginate .paginate_button {
    padding: 4px 10px;
    margin: 0 2px;
}
table.dataTable { color: var(--text); }
table.dataTable tbody tr { background: transparent; }
table.dataTable tbody tr:hover { background: rgba(255,255,255,0.06); }
table.dataTable td, table.dataTable th { border-bottom-color: rgba(255,255,255,0.12); }

.app-main { padding: 0 16px; max-width: 100%; min-width: 0; }
.app-main.has-bottom-nav {
    padding-bottom: var(--employee-bottom-nav-space) !important;
    scroll-padding-bottom: var(--employee-bottom-nav-space);
}

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(64px + env(safe-area-inset-bottom, 0px));
    background: rgba(255,255,255,0.98);
    border-top: 1px solid rgba(226,232,240,0.96);
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px));
    z-index: 100;
    box-shadow: 0 -10px 28px -24px rgba(15,23,42,0.28);
    isolation: isolate;
}
.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: #9ca3af;
    text-decoration: none;
    font-size: 11px;
    font-weight: 500;
    padding: 8px 4px;
    border-radius: 12px;
    transition: var(--transition);
}
.bottom-nav-item:active { transform: scale(0.96); }
.bottom-nav-item.active { color: var(--primary); }
.bottom-nav-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.bottom-nav-icon svg { width: 22px; height: 22px; }
.bottom-nav-fab {
    position: relative;
    top: -20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 10px;
    font-weight: 600;
    transition: var(--transition);
}
.bottom-nav-fab-checkin,
.bottom-nav-fab-checkout {
    background: linear-gradient(135deg, var(--primary) 0%, #2563eb 100%);
    box-shadow: 0 12px 24px -12px rgba(59,130,246,0.45);
}
.bottom-nav-fab-disabled {
    background: linear-gradient(135deg, #6b7280 0%, #9ca3af 100%);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    cursor: default;
    pointer-events: none;
}
.bottom-nav-fab:active { transform: scale(0.96); }
.bottom-nav-fab svg { width: 24px; height: 24px; margin-bottom: -2px; }

body.theme-employee .bottom-nav-item {
    font-size: 10px;
    gap: 3px;
    padding: 6px 2px;
}
body.theme-employee .bottom-nav-icon svg {
    width: 20px;
    height: 20px;
}
body.theme-employee .bottom-nav-fab {
    width: 50px;
    height: 50px;
    top: -18px;
    font-size: 9px;
}
body.theme-employee .bottom-nav-fab svg {
    width: 20px;
    height: 20px;
}

@media (max-width: 640px) {
    .app-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .app-header-links {
        width: 100%;
        overflow-x: auto;
        padding-bottom: 2px;
    }
    .btn-header {
        font-size: 12px;
        padding: 6px 10px;
        white-space: nowrap;
    }
    .demo-readonly-badge {
        font-size: 0.6875rem;
        padding: 5px 8px;
        color: #ecfdf5;
        background: #047857;
        border-color: #10b981;
        box-shadow: 0 4px 12px rgba(4,120,87,0.35);
    }
    .app-header-brand { font-size: 16px; }
    .app-header-brand img { height: 32px; }
    .app-card { padding: 16px; }
    .table-wrap { margin: 0 -0.75rem; }
    .table-wrap table { min-width: 520px; }
    .app-main.has-bottom-nav {
        padding-bottom: calc(118px + env(safe-area-inset-bottom, 0px)) !important;
    }
}
@media (max-width: 414px) {
    body:not(.theme-employee) { padding: 0 14px 18px; }
    body:not(.theme-employee) .app-main { padding: 0; }
    .app-main.has-bottom-nav {
        padding-bottom: calc(122px + env(safe-area-inset-bottom, 0px)) !important;
    }
}
@media (max-width: 360px) {
    body:not(.theme-employee) { padding: 0 12px 16px; }
    .app-main.has-bottom-nav {
        padding-bottom: calc(128px + env(safe-area-inset-bottom, 0px)) !important;
    }
}
    