/* ─────────────────────────────────────────
   AbrahamHR — app.css
   ───────────────────────────────────────── */

/* ── Brand fonts (hosted locally — no runtime CDN) ── */
@font-face {
    font-family: 'American Typewriter';
    src: url('../fonts/AmericanTypewriter-Bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Open Sans';
    src: url('../fonts/OpenSans.woff2') format('woff2');
    font-weight: 400 700;   /* variable font covers regular→bold */
    font-style: normal;
    font-display: swap;
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    /* Abraham brand palette */
    --color-teal:       #48bec0;
    --color-orange:     #ff864a;
    --color-cream:      #f4eec3;
    --color-yellow:     #ffd254;
    --color-red:        #f04b49;
    --color-gold:       #ba9847;

    --color-primary:    #48bec0;   /* teal */
    --color-primary-d:  #2f9799;   /* darker teal for hover/depth */
    --color-accent:     #ff864a;   /* orange */
    --color-bg:         #F8F9FA;
    --color-surface:    #FFFFFF;
    --color-border:     #E5E7EB;
    --color-text:       #1f2937;
    --color-text-muted: #6B7280;
    --color-danger:     #f04b49;
    --color-success:    #16A34A;
    --color-warning:    #ff864a;
    --sidebar-w:        220px;
    --topbar-h:         56px;
    --radius:           8px;
    --shadow:           0 1px 3px rgba(0,0,0,.1);

    --font-brand: 'American Typewriter', Georgia, serif;
    --font-body:  'Open Sans', system-ui, -apple-system, sans-serif;
}

body { font-family: var(--font-body); font-size: 14px;
       background: var(--color-bg); color: var(--color-text); line-height: 1.5; }

/* Brand wordmark uses American Typewriter */
.sidebar-brand__name, .login-brand__name, .page-header h1 { font-family: var(--font-brand); }

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ── */
.app-layout { display: flex; flex-direction: row; min-height: 100vh; }

/* ── Sidebar ── */
.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: #00355e;
    display: flex; flex-direction: column;
    position: sticky; top: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 200;
}

.sidebar-brand {
    display: flex; align-items: center; gap: 10px;
    padding: 18px 16px 16px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    flex-shrink: 0;
}
.sidebar-brand__logo {
    width: 34px; height: 34px; object-fit: contain; border-radius: 6px; flex-shrink: 0;
}
.sidebar-brand__name {
    font-family: var(--font-brand); font-size: 15px; font-weight: 700;
    color: #fff; letter-spacing: .3px;
}

.nav { list-style: none; padding: 8px 0; flex: 1; }
.nav__section {
    font-size: 11px; font-weight: 600; letter-spacing: .08em;
    text-transform: uppercase; color: rgba(255,255,255,.6);
    padding: 16px 20px 5px;
}
.nav__link {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 20px;
    color: rgba(255,255,255,.75);
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: background .15s, color .15s, border-color .15s;
    font-size: 13.5px;
}
.nav__link:hover {
    background: rgba(255,255,255,.07);
    color: #fff; text-decoration: none;
}
.nav__link--active {
    background: rgba(255,255,255,.18);
    border-left-color: #fff;
    color: #fff; font-weight: 600;
}
.nav__icon { width: 20px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: inherit; }
.nav__icon svg { display: block; }
.nav__label { }

/* ── App main (right column) ── */
.app-main { flex: 1; display: flex; flex-direction: column; min-height: 100vh; overflow: hidden; }

/* ── Top bar ── */
.top-bar {
    position: sticky; top: 0; z-index: 100;
    height: var(--topbar-h);
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 28px; gap: 16px;
    box-shadow: var(--shadow);
    flex-shrink: 0;
}
.top-bar__search {
    display: flex; align-items: center; gap: 8px;
    background: var(--color-bg); border: 1px solid var(--color-border);
    border-radius: 99px; padding: 6px 16px;
    flex: 1; max-width: 480px;
    position: relative;
}
.search-dropdown {
    position: absolute; top: calc(100% + 8px); left: 0; right: 0;
    background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,.12);
    z-index: 500; overflow: hidden;
}
.search-dropdown__item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 16px; cursor: pointer; text-decoration: none;
    color: var(--color-text); transition: background .1s;
}
.search-dropdown__item:hover { background: var(--color-bg); text-decoration: none; }
.search-dropdown__avatar {
    width: 30px; height: 30px; border-radius: 50%;
    background: var(--color-teal); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700; flex-shrink: 0;
}
.search-dropdown__name { font-size: 13px; font-weight: 500; }
.search-dropdown__meta { font-size: 12px; color: var(--color-text-muted); }
.search-dropdown__empty { padding: 12px 16px; font-size: 13px; color: var(--color-text-muted); }
.top-bar__search-icon { color: var(--color-text-muted); flex-shrink: 0; }
.top-bar__search-input {
    border: none; background: transparent; outline: none;
    font-size: 13px; color: var(--color-text); width: 100%;
}
.top-bar__search-input::placeholder { color: var(--color-text-muted); }
.top-bar__user { display: flex; align-items: center; gap: 12px; }
.top-bar__avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--color-teal); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700; flex-shrink: 0;
}
.top-bar__name { font-size: 13px; font-weight: 500; }

.main-content { flex: 1; padding: 28px 32px; max-width: 100%; overflow-y: auto; }
.main-content--flush { padding: 0; }

/* ── Page header ── */
.page-header { margin-bottom: 24px; }
.page-header h1 { font-size: 22px; font-weight: 700; }
.page-header p { color: var(--color-text-muted); margin-top: 2px; }

/* ── Dashboard hero strip ── */
.dash-hero {
    background: var(--color-teal);
    border-radius: 12px;
    margin: 24px 28px 0;
    padding: 28px 32px;
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px;
}
.dash-hero__text { flex: 1; }
.dash-hero__greeting {
    font-family: var(--font-brand);
    font-size: 26px; font-weight: 700; color: #fff; line-height: 1.2;
}
.dash-hero__sub {
    font-size: 14px; color: rgba(255,255,255,.85); margin-top: 6px;
}
.dash-hero__logo {
    width: 72px; height: 72px; object-fit: contain;
    border-radius: 10px; flex-shrink: 0;
}

/* ── Dashboard stats ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; padding: 20px 28px 0; }

.stat-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 24px 20px;
    box-shadow: var(--shadow);
}
.stat-card__icon { font-size: 22px; margin-bottom: 10px; }
.stat-card__value { font-size: 36px; font-weight: 700; color: var(--color-primary); line-height: 1; }
.stat-card__label { color: var(--color-text-muted); margin-top: 6px; font-size: 13px; }

/* ── Dashboard quick links ── */
.dash-quick-links {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px; padding: 20px 28px 28px;
}
.quick-link-card {
    background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: var(--radius); padding: 20px 16px;
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    text-decoration: none; color: var(--color-text);
    font-size: 13px; font-weight: 500;
    box-shadow: var(--shadow);
    transition: box-shadow .15s, border-color .15s;
}
.quick-link-card:hover {
    border-color: var(--color-teal); box-shadow: 0 4px 12px rgba(72,190,192,.15);
    text-decoration: none; color: var(--color-text);
}
.quick-link-card__icon { font-size: 24px; }

/* ── Buttons ── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 8px 16px; border-radius: var(--radius);
    font-size: 14px; font-weight: 500; cursor: pointer;
    border: 1px solid transparent; text-decoration: none;
    transition: background .15s, opacity .15s;
}
.btn:hover { opacity: .9; text-decoration: none; }
.btn--primary  { background: var(--color-primary); color: #fff; }
.btn--danger   { background: var(--color-danger);  color: #fff; }
.btn--ghost    { background: transparent; border-color: var(--color-border); color: var(--color-text); }
.btn--sm       { padding: 5px 12px; font-size: 13px; }
.btn--full     { width: 100%; }

/* ── Forms ── */
.form__group { margin-bottom: 16px; }
.form__label { display: block; font-weight: 500; margin-bottom: 6px; font-size: 13px; }
.form__input, .form__select, .form__textarea {
    width: 100%; padding: 9px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 14px; background: var(--color-surface);
    color: var(--color-text);
    transition: border-color .15s;
}
.form__input:focus, .form__select:focus, .form__textarea:focus {
    outline: none; border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,.1);
}
.form__textarea { min-height: 80px; resize: vertical; }

/* ── Alerts ── */
.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; font-size: 14px; }
.alert--error   { background: #FEF2F2; border: 1px solid #FECACA; color: var(--color-danger); }
.alert--success { background: #F0FDF4; border: 1px solid #BBF7D0; color: var(--color-success); }
.alert--info    { background: #EFF6FF; border: 1px solid #BFDBFE; color: #1D4ED8; }

/* ── Role badges ── */
.role-badge {
    padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 600; text-transform: uppercase;
}
.role-badge--super_admin { background: #FEF3C7; color: #92400E; }
.role-badge--hr          { background: #EDE9FE; color: #5B21B6; }
.role-badge--manager     { background: #DBEAFE; color: #1E40AF; }
.role-badge--employee    { background: #F3F4F6; color: #374151; }

/* ── Table ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--color-surface);
        border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
thead { background: var(--color-bg); }
th, td { padding: 11px 16px; text-align: left; border-bottom: 1px solid var(--color-border); font-size: 13px; }
th { font-weight: 600; color: var(--color-text-muted); }
tbody tr:hover { background: #FAFAFA; }
tbody tr:last-child td { border-bottom: none; }

/* ── Card ── */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}
.card__title { font-size: 16px; font-weight: 600; margin-bottom: 16px; }

/* ── Login page ── */
.login-page {
    position: relative;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    min-height: 100vh; padding: 16px;
    background: #2b2b2b url('../img/login-bg.jpg') center/cover no-repeat fixed;
}
/* Dark overlay keeps focus on the sign-in card */
.login-page::before {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(180deg, rgba(20,20,20,.45) 0%, rgba(20,20,20,.55) 100%);
    z-index: 0;
}
.login-brand {
    position: relative; z-index: 1;
    text-align: center; margin-bottom: 24px; color: #fff;
}
.login-brand__logo {
    width: 84px; height: 84px; object-fit: contain;
    margin: 0 auto 12px; display: block;
    box-shadow: none;
}
.login-brand__name {
    font-size: 30px; font-weight: 700; letter-spacing: .5px;
    text-shadow: 0 2px 8px rgba(0,0,0,.4);
}
.login-brand__tagline {
    font-size: 14px; opacity: .9; margin-top: 2px;
    text-shadow: 0 1px 4px rgba(0,0,0,.4);
}
.login-card {
    position: relative; z-index: 1;
    background: var(--color-surface);
    border-radius: 16px;
    padding: 36px;
    width: 100%; max-width: 420px;
    box-shadow: 0 20px 50px rgba(0,0,0,.35);
}
.login-card__title { font-size: 22px; font-weight: 700; color: var(--color-text); margin-bottom: 4px; }
.login-card__subtitle { color: var(--color-text-muted); margin-bottom: 24px; font-size: 13px; }
/* Cream-tinted inputs on the login card */
.login-card .form__input {
    background: var(--color-cream);
    border-color: transparent;
}
.login-card .form__input:focus {
    background: #fffdf5;
    border-color: var(--color-primary);
}
.login-card .btn--primary { background: var(--color-primary); }
.login-card .btn--primary:hover { background: var(--color-primary-d); opacity: 1; }
.login-foot { text-align: center; margin-top: 16px; color: var(--color-text-muted); font-size: 12px; }

/* ── Modal ── */
.modal-overlay {
    position: fixed; inset: 0; z-index: 200;
    background: rgba(0,0,0,.45);
    display: flex; align-items: flex-start; justify-content: center;
    padding: 48px 16px; overflow-y: auto;
}
.modal-overlay[hidden] { display: none; }
.modal {
    background: var(--color-surface);
    border-radius: var(--radius);
    width: 100%; max-width: 640px;
    box-shadow: 0 10px 40px rgba(0,0,0,.2);
}
.modal__header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px 24px; border-bottom: 1px solid var(--color-border);
}
.modal__header h2 { font-size: 18px; font-weight: 600; }
.modal__close {
    background: none; border: none; font-size: 26px; line-height: 1;
    cursor: pointer; color: var(--color-text-muted);
}
.modal form { padding: 24px; }

/* ── Form grid (two columns) ── */
.form-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px;
}
.form-grid .form__group { margin-bottom: 16px; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

/* ── Profile layout ── */
.profile-header {
    display: flex; align-items: center; gap: 20px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 24px; margin-bottom: 20px; box-shadow: var(--shadow);
}
.avatar {
    width: 72px; height: 72px; border-radius: 50%;
    background: var(--color-primary); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 28px; font-weight: 600; flex-shrink: 0;
    object-fit: cover;
}
.profile-header__info h1 { font-size: 22px; }
.profile-header__info p { color: var(--color-text-muted); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--color-border); margin-bottom: 20px; }
.tab {
    padding: 10px 16px; cursor: pointer; background: none; border: none;
    border-bottom: 2px solid transparent; color: var(--color-text-muted);
    font-size: 14px; font-weight: 500;
}
.tab--active { color: var(--color-primary); border-bottom-color: var(--color-primary); }
.tab-panel[hidden] { display: none; }

.detail-row { display: flex; padding: 10px 0; border-bottom: 1px solid var(--color-border); }
.detail-row:last-child { border-bottom: none; }
.detail-row__label { width: 200px; flex-shrink: 0; color: var(--color-text-muted); font-weight: 500; }
.detail-row__value { flex: 1; }

/* ── Team grid ── */
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; }
.team-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 20px; text-align: center;
    box-shadow: var(--shadow); color: var(--color-text); text-decoration: none;
    transition: box-shadow .15s, transform .15s;
}
.team-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.1); transform: translateY(-2px); text-decoration: none; }
.team-card .avatar { margin: 0 auto 12px; }
.team-card__name { font-weight: 600; }

/* ── Reports grid ── */
.reports-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 800px) { .reports-grid { grid-template-columns: 1fr; } }

/* ── Org chart ── */
.org-chart { overflow-x: auto; padding: 16px 0; }
.org-tree { display: flex; justify-content: center; gap: 24px; }
.org-branch { display: flex; flex-direction: column; align-items: center; position: relative; }
.org-node {
    display: inline-flex; flex-direction: column; align-items: center;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 12px 16px; min-width: 140px; text-align: center;
    color: var(--color-text); text-decoration: none;
    box-shadow: var(--shadow); margin-bottom: 8px;
    transition: border-color .15s;
}
.org-node:hover { border-color: var(--color-primary); text-decoration: none; }
.org-node__name { font-weight: 600; font-size: 13px; margin-top: 6px; }
.org-node__role { color: var(--color-text-muted); font-size: 12px; }
.avatar--sm { width: 40px; height: 40px; font-size: 16px; }
.org-children {
    display: flex; gap: 20px; padding-top: 20px; position: relative;
    border-top: 2px solid var(--color-border);
    margin-top: 4px;
}

/* ── Profile header avatar (clickable) ── */
.profile-avatar-wrap {
    position: relative; cursor: pointer; flex-shrink: 0;
    border-radius: 50%; display: block;
    width: 72px; height: 72px;
}
.profile-avatar-wrap .avatar { width: 72px; height: 72px; font-size: 22px; }
.profile-avatar-overlay {
    position: absolute; inset: 0; border-radius: 50%;
    background: rgba(0,0,0,.45);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; transition: opacity .18s;
}
.profile-avatar-wrap:hover .profile-avatar-overlay { opacity: 1; }

/* ── Avatar upload ── */
.avatar-upload-group {
    display: flex; align-items: center; gap: 20px;
    padding: 20px; margin-bottom: 4px;
    background: var(--color-bg); border: 1px solid var(--color-border);
    border-radius: var(--radius);
}
.avatar-upload-circle {
    position: relative; flex-shrink: 0; cursor: pointer;
    width: 90px; height: 90px; border-radius: 50%; display: block;
}
.avatar-upload-preview {
    width: 90px; height: 90px; border-radius: 50%;
    background: #e5e7eb;
    display: flex; align-items: center; justify-content: center;
    color: #9ca3af; overflow: hidden;
}
.avatar-upload-preview img { width: 100%; height: 100%; object-fit: cover; }
.avatar-upload-overlay {
    position: absolute; inset: 0; border-radius: 50%;
    background: rgba(0,0,0,.45);
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    color: #fff; font-size: 11px; font-weight: 500;
    opacity: 0; transition: opacity .18s;
}
.avatar-upload-circle:hover .avatar-upload-overlay { opacity: 1; }
.avatar-upload-meta strong { font-size: 14px; font-weight: 600; display: block; margin-bottom: 4px; }
.avatar-upload-meta p { font-size: 12px; color: var(--color-text-muted); margin: 0; line-height: 1.5; }

/* ── Utility ── */
.text-muted  { color: var(--color-text-muted); }
.text-danger { color: var(--color-danger); }
.text-right  { text-align: right; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.flex { display: flex; }
.gap-2 { gap: 8px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

/* ── Hamburger toggle (hidden on desktop) ── */
.sidebar-toggle {
    display: none;
    background: none; border: none; cursor: pointer;
    color: var(--color-text-muted); padding: 4px; flex-shrink: 0;
    border-radius: var(--radius);
    transition: background .15s;
}
.sidebar-toggle:hover { background: var(--color-bg); }

/* ── Sidebar overlay (mobile) ── */
.sidebar-overlay {
    display: none;
    position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 190;
}
.sidebar-overlay.is-open { display: block; }

/* ── Responsive ── */
@media (max-width: 768px) {
    .sidebar-toggle { display: flex; align-items: center; justify-content: center; }

    .sidebar {
        position: fixed; left: 0; top: 0;
        transform: translateX(-100%);
        transition: transform .25s ease;
        z-index: 200;
        height: 100vh;
    }
    .sidebar.is-open { transform: translateX(0); }

    .app-main { width: 100%; }

    .top-bar__search { max-width: 100%; }
    .top-bar__name   { display: none; }

    .main-content { padding: 16px; }
    .page-header  { margin-bottom: 16px; }

    .dash-hero { margin: 12px 12px 0; padding: 20px; }
    .dash-hero__greeting { font-size: 20px; }
    .dash-hero__logo { width: 52px; height: 52px; }

    .stats-grid       { padding: 16px 16px 0; grid-template-columns: 1fr 1fr; }
    .dash-quick-links { padding: 16px; grid-template-columns: 1fr 1fr; }

    table { font-size: 12px; }
    th, td { padding: 8px 10px; }
}
