/**
 * HRMS Pro — Frontend Stylesheet
 *
 * @package HRMS_Pro
 */

/* =========================================================
   CSS VARIABLES
   ========================================================= */
:root {
    --hrms-primary:       #4f46e5;
    --hrms-primary-dark:  #3730a3;
    --hrms-primary-light: #ede9fe;
    --hrms-secondary:     #64748b;
    --hrms-success:       #10b981;
    --hrms-danger:        #ef4444;
    --hrms-warning:       #f59e0b;
    --hrms-info:          #06b6d4;
    --hrms-dark:          #1e293b;
    --hrms-body-bg:       #f1f5f9;
    --hrms-card-bg:       #ffffff;
    --hrms-border:        #e2e8f0;
    --hrms-text:          #334155;
    --hrms-text-muted:    #94a3b8;
    --hrms-header-h:      64px;
    --hrms-sidebar-w:     240px;
    --hrms-sidebar-w-collapsed: 64px;
    --hrms-radius:        12px;
    --hrms-radius-sm:     8px;
    --hrms-shadow:        0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
    --hrms-shadow-md:     0 4px 6px -1px rgba(0,0,0,.08), 0 2px 4px -1px rgba(0,0,0,.06);
    --hrms-transition:    all .2s ease;
}

/* =========================================================
   BASE RESET
   ========================================================= */
.hrms-wrapper * { box-sizing: border-box; }
.hrms-wrapper {
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    color: var(--hrms-text);
    background: var(--hrms-body-bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
/* Remove WordPress theme interference */
.hrms-wrapper h1, .hrms-wrapper h2, .hrms-wrapper h3 { margin: 0; font-weight: 600; }
.hrms-wrapper a { text-decoration: none; color: inherit; }
.hrms-wrapper img { max-width: 100%; }

/* =========================================================
   LAYOUT
   ========================================================= */
.hrms-main-content {
    display: flex;
    flex: 1;
    padding-top: var(--hrms-header-h);
    min-height: 100vh;
}

.hrms-content-area {
    flex: 1;
    padding: 24px;
    margin-left: var(--hrms-sidebar-w);
    transition: margin-left .3s ease;
    max-width: 100%;
    overflow-x: hidden;
}

/* =========================================================
   HEADER
   ========================================================= */
.hrms-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--hrms-header-h);
    background: var(--hrms-dark);
    z-index: 1000;
    border-bottom: 1px solid rgba(255,255,255,.06);
}

.hrms-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 20px;
    gap: 16px;
}

.hrms-brand { display: flex; align-items: center; gap: 12px; }

.hrms-logo img { height: 36px; width: auto; }
.hrms-logo-text {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: -.3px;
}

.hrms-sidebar-toggle {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 6px;
    transition: var(--hrms-transition);
}
.hrms-sidebar-toggle:hover { background: rgba(255,255,255,.08); color: #fff; }

.hrms-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.hrms-header-time {
    display: flex;
    align-items: center;
    color: var(--hrms-text-muted);
    font-size: .875rem;
    font-feature-settings: 'tnum';
}

.btn-icon {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 1rem;
    padding: 6px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--hrms-transition);
}
.btn-icon:hover { background: rgba(255,255,255,.1); color: #fff; }

.user-avatar-sm {
    width: 34px; height: 34px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255,255,255,.15);
}
.user-avatar-sm-placeholder {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: var(--hrms-primary);
    display: flex; align-items: center; justify-content: center;
    font-size: .75rem; font-weight: 700; color: #fff;
}

/* =========================================================
   SIDEBAR
   ========================================================= */
.hrms-sidebar {
    position: fixed;
    top: var(--hrms-header-h);
    left: 0;
    width: var(--hrms-sidebar-w);
    height: calc(100vh - var(--hrms-header-h));
    background: var(--hrms-dark);
    overflow-y: auto;
    overflow-x: hidden;
    transition: width .3s ease;
    z-index: 900;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.1) transparent;
}

.hrms-nav { list-style: none; margin: 0; padding: 12px 8px; }
.hrms-nav-item { margin-bottom: 2px; }

.hrms-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    color: #94a3b8;
    font-size: .875rem;
    font-weight: 500;
    transition: var(--hrms-transition);
    white-space: nowrap;
}
.hrms-nav-link:hover { background: rgba(255,255,255,.06); color: #e2e8f0; }
.hrms-nav-link.active {
    background: var(--hrms-primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(79,70,229,.35);
}

.hrms-nav-icon { width: 18px; text-align: center; flex-shrink: 0; }

/* Collapsed sidebar */
.hrms-sidebar.collapsed { width: var(--hrms-sidebar-w-collapsed); }
.hrms-sidebar.collapsed .hrms-nav-label { display: none; }
.hrms-sidebar.collapsed ~ .hrms-content-area { margin-left: var(--hrms-sidebar-w-collapsed); }

/* =========================================================
   FOOTER
   ========================================================= */
.hrms-footer {
    display: flex;
    align-items: center;
    padding: 12px 24px;
    border-top: 1px solid var(--hrms-border);
    font-size: .8rem;
    color: var(--hrms-text-muted);
    background: var(--hrms-card-bg);
    margin-left: var(--hrms-sidebar-w);
}

/* =========================================================
   PAGE HEADER
   ========================================================= */
.hrms-page-header { margin-bottom: 24px; }
.hrms-page-title { font-size: 1.5rem; font-weight: 700; color: var(--hrms-dark); }
.hrms-page-sub { color: var(--hrms-text-muted); font-size: .875rem; margin-top: 4px; margin-bottom: 0; }

/* =========================================================
   CARDS
   ========================================================= */
.hrms-card {
    background: var(--hrms-card-bg);
    border-radius: var(--hrms-radius);
    box-shadow: var(--hrms-shadow);
    border: 1px solid var(--hrms-border);
    overflow: hidden;
}

.hrms-card-header {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    background: var(--hrms-dark);
    color: #e2e8f0;
    font-size: .9rem;
    font-weight: 600;
    border-bottom: 1px solid rgba(255,255,255,.06);
}

.hrms-card-body { padding: 20px; }

/* =========================================================
   BUTTONS
   ========================================================= */
.btn-hrms-primary {
    background: var(--hrms-primary);
    color: #fff;
    border: none;
    padding: 9px 20px;
    border-radius: 8px;
    font-size: .875rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--hrms-transition);
    display: inline-flex;
    align-items: center;
}
.btn-hrms-primary:hover { background: var(--hrms-primary-dark); color: #fff; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(79,70,229,.3); }
.btn-hrms-primary:disabled { opacity: .65; transform: none; }

.btn-hrms-danger {
    background: var(--hrms-danger);
    color: #fff;
    border: none;
    padding: 9px 20px;
    border-radius: 8px;
    font-size: .875rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--hrms-transition);
    display: inline-flex;
    align-items: center;
}
.btn-hrms-danger:hover { background: #dc2626; color: #fff; }

/* =========================================================
   BADGES
   ========================================================= */
.hrms-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .3px;
    text-transform: uppercase;
}
.hrms-badge.success { background: #d1fae5; color: #065f46; }
.hrms-badge.danger  { background: #fee2e2; color: #991b1b; }
.hrms-badge.warning { background: #fef3c7; color: #92400e; }
.hrms-badge.info    { background: #cffafe; color: #164e63; }
.hrms-badge.secondary { background: #f1f5f9; color: #475569; }

/* =========================================================
   TABLES
   ========================================================= */
.hrms-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .875rem;
}
.hrms-table thead th {
    background: #f8fafc;
    color: var(--hrms-secondary);
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--hrms-border);
    white-space: nowrap;
}
.hrms-table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--hrms-border);
    vertical-align: middle;
}
.hrms-table tbody tr:last-child td { border-bottom: none; }
.hrms-table tbody tr:hover { background: #f8fafc; }

/* =========================================================
   MODALS
   ========================================================= */
.hrms-modal .modal-header {
    background: var(--hrms-dark);
    color: #e2e8f0;
    border-bottom: 1px solid rgba(255,255,255,.08);
    border-radius: 0;
}
.hrms-modal .modal-content {
    border: none;
    border-radius: var(--hrms-radius);
    overflow: hidden;
}
.hrms-modal .modal-footer {
    border-top: 1px solid var(--hrms-border);
    background: #f8fafc;
}

/* =========================================================
   FORMS
   ========================================================= */
.form-control, .form-select {
    border-radius: 8px;
    border: 1px solid #d1d5db;
    font-size: .875rem;
    padding: 9px 12px;
    transition: var(--hrms-transition);
}
.form-control:focus, .form-select:focus {
    border-color: var(--hrms-primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,.1);
}
.form-label { font-size: .8rem; font-weight: 600; color: var(--hrms-secondary); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .3px; }

/* =========================================================
   KPI CARDS
   ========================================================= */
.hrms-kpi-card {
    background: var(--hrms-card-bg);
    border-radius: var(--hrms-radius);
    box-shadow: var(--hrms-shadow);
    border: 1px solid var(--hrms-border);
    padding: 16px;
    text-align: center;
    transition: var(--hrms-transition);
}
.hrms-kpi-card:hover { transform: translateY(-2px); box-shadow: var(--hrms-shadow-md); }
.hrms-kpi-card.kpi-alert { border-color: var(--hrms-warning); }

.kpi-icon {
    width: 44px; height: 44px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    font-size: 1.1rem;
    margin: 0 auto 10px;
}
.kpi-num { font-size: 1.75rem; font-weight: 800; color: var(--hrms-dark); line-height: 1; }
.kpi-lbl { font-size: .75rem; color: var(--hrms-text-muted); margin-top: 4px; font-weight: 500; }

/* =========================================================
   STAT MINI
   ========================================================= */
.hrms-stat-mini {
    background: var(--hrms-card-bg);
    border-radius: var(--hrms-radius);
    border: 1px solid var(--hrms-border);
    padding: 16px 12px;
    box-shadow: var(--hrms-shadow);
}
.stat-num { font-size: 1.5rem; font-weight: 800; }
.stat-lbl { font-size: .75rem; color: var(--hrms-text-muted); margin-top: 4px; }
.stat-value { font-size: 1.3rem; font-weight: 700; }

/* =========================================================
   ATTENDANCE CALENDAR
   ========================================================= */
.att-calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.cal-header {
    text-align: center;
    padding: 10px 4px;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--hrms-secondary);
    border-bottom: 1px solid var(--hrms-border);
    background: #f8fafc;
}

.cal-cell {
    position: relative;
    min-height: 60px;
    padding: 6px 4px 4px;
    border: 1px solid var(--hrms-border);
    border-top: none;
    border-left: none;
    text-align: center;
    cursor: default;
    transition: background .15s;
}
.cal-cell:nth-child(7n) { border-right: none; }
.cal-cell.empty { background: #fcfcfd; }
.cal-cell.future { opacity: .4; }
.cal-cell.today { background: #eef2ff; }
.cal-cell.today .cal-day-num { color: var(--hrms-primary); font-weight: 800; }
.cal-cell.present { background: #ecfdf5; }
.cal-cell.absent  { background: #fef2f2; }
.cal-cell.half-day { background: #fffbeb; }
.cal-cell.holiday { background: #f0fdf4; }
.cal-cell.weekend { background: #f8fafc; }

.cal-day-num { font-size: .8rem; font-weight: 600; color: var(--hrms-text); display: block; }
.cal-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .6rem;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 4px;
    margin-top: 2px;
}
.present-badge  { background: #d1fae5; color: #065f46; }
.absent-badge   { background: #fee2e2; color: #991b1b; }
.half-badge     { background: #fef3c7; color: #92400e; }
.late-badge     { background: #dbeafe; color: #1e40af; }
.holiday-badge  { background: #d1fae5; color: #065f46; }
.weekend-badge  { background: #f1f5f9; color: #64748b; }

.cal-legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: .8rem; }
.cal-legend-dot {
    display: inline-block;
    width: 10px; height: 10px;
    border-radius: 50%;
    margin-right: 4px;
    vertical-align: middle;
}
.cal-legend-dot.present   { background: #10b981; }
.cal-legend-dot.absent    { background: #ef4444; }
.cal-legend-dot.half-day  { background: #f59e0b; }
.cal-legend-dot.late      { background: #3b82f6; }
.cal-legend-dot.holiday   { background: #059669; }
.cal-legend-dot.weekend   { background: #94a3b8; }

/* Clock */
.punch-clock {
    font-size: 2rem;
    font-weight: 800;
    font-feature-settings: 'tnum';
    color: var(--hrms-primary);
    letter-spacing: 2px;
}

/* Today status */
.today-status-card .hrms-card-header { background: linear-gradient(135deg, #4f46e5, #7c3aed); }

/* =========================================================
   LEAVE BALANCE CARDS
   ========================================================= */
.leave-balance-card {
    padding: 16px;
    border-top: 3px solid var(--leave-color, #6c757d);
    transition: var(--hrms-transition);
}
.leave-balance-card:hover { transform: translateY(-2px); box-shadow: var(--hrms-shadow-md); }
.leave-bal-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.leave-type-name { font-size: .8rem; font-weight: 700; color: var(--hrms-text); }
.leave-type-code { font-size: .7rem; color: var(--hrms-text-muted); }
.leave-bal-num { font-size: 2.2rem; font-weight: 900; color: var(--leave-color, #6c757d); line-height: 1; }
.leave-bal-info { display: flex; justify-content: space-between; font-size: .75rem; color: var(--hrms-text-muted); margin: 8px 0 6px; }
.leave-bal-bar { height: 4px; background: #e2e8f0; border-radius: 99px; overflow: hidden; }
.leave-bal-fill { height: 100%; background: var(--leave-color, #6c757d); border-radius: 99px; transition: width .4s ease; }

/* =========================================================
   PAYSLIP SUMMARY
   ========================================================= */
.payslip-summary-item { padding: 14px; border-radius: 8px; background: #f8fafc; border: 1px solid var(--hrms-border); }
.payslip-summary-item.highlight { background: var(--hrms-primary-light); border-color: var(--hrms-primary); }
.psi-label { font-size: .72rem; text-transform: uppercase; font-weight: 700; color: var(--hrms-secondary); letter-spacing: .4px; margin-bottom: 4px; }
.psi-value { font-size: 1.2rem; font-weight: 700; }

/* =========================================================
   PROFILE
   ========================================================= */
.profile-avatar-wrapper { position: relative; display: inline-block; }
.profile-avatar { width: 90px; height: 90px; border-radius: 50%; object-fit: cover; border: 3px solid var(--hrms-primary); }
.profile-avatar-placeholder {
    width: 90px; height: 90px;
    border-radius: 50%;
    background: var(--hrms-primary);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem; font-weight: 800; color: #fff;
    border: 3px solid var(--hrms-primary-light);
    margin: 0 auto;
}
.profile-avatar-edit {
    position: absolute; bottom: 0; right: 0;
    width: 26px; height: 26px;
    background: var(--hrms-primary);
    color: #fff;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: .65rem;
    cursor: pointer;
    border: 2px solid #fff;
}

/* PIN input */
.pin-input-group { display: flex; gap: 8px; justify-content: center; }
.pin-box {
    width: 48px; height: 52px;
    text-align: center;
    font-size: 1.3rem;
    font-weight: 700;
    border: 2px solid var(--hrms-border);
    border-radius: 8px;
    transition: var(--hrms-transition);
}
.pin-box:focus { border-color: var(--hrms-primary); box-shadow: 0 0 0 3px rgba(79,70,229,.12); outline: none; }

/* =========================================================
   EMPLOYEE THUMBNAIL
   ========================================================= */
.emp-thumb { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.emp-thumb-placeholder {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--hrms-primary), #7c3aed);
    display: flex; align-items: center; justify-content: center;
    font-size: .7rem; font-weight: 700; color: #fff;
    flex-shrink: 0;
}

/* =========================================================
   NOTIFICATION DROPDOWN
   ========================================================= */
.notif-badge {
    position: absolute;
    top: 2px; right: 2px;
    min-width: 18px; height: 18px;
    background: var(--hrms-danger);
    color: #fff;
    font-size: .6rem;
    font-weight: 700;
    border-radius: 99px;
    display: flex; align-items: center; justify-content: center;
    padding: 0 4px;
    border: 2px solid var(--hrms-dark);
}

.hrms-notif-dropdown {
    width: 320px;
    max-height: 400px;
    overflow-y: auto;
    border: none;
    box-shadow: 0 20px 60px rgba(0,0,0,.15);
    border-radius: 12px;
    padding: 0;
}

.notif-header { border-bottom: 1px solid var(--hrms-border); background: #f8fafc; }

.notif-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--hrms-border);
    transition: background .15s;
}
.notif-item.unread { background: #eef2ff; }
.notif-item:hover { background: #f1f5f9; }
.notif-title { font-size: .8rem; font-weight: 600; color: var(--hrms-dark); }
.notif-msg { font-size: .78rem; color: var(--hrms-text-muted); margin-top: 2px; }
.notif-time { font-size: .7rem; color: var(--hrms-text-muted); margin-top: 4px; }

/* =========================================================
   LEAVE / HOLIDAY ITEMS
   ========================================================= */
.pending-leave-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--hrms-border);
}
.pending-leave-item:last-child { border-bottom: none; }

.holiday-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--hrms-border);
}
.holiday-list-item:last-child { border-bottom: none; }

/* =========================================================
   TABS
   ========================================================= */
.hrms-tab-row {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--hrms-border);
    overflow-x: auto;
}
.hrms-tab {
    padding: 10px 16px;
    font-size: .825rem;
    font-weight: 600;
    color: var(--hrms-secondary);
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    transition: var(--hrms-transition);
}
.hrms-tab:hover { color: var(--hrms-primary); }
.hrms-tab.active { color: var(--hrms-primary); border-bottom-color: var(--hrms-primary); }
.hrms-tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--hrms-primary);
    color: #fff;
    font-size: .65rem;
    min-width: 18px; height: 18px;
    border-radius: 99px;
    padding: 0 5px;
    margin-left: 5px;
}

/* =========================================================
   DROPDOWN MENUS
   ========================================================= */
.hrms-user-menu .dropdown-menu {
    border-radius: 12px;
    border: none;
    box-shadow: 0 20px 60px rgba(0,0,0,.12);
    padding: 6px;
    min-width: 180px;
}
.hrms-user-menu .dropdown-item {
    border-radius: 8px;
    font-size: .85rem;
    padding: 9px 14px;
}
.hrms-user-menu .dropdown-item:hover { background: var(--hrms-primary-light); color: var(--hrms-primary); }

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 991px) {
    .hrms-sidebar {
        transform: translateX(-100%);
        z-index: 1050;
    }
    .hrms-sidebar.open {
        transform: translateX(0);
    }
    .hrms-content-area { margin-left: 0; padding: 16px; }
    .hrms-footer { margin-left: 0; }
    .hrms-sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,.5);
        z-index: 1040;
    }
    .hrms-sidebar-overlay.active { display: block; }
    .hrms-page-title { font-size: 1.2rem; }
}

@media (max-width: 576px) {
    .hrms-content-area { padding: 12px; }
    .kpi-num { font-size: 1.4rem; }
    .att-calendar .cal-cell { min-height: 48px; }
}

/* =========================================================
   PRINT STYLES
   ========================================================= */
@media print {
    .hrms-header, .hrms-sidebar, .hrms-footer,
    .btn, button, .dropdown, .modal { display: none !important; }
    .hrms-content-area { margin: 0 !important; padding: 0 !important; }
    .hrms-card { box-shadow: none !important; border: 1px solid #ddd !important; }
}

/* =========================================================
   SIDEBAR TOGGLE JS HOOK
   ========================================================= */
#sidebarToggle { }
