/* ============================================================
   HR Portal Stylesheet
   Design inspired by Mihaaru: clean white canvas, red accent,
   card-based layouts, modern typography.
   Mobile-first.
   ============================================================ */

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-body);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.features {display:none;}
img { max-width: 100%; height: auto; display: block; }
button { font-family: inherit; cursor: pointer; border: 0; background: none; }
a { color: var(--brand); text-decoration: none; transition: color .15s ease; }
a:hover { color: var(--brand-dark); }
input, select, textarea { font-family: inherit; font-size: 1rem; }

/* ---------- Tokens ---------- */
:root {
    --brand:        #E7342B;   /* Mihaaru red */
    --brand-dark:   #B71C14;
    --brand-soft:   #FEF2F2;
    --brand-softer: #FEE4E2;

    --text-primary:   #111827;
    --text-secondary: #4B5563;
    --text-muted:     #9CA3AF;

    --bg-body:    #FAFAFA;
    --bg-card:    #FFFFFF;
    --bg-subtle:  #F3F4F6;

    --border:        #E5E7EB;
    --border-strong: #D1D5DB;

    --success: #10B981;
    --warning: #F59E0B;
    --danger:  #EF4444;
    --info:    #3B82F6;

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow:    0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -2px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.05);

    --radius-sm: 6px;
    --radius:    10px;
    --radius-lg: 16px;

    --container: 1200px;
}

/* ---------- Layout ---------- */
.container {
    width: 100%;
    max-width: var(--container);
    margin-inline: auto;
    padding-inline: 20px;
}

main { flex: 1; }

/* ---------- Header ---------- */
.site-header {
    background: #fff;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: saturate(180%) blur(10px);
    background: rgba(255,255,255,0.95);
}
.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    height: 68px;
}
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}
.brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--brand);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: 1rem;
    box-shadow: 0 4px 10px rgba(231,52,43,0.25);
}
.header-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}
.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px 6px 6px;
    border-radius: 999px;
    background: var(--bg-subtle);
    transition: background .15s ease;
}
.user-chip:hover { background: var(--border); }
.user-chip img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}
.user-chip .name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.95rem;
    transition: all .15s ease;
    white-space: nowrap;
    text-align: center;
    border: 1px solid transparent;
}
.btn-primary {
    background: var(--brand);
    color: #fff;
    box-shadow: 0 2px 6px rgba(231,52,43,0.25);
}
.btn-primary:hover { background: var(--brand-dark); color: #fff; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(231,52,43,0.35); }
.btn-secondary {
    background: #fff;
    color: var(--text-primary);
    border-color: var(--border);
}
.btn-secondary:hover { background: var(--bg-subtle); border-color: var(--border-strong); }
.btn-danger {
    background: var(--danger);
    color: #fff;
}
.btn-danger:hover { background: #DC2626; }
.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}
.btn-ghost:hover { background: var(--bg-subtle); color: var(--text-primary); }
.btn-sm { padding: 6px 12px; font-size: 0.85rem; }
.btn-block { width: 100%; }

/* ---------- Hero (Landing) ---------- */
.hero {
    padding: 64px 0 48px;
    background:
        radial-gradient(1200px 400px at 80% -10%, rgba(231,52,43,0.08), transparent 60%),
        radial-gradient(800px 300px at 0% 120%, rgba(231,52,43,0.05), transparent 60%),
        #fff;
    border-bottom: 1px solid var(--border);
}
.hero-inner {
    display: grid;
    gap: 40px;
    align-items: center;
}
@media (min-width: 900px) {
    .hero-inner { grid-template-columns: 1.1fr 0.9fr; gap: 60px; }
    .hero { padding: 96px 0 72px; }
}
.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--brand-soft);
    color: var(--brand-dark);
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}
.hero h1 {
    font-size: clamp(2rem, 5vw, 3.25rem);
    line-height: 1.1;
    letter-spacing: -0.03em;
    font-weight: 800;
    margin: 18px 0 16px;
    color: var(--text-primary);
}
.hero h1 .accent { color: var(--brand); }
.hero p.lead {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 540px;
}
.hero-actions { margin-top: 28px; }

.hero-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-lg);
}
.hero-card h3 {
    font-size: 1.2rem;
    margin-bottom: 6px;
    letter-spacing: -0.01em;
}
.hero-card p.muted { color: var(--text-secondary); margin-bottom: 20px; font-size: 0.95rem; }

/* Google button */
.google-btn-wrap {
    display: flex;
    justify-content: center;
    margin: 16px 0;
}
.divider-or {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin: 18px 0;
}
.divider-or::before, .divider-or::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}
.small-note {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 16px;
    line-height: 1.5;
}

/* ---------- Feature grid ---------- */
.section { padding: 56px 0; }
.section-head { text-align: center; margin-bottom: 40px; }
.section-head h2 {
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 10px;
}
.section-head p { color: var(--text-secondary); max-width: 640px; margin-inline: auto; }

.features-grid {
    display: grid;
    gap: 20px;
    grid-template-columns: 1fr;
}
@media (min-width: 640px) { .features-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .features-grid { grid-template-columns: repeat(3, 1fr); } }

.feature-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: all .2s ease;
}
.feature-card:hover {
    border-color: var(--brand-softer);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.feature-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--brand-soft);
    color: var(--brand);
    display: grid;
    place-items: center;
    margin-bottom: 16px;
}
.feature-card h3 {
    font-size: 1.05rem;
    margin-bottom: 6px;
    letter-spacing: -0.01em;
}
.feature-card p { color: var(--text-secondary); font-size: 0.95rem; }

/* ---------- Dashboard ---------- */
.page-header {
    padding: 32px 0 20px;
    border-bottom: 1px solid var(--border);
    background: #fff;
}
.page-header h1 {
    font-size: clamp(1.5rem, 3vw, 2rem);
    letter-spacing: -0.02em;
    font-weight: 800;
}
.page-header p { color: var(--text-secondary); margin-top: 6px; }

.forms-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: 1fr;
    margin-top: 24px;
}
@media (min-width: 640px) { .forms-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .forms-grid { grid-template-columns: repeat(3, 1fr); } }

.form-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: all .2s ease;
    position: relative;
    overflow: hidden;
}
.form-card::before {
    content: '';
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: var(--brand);
    opacity: 0;
    transition: opacity .2s ease;
}
.form-card:hover {
    border-color: var(--brand-softer);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.form-card:hover::before { opacity: 1; }
.form-card .form-title {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}
.form-card .form-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
    flex: 1;
}
.form-card .form-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
}
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--bg-subtle);
    color: var(--text-secondary);
}
.badge-brand { background: var(--brand-soft); color: var(--brand-dark); }
.badge-success { background: #ECFDF5; color: #047857; }
.badge-danger { background: #FEF2F2; color: #B91C1C; }
.badge-warning { background: #FFFBEB; color: #B45309; }

.form-card .arrow {
    color: var(--brand);
    font-weight: 700;
    font-size: 1rem;
}

/* ---------- Empty / No access ---------- */
.state-center {
    min-height: 60vh;
    display: grid;
    place-items: center;
    padding: 40px 20px;
    text-align: center;
}
.state-center .icon-lg {
    width: 72px;
    height: 72px;
    border-radius: 20px;
    background: var(--brand-soft);
    color: var(--brand);
    display: grid;
    place-items: center;
    margin: 0 auto 20px;
}
.state-center h2 {
    font-size: 1.6rem;
    letter-spacing: -0.02em;
    margin-bottom: 10px;
}
.state-center p {
    color: var(--text-secondary);
    max-width: 460px;
    margin: 0 auto 24px;
}

/* ---------- Admin layout ---------- */
.admin-shell {
    display: grid;
    gap: 0;
    grid-template-columns: 1fr;
    min-height: calc(100vh - 69px);
}
@media (min-width: 960px) {
    .admin-shell { grid-template-columns: 240px 1fr; }
}
.admin-sidebar {
    background: #fff;
    border-right: 1px solid var(--border);
    padding: 20px 12px;
}
@media (max-width: 959px) {
    .admin-sidebar {
        border-right: 0;
        border-bottom: 1px solid var(--border);
        padding: 12px;
        overflow-x: auto;
    }
    .admin-sidebar .sidebar-title { display: none; }
    .admin-nav { display: flex; gap: 8px; flex-wrap: nowrap; overflow-x: auto; }
    .admin-nav a { white-space: nowrap; }
}
.sidebar-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 8px 12px;
    margin-bottom: 4px;
}
.admin-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.admin-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    transition: all .1s ease;
}
.admin-nav a:hover { background: var(--bg-subtle); color: var(--text-primary); }
.admin-nav a.active { background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; }
.admin-nav a svg { flex-shrink: 0; }
.sidebar-section-label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 12px 12px 4px;
}
@media (max-width: 959px) {
    .sidebar-section-label { display: none; }
}

.admin-main {
    padding: 24px 20px;
    background: var(--bg-body);
}

/* ---------- Cards & Tables ---------- */
.card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.card-header {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.card-header h2, .card-header h3 {
    font-size: 1.05rem;
    letter-spacing: -0.01em;
    font-weight: 700;
}
.card-body { padding: 20px; }

.table-wrap { overflow-x: auto; }
table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}
table.data-table th, table.data-table td {
    text-align: left;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
table.data-table th {
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    background: var(--bg-subtle);
    white-space: nowrap;
}
table.data-table tr:last-child td { border-bottom: 0; }
table.data-table tbody tr { transition: background .1s ease; }
table.data-table tbody tr:hover { background: #FCFCFD; }

.table-actions {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
}

/* Mobile cards for tables */
@media (max-width: 720px) {
    table.data-table thead { display: none; }
    table.data-table, table.data-table tbody, table.data-table tr, table.data-table td { display: block; width: 100%; }
    table.data-table tr {
        border: 1px solid var(--border);
        border-radius: var(--radius);
        margin-bottom: 10px;
        padding: 10px;
    }
    table.data-table td {
        border: 0;
        padding: 6px 4px;
        display: flex;
        justify-content: space-between;
        gap: 10px;
    }
    table.data-table td::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: 0.78rem;
        text-transform: uppercase;
        color: var(--text-muted);
        letter-spacing: 0.04em;
    }
    .table-actions { justify-content: flex-start; }
}

/* ---------- Forms ---------- */
.field { margin-bottom: 14px; }
.field label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}
.input, .select, .textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--text-primary);
    transition: border-color .15s ease, box-shadow .15s ease;
}
.input:focus, .select:focus, .textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(231,52,43,0.15);
}
.textarea { min-height: 80px; resize: vertical; }

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.checkbox-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--brand);
    cursor: pointer;
}
.checkbox-row label { margin-bottom: 0; font-weight: 500; cursor: pointer; font-size: 0.95rem; }

.form-row {
    display: grid;
    gap: 14px;
    grid-template-columns: 1fr;
}
@media (min-width: 600px) {
    .form-row.cols-2 { grid-template-columns: 1fr 1fr; }
    .form-row.cols-3 { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- Modal ---------- */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(17,24,39,0.5);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 1000;
    backdrop-filter: blur(4px);
}
.modal-backdrop.open { display: flex; }
.modal {
    background: #fff;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: popin .18s ease;
}
@keyframes popin {
    from { opacity: 0; transform: translateY(10px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-head {
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-head h3 { font-size: 1.1rem; letter-spacing: -0.01em; }
.modal-close { color: var(--text-muted); font-size: 1.5rem; line-height: 1; padding: 4px; }
.modal-close:hover { color: var(--text-primary); }
.modal-body { padding: 22px; }
.modal-foot {
    padding: 16px 22px;
    border-top: 1px solid var(--border);
    background: var(--bg-subtle);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ---------- Flash messages ---------- */
.flash-wrap {
    position: fixed;
    top: 80px;
    right: 20px;
    left: 20px;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}
@media (min-width: 600px) {
    .flash-wrap { left: auto; max-width: 380px; }
}
.flash {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: var(--shadow-md);
    pointer-events: auto;
    animation: slidein .2s ease;
}
@keyframes slidein {
    from { opacity: 0; transform: translateX(10px); }
    to   { opacity: 1; transform: translateX(0); }
}
.flash.success { background: #ECFDF5; color: #065F46; border: 1px solid #A7F3D0; }
.flash.error   { background: #FEF2F2; color: #991B1B; border: 1px solid #FECACA; }
.flash.info    { background: #EFF6FF; color: #1E40AF; border: 1px solid #BFDBFE; }
.flash.warning { background: #FFFBEB; color: #92400E; border: 1px solid #FDE68A; }

/* ---------- Stats ---------- */
.stats-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: 1fr;
    margin-bottom: 24px;
}
@media (min-width: 600px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .stats-grid { grid-template-columns: repeat(4, 1fr); } }
.stat {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
}
.stat .label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.stat .value {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    margin-top: 4px;
}
.stat .value.brand { color: var(--brand); }

/* ---------- Footer ---------- */
.site-footer {
    background: #fff;
    border-top: 1px solid var(--border);
    padding: 28px 0;
    margin-top: 56px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}
.site-footer a { color: var(--text-secondary); }

/* ---------- Utilities ---------- */
.mt-0{margin-top:0}.mt-1{margin-top:8px}.mt-2{margin-top:16px}.mt-3{margin-top:24px}.mt-4{margin-top:32px}
.mb-0{margin-bottom:0}.mb-1{margin-bottom:8px}.mb-2{margin-bottom:16px}.mb-3{margin-bottom:24px}
.text-center{text-align:center}
.text-muted{color:var(--text-muted)}
.hidden{display:none !important}
.flex{display:flex}.flex-col{flex-direction:column}.gap-1{gap:8px}.gap-2{gap:16px}
.items-center{align-items:center}.justify-between{justify-content:space-between}
.w-full{width:100%}

.search-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    padding: 0 12px;
    max-width: 360px;
}
.search-bar input {
    border: 0;
    padding: 10px 0;
    outline: none;
    flex: 1;
    background: transparent;
}
.search-bar svg { color: var(--text-muted); flex-shrink: 0; }

/* Toggle switch */
.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
    position: absolute;
    inset: 0;
    background: #CBD5E1;
    border-radius: 999px;
    transition: all .15s ease;
    cursor: pointer;
}
.switch .slider::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 3px;
    left: 3px;
    background: #fff;
    border-radius: 50%;
    transition: all .15s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.switch input:checked + .slider { background: var(--brand); }
.switch input:checked + .slider::before { transform: translateX(18px); }

/* Dropdown */
.dropdown { position: relative; }
.dropdown-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    padding: 6px;
    display: none;
    z-index: 50;
}
.dropdown-menu.open { display: block; }
.dropdown-menu a, .dropdown-menu button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
    width: 100%;
    text-align: left;
}
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--bg-subtle); }
.dropdown-menu .danger { color: var(--danger); }
