/**
 * Presensia Admin — layout shell (sidebar, navbar, page hero, base components)
 * Loaded after presensia-foundation.css and presensia-saas.css
 */

/* Override: pastikan teks tombol selalu center */
body.presensia-saas a.btn,
body.presensia-saas button.btn {
    display: inline-grid !important;
    place-items: center !important;
}
:root {
    --navy: #1e3a5f;
    --navy-light: #2d5a87;
    --navy-hover: #2c5282;
    --white: #ffffff;
    --gray: #374151;
    --gray-light: #6b7280;
    --gray-bg: #f1f5f9;
    --border: #e2e8f0;
    --success: #059669;
    --danger: #dc2626;
    --warning: #d97706;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-lg: 0 10px 40px -10px rgba(0,0,0,0.15);
    --radius: 12px;
    --radius-sm: 8px;
    --touch: 44px;
}
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--gray-bg);
    min-height: 100vh;
    color: var(--gray);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Sidebar - Premium SaaS */
.app-layout { display: flex; min-height: 100vh; }
.app-sidebar {
    width: 260px;
    min-width: 260px;
    background: #1e293b;
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 250;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), min-width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    overflow-x: hidden;
}
.app-sidebar.is-collapsed {
    width: 80px;
    min-width: 80px;
}
.app-sidebar.is-collapsed .sidebar-brand-title,
.app-sidebar.is-collapsed .sidebar-link span,
.app-sidebar.is-collapsed .sidebar-user-info,
.app-sidebar.is-collapsed .sidebar-user-chevron { opacity: 0; visibility: hidden; white-space: nowrap; overflow: hidden; width: 0; min-width: 0; }
.app-sidebar.is-collapsed .sidebar-section { display: none; }
.app-sidebar.is-collapsed .sidebar-brand { justify-content: center; padding: 0; }
.app-sidebar.is-collapsed .sidebar-link { justify-content: center; padding: 10px; margin: 0 0.5rem; }
.app-sidebar.is-collapsed .sidebar-link i { margin: 0; }
.app-sidebar.is-collapsed .sidebar-user-btn { justify-content: center; padding: 10px; }
.app-sidebar.is-collapsed .sidebar-user-avatar { margin: 0; }
.app-sidebar.is-collapsed .sidebar-collapse-btn i { transform: rotate(180deg); }
.sidebar-header {
    padding: 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 64px;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: #fff; flex: 1; min-width: 0; }
.sidebar-brand:hover { color: #fff; opacity: 0.95; }
.sidebar-logo { height: 36px; width: auto; flex-shrink: 0; }
.sidebar-brand-title { font-size: 0.9375rem; font-weight: 700; transition: opacity 0.2s, visibility 0.2s; }
.sidebar-collapse-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.08);
    border: none;
    border-radius: 8px;
    color: #cbd5e1;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.25s ease, color 0.25s ease, transform 0.25s ease;
}
.sidebar-collapse-btn:hover { background: rgba(255,255,255,0.12); color: #fff; }
.sidebar-collapse-btn i { font-size: 1rem; transition: transform 0.3s ease; }
.sidebar-nav { flex: 1; padding: 1rem 0; overflow-y: auto; }
.sidebar-section {
    padding: 0.75rem 1rem 0.5rem;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8;
    transition: opacity 0.2s, visibility 0.2s;
}
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 1rem;
    margin: 0 0.5rem;
    color: #cbd5e1;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 8px;
    position: relative;
    transition: background 0.25s ease, color 0.25s ease;
}
.sidebar-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background: #2563eb;
    border-radius: 0 3px 3px 0;
    transition: height 0.25s ease;
}
.sidebar-link:hover { background: #334155; color: #fff; }
.sidebar-link:hover::before { height: 0; }
.sidebar-link.active { color: #fff; background: rgba(37, 99, 235, 0.2); }
.sidebar-link.active::before { height: 24px; background: #2563eb; }
.sidebar-link i { font-size: 1.25rem; width: 24px; text-align: center; flex-shrink: 0; }
.sidebar-footer { padding: 1rem; border-top: 1px solid rgba(255,255,255,0.08); }
.sidebar-user-dropdown { position: relative; }
.sidebar-user-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    color: #cbd5e1;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.875rem;
    text-align: left;
    transition: background 0.2s;
}
.sidebar-user-btn:hover { background: rgba(255,255,255,0.08); color: #fff; }
.sidebar-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #3b82f6;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8125rem;
    font-weight: 700;
    flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { display: block; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 0.75rem; color: #94a3b8; }
.sidebar-user-chevron { font-size: 0.75rem; transition: transform 0.2s; }
.sidebar-user-dropdown.open .sidebar-user-chevron { transform: rotate(180deg); }
.sidebar-user-menu {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    margin-bottom: 8px;
    background: #334155;
    border-radius: 10px;
    padding: 6px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
    z-index: 300;
}
.sidebar-user-dropdown.open .sidebar-user-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.sidebar-user-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    color: #cbd5e1;
    text-decoration: none;
    font-size: 0.875rem;
    border-radius: 8px;
    width: 100%;
    border: none;
    background: none;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
}
.sidebar-user-menu-item:hover { background: rgba(255,255,255,0.1); color: #fff; }
.sidebar-user-menu-logout { color: #f87171; }
.sidebar-user-menu-logout:hover { background: rgba(248,113,113,0.15); color: #fca5a5; }
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-left: 260px;
    min-width: 0;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.app-layout.sidebar-collapsed .main-wrapper { margin-left: 80px; }
.app-navbar {
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    height: 56px;
    background: #fff;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}
.navbar-toggle {
    display: none;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--gray);
    cursor: pointer;
    border-radius: 8px;
    font-size: 1.25rem;
}
.navbar-toggle:hover { background: var(--gray-bg); }
.navbar-spacer { flex: 1; }
.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;
}
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 249;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
}
.sidebar-overlay.open { display: block; opacity: 1; pointer-events: auto; }
@media (max-width: 991px) {
    .app-sidebar { transform: translateX(-100%); width: 260px; min-width: 260px; }
    .app-sidebar.open { transform: translateX(0); }
    .app-sidebar.is-collapsed { width: 260px; min-width: 260px; }
    .app-layout.sidebar-collapsed .main-wrapper,
    .main-wrapper { margin-left: 0; }
    .navbar-toggle { display: flex; }
    .sidebar-collapse-btn { display: none; }
}

/* Main Content - Modern spacing */
.main-content {
    flex: 1;
    max-width: 1280px;
    width: 100%;
    margin: 0 auto;
    padding: 1.5rem 1.25rem 2.5rem;
}
@media (min-width: 768px) {
    .main-content { padding: 2rem 2rem 3.5rem; }
}
@media (min-width: 1024px) {
    .main-content { padding: 2.5rem 2.5rem 4rem; }
}

.page-title { font-size: 1.5rem; font-weight: 700; color: var(--navy); margin-bottom: 4px; }
.page-subtitle { font-size: 0.875rem; color: var(--gray-light); margin-bottom: 1.5rem; }

/* Page Hero - header seragam untuk semua halaman admin */
.page-hero {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f2744 100%);
    border-radius: 16px;
    padding: 2rem 1.5rem;
    color: #fff;
    margin-bottom: 2rem;
    box-shadow: 0 10px 40px -10px rgba(15, 23, 42, 0.35);
}
@media (min-width: 768px) {
    .page-hero { padding: 2.25rem 2rem; margin-bottom: 2.25rem; }
}
.page-hero h1 { font-size: 1.5rem; font-weight: 800; margin-bottom: 4px; letter-spacing: -0.02em; }
.page-hero p, .page-hero .page-hero-subtitle { font-size: 0.875rem; color: rgba(255,255,255,0.75); margin-bottom: 0; }
.page-hero-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 1.25rem; }
.page-hero-actions input[type="month"],
.page-hero-actions input[type="date"],
.page-hero-actions select {
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.1);
    color: #fff;
    font-size: 0.9375rem;
}
.page-hero-actions .ts-wrapper {
    min-height: 40px;
}
.page-hero-actions .ts-wrapper .ts-control {
    min-height: 40px !important;
    padding: 10px 14px !important;
    font-size: 0.9375rem !important;
    font-weight: 500 !important;
    border: 1px solid rgba(255,255,255,0.2) !important;
    background: rgba(255,255,255,0.1) !important;
    color: #fff !important;
}
.page-hero-actions .ts-wrapper .ts-control .item,
.page-hero-actions .ts-wrapper .ts-control input {
    color: #fff !important;
    font-size: 0.9375rem !important;
}
.page-hero-actions .btn { background: rgba(255,255,255,0.2); border: 1px solid rgba(255,255,255,0.3); }
.page-hero-actions .btn:hover { background: rgba(255,255,255,0.28); }
.page-hero-actions .btn-outline { background: transparent; color: #fff; border-color: rgba(255,255,255,0.5); }
.page-hero-actions .btn-outline:hover { background: rgba(255,255,255,0.15); }
.page-hero-actions:empty { display: none; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0 16px;
    min-height: 40px;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    font-family: inherit;
    transition: background 0.2s ease;
}
.btn:hover { background: #1d4ed8; color: #fff; }
.btn-sm { padding: 8px 14px; min-height: 36px; font-size: 0.8125rem; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #b91c1c; }
.btn-outline { background: transparent; color: #2563eb; border: 2px solid #2563eb; }
.btn-outline:hover { background: #eff6ff; color: #1d4ed8; border-color: #1d4ed8; }

.card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.08);
    overflow: hidden;
    margin-bottom: 20px;
}
.card > h3,
.card > form > h3:first-child {
    background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
    color: #fff;
    padding: 16px 20px;
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
}
.card form > h3:not(:first-child) {
    background: transparent;
    color: #1e293b;
    border-bottom: 2px solid var(--border);
    padding: 18px 0 12px;
    margin-top: 8px;
    margin-bottom: 12px;
}
.card > form { padding: 20px; }
.card > form > h3:first-child { margin: -20px -20px 20px -20px; padding: 16px 20px; }
.card > h3 ~ * { padding-left: 20px; padding-right: 20px; padding-bottom: 20px; }
.card > h3 ~ *:first-of-type { padding-top: 20px; }
@media (min-width: 768px) {
    .card > form { padding: 24px; }
    .card > form > h3:first-child { margin: -24px -24px 20px -24px; padding: 16px 24px; }
}

.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 12px;
}
.table-wrap table { width: 100%; min-width: 720px; border-collapse: collapse; font-size: 0.875rem; }
.table-wrap th {
    text-align: left;
    padding: 14px 16px;
    background: #f1f5f9;
    color: #64748b;
    font-weight: 600;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}
.table-wrap td { padding: 14px 16px; border-bottom: 1px solid #f1f5f9; color: #374151; }
.table-wrap tbody tr { transition: background 0.2s ease; }
.table-wrap tbody tr:hover { background: #f8fafc; }

.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 0.8125rem; font-weight: 600; color: var(--gray); margin-bottom: 6px; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    min-height: 42px;
    padding: 8px 12px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 0.875rem;
    font-family: inherit;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: #2563eb;
}

.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 1rem; font-size: 0.875rem; }
.alert-success { background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; }
.alert-error { background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; }
.text-error { font-size: 0.75rem; color: var(--danger); margin-top: 4px; }

.flex-wrap { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
    min-height: 42px;
    padding: 8px 12px;
    border-radius: 10px;
    border: 2px solid var(--border);
}
.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 th, table.dataTable td { vertical-align: middle; }

/* App footer (layouts/footer.blade.php) */
.app-footer {
    padding: 12px 24px;
    border-top: 1px solid var(--border, #e2e8f0);
    background: #fff;
    font-size: 0.8125rem;
    color: #64748b;
}
.app-footer .footer-inner { max-width: 1280px; margin: 0 auto; }

@media (max-width: 640px) {
    .main-content { padding: 1.25rem 0.75rem 2rem; }
    .card { padding: 1.25rem; }
    .btn { font-size: 0.8125rem; padding: 8px 14px; }
    .table-wrap { margin: 0 -0.75rem; }
    .table-wrap table { min-width: 640px; }
    .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);
    }
}
    