@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --primary:      #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light:#eff6ff;
    --sidebar:      #1e293b;
    --sidebar-hover:#334155;
    --sidebar-active:#2563eb;
    --bg:           #f1f5f9;
    --white:        #ffffff;
    --text-dark:    #0f172a;
    --text-gray:    #64748b;
    --text-light:   #94a3b8;
    --border:       #e2e8f0;
    --success:      #22c55e;
    --success-bg:   #f0fdf4;
    --warning:      #f59e0b;
    --warning-bg:   #fffbeb;
    --danger:       #ef4444;
    --danger-bg:    #fef2f2;
    --info:         #3b82f6;
    --info-bg:      #eff6ff;
    --shadow:       0 1px 3px rgba(0,0,0,0.1);
    --shadow-md:    0 4px 6px rgba(0,0,0,0.07);
    --shadow-lg:    0 10px 15px rgba(0,0,0,0.1);
    --radius:       10px;
    --radius-sm:    6px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text-dark);
    font-size: 14px;
}

/* ============================================================
   LAYOUT
============================================================ */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ============================================================
   SIDEBAR
============================================================ */
.sidebar {
    width: 260px;
    background: var(--sidebar);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    transition: width 0.3s;
}

.sidebar-logo {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-logo .logo-icon {
    width: 36px;
    height: 36px;
    background: var(--primary);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.sidebar-logo .logo-text {
    color: #ffffff;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.3;
}

.sidebar-logo .logo-text span {
    color: var(--text-light);
    font-size: 0.75rem;
    font-weight: 400;
    display: block;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
}

.nav-section {
    padding: 0.5rem 1rem 0.25rem;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-light);
    margin-top: 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1.25rem;
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 400;
    transition: all 0.2s;
    border-left: 3px solid transparent;
    position: relative;
}

.nav-item:hover {
    background: var(--sidebar-hover);
    color: #ffffff;
}

.nav-item.active {
    background: rgba(37,99,235,0.15);
    color: #ffffff;
    border-left-color: var(--primary);
    font-weight: 500;
}

.nav-item .nav-icon {
    font-size: 1rem;
    width: 20px;
    text-align: center;
}

.nav-badge {
    margin-left: auto;
    background: var(--danger);
    color: white;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
}

.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-user .avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.sidebar-user .user-info .name {
    color: #ffffff;
    font-size: 0.85rem;
    font-weight: 500;
}

.sidebar-user .user-info .role {
    color: var(--text-light);
    font-size: 0.75rem;
}

/* ============================================================
   MAIN CONTENT
============================================================ */
.main-content {
    margin-left: 260px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ============================================================
   TOPBAR
============================================================ */
.topbar {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 0.875rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.topbar-left h1 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-dark);
}

.topbar-left p {
    font-size: 0.8rem;
    color: var(--text-gray);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.45rem 0.75rem;
    font-size: 0.85rem;
    color: var(--text-gray);
    width: 220px;
}

.search-box input {
    border: none;
    background: transparent;
    outline: none;
    font-size: 0.85rem;
    color: var(--text-dark);
    width: 100%;
}

.icon-btn {
    position: relative;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-gray);
    font-size: 1rem;
    transition: all 0.2s;
}

.icon-btn:hover {
    background: var(--bg);
    color: var(--text-dark);
}

.icon-btn .badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 16px;
    height: 16px;
    background: var(--danger);
    color: white;
    font-size: 0.6rem;
    font-weight: 700;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    transition: background 0.2s;
}

.topbar-user:hover {
    background: var(--bg);
}

.topbar-user .avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.75rem;
}

.topbar-user .user-info .name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-dark);
}

.topbar-user .user-info .role {
    font-size: 0.72rem;
    color: var(--text-gray);
}

/* ============================================================
   PAGE CONTENT
============================================================ */
.page-content {
    padding: 1.5rem;
    flex: 1;
}

/* ============================================================
   STAT CARDS
============================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1px solid var(--border);
    transition: box-shadow 0.2s;
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
}

.stat-card .stat-info .label {
    font-size: 0.8rem;
    color: var(--text-gray);
    font-weight: 500;
    margin-bottom: 0.35rem;
}

.stat-card .stat-info .value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1;
}

.stat-card .stat-info .change {
    font-size: 0.75rem;
    margin-top: 0.35rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.stat-card .stat-info .change.up   { color: var(--success); }
.stat-card .stat-info .change.down { color: var(--danger); }

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

.stat-icon.blue   { background: var(--info-bg);    color: var(--info); }
.stat-icon.green  { background: var(--success-bg); color: var(--success); }
.stat-icon.orange { background: var(--warning-bg); color: var(--warning); }
.stat-icon.red    { background: var(--danger-bg);  color: var(--danger); }

/* ============================================================
   CARD
============================================================ */
.card {
    background: var(--white);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-dark);
}

.card-header .card-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-body {
    padding: 1.25rem;
}

/* ============================================================
   TABLE
============================================================ */
.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--text-gray);
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

tbody td {
    padding: 0.85rem 1rem;
    font-size: 0.875rem;
    color: var(--text-dark);
    border-bottom: 1px solid var(--border);
}

tbody tr:last-child td {
    border-bottom: none;
}

tbody tr:hover {
    background: var(--bg);
}

/* ============================================================
   BADGE / STATUS
============================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
}

.badge.approved  { background: var(--success-bg); color: var(--success); }
.badge.pending   { background: var(--warning-bg); color: var(--warning); }
.badge.rejected  { background: var(--danger-bg);  color: var(--danger); }
.badge.cancelled { background: var(--bg);         color: var(--text-gray); }
.badge.info      { background: var(--info-bg);    color: var(--info); }
.badge.high      { background: var(--danger-bg);  color: var(--danger); }
.badge.medium    { background: var(--warning-bg); color: var(--warning); }
.badge.low       { background: var(--success-bg); color: var(--success); }

/* ============================================================
   BUTTONS
============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-outline {
    background: white;
    color: var(--text-dark);
    border: 1px solid var(--border);
}

.btn-outline:hover {
    background: var(--bg);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
}

/* ============================================================
   FORM
============================================================ */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-gray);
    margin-bottom: 0.4rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.6rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    color: var(--text-dark);
    background: var(--white);
    outline: none;
    transition: border-color 0.2s;
    font-family: 'Inter', sans-serif;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

/* ============================================================
   ALERT
============================================================ */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    margin-bottom: 1rem;
    display: none;
}

.alert.success {
    background: var(--success-bg);
    border: 1px solid var(--success);
    color: #166534;
}

.alert.error {
    background: var(--danger-bg);
    border: 1px solid var(--danger);
    color: #991b1b;
}

.alert.warning {
    background: var(--warning-bg);
    border: 1px solid var(--warning);
    color: #92400e;
}

/* ============================================================
   LEAVE BALANCE CARDS
============================================================ */
.balance-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.balance-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    text-align: center;
    box-shadow: var(--shadow);
}

.balance-card .leave-type {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.balance-card .leave-days {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
}

.balance-card .leave-label {
    font-size: 0.72rem;
    color: var(--text-light);
    margin-top: 0.25rem;
}

.balance-card.cl  .leave-days { color: #2563eb; }
.balance-card.sl  .leave-days { color: #16a34a; }
.balance-card.el  .leave-days { color: #d97706; }
.balance-card.wfh .leave-days { color: #7c3aed; }

/* ============================================================
   CALENDAR
============================================================ */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.calendar-day-header {
    text-align: center;
    padding: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-gray);
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.2s;
    position: relative;
}

.calendar-day:hover       { background: var(--bg); }
.calendar-day.today       { background: var(--primary); color: white; font-weight: 700; }
.calendar-day.approved    { background: var(--success-bg); color: var(--success); }
.calendar-day.pending     { background: var(--warning-bg); color: var(--warning); }
.calendar-day.holiday     { background: var(--danger-bg);  color: var(--danger); }
.calendar-day.wfh         { background: #f5f3ff; color: #7c3aed; }
.calendar-day.other-month { color: var(--text-light); }
.calendar-day.weekend     { color: var(--danger); }

/* ============================================================
   LOGIN PAGE
============================================================ */
.login-page {
    min-height: 100vh;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

.login-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo .icon {
    width: 64px;
    height: 64px;
    background: var(--primary-light);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin: 0 auto 1rem;
}

.login-logo h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-dark);
}

.login-logo p {
    font-size: 0.85rem;
    color: var(--text-gray);
    margin-top: 0.25rem;
}

.login-footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.8rem;
    color: var(--text-light);
}

/* ============================================================
   PENDING APPROVAL ITEM
============================================================ */
.approval-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--border);
}

.approval-item:last-child {
    border-bottom: none;
}

.approval-item .emp-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.approval-item .avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.approval-item .emp-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-dark);
}

.approval-item .leave-meta {
    font-size: 0.78rem;
    color: var(--text-gray);
    margin-top: 0.1rem;
}

.approval-item .actions {
    display: flex;
    gap: 0.5rem;
}

/* ============================================================
   NOTIFICATION ITEM
============================================================ */
.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--border);
}

.notif-item:last-child { border-bottom: none; }

.notif-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-top: 5px;
    flex-shrink: 0;
}

.notif-dot.blue   { background: var(--info); }
.notif-dot.green  { background: var(--success); }
.notif-dot.orange { background: var(--warning); }

.notif-item .notif-text {
    font-size: 0.85rem;
    color: var(--text-dark);
    line-height: 1.5;
}

.notif-item .notif-time {
    font-size: 0.75rem;
    color: var(--text-light);
    margin-top: 0.2rem;
}

/* ============================================================
   UTILITIES
============================================================ */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1.5rem; }
.flex   { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1  { gap: 0.5rem; }
.gap-2  { gap: 1rem; }
.mt-1   { margin-top: 0.5rem; }
.mt-2   { margin-top: 1rem; }
.mb-1   { margin-bottom: 0.5rem; }
.mb-2   { margin-bottom: 1rem; }
.text-sm    { font-size: 0.8rem; }
.text-gray  { color: var(--text-gray); }
.text-right { text-align: right; }
.w-100  { width: 100%; }
.link { color: var(--primary); text-decoration: none; font-size: 0.85rem; }
.link:hover { text-decoration: underline; }
.divider { height: 1px; background: var(--border); margin: 1rem 0; }