/* ═══════════════════════════════════════════════════════════════════
   WORKFLOW CLOUD — Premium Design System v2.0
   ═══════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ── CSS Variables ─────────────────────────────────────────────────────────── */
:root {
    --primary:       #2563eb;
    --primary-dark:  #1d4ed8;
    --primary-light: #dbeafe;
    --success:       #10b981;
    --success-light: #d1fae5;
    --danger:        #ef4444;
    --danger-light:  #fee2e2;
    --warning:       #f59e0b;
    --warning-light: #fef3c7;

    /* Layout */
    --bg-body:          #f0f4f8;
    --bg-card:          #ffffff;
    --bg-sidebar:       #0f172a;
    --bg-sidebar-hover: rgba(255,255,255,0.07);
    --bg-sidebar-active:rgba(37,99,235,0.25);

    /* Text */
    --text-main:   #0f172a;
    --text-dark:   #1e293b;
    --text-muted:  #64748b;
    --text-light:  #f8fafc;
    --text-subtle: #94a3b8;

    /* Borders & Shadows */
    --border:      #e2e8f0;
    --border-focus:#2563eb;
    --shadow-sm:   0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md:   0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
    --shadow-lg:   0 10px 30px rgba(0,0,0,0.12);

    /* Sidebar */
    --sidebar-collapsed: 62px;
    --sidebar-expanded:  240px;

    /* Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
}

/* ── Reset & Base ──────────────────────────────────────────────────────────── */
*, *::before, *::after {
    margin: 0; padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background: var(--bg-body);
    color: var(--text-main);
    font-size: 14px;
    height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ── Login Page ────────────────────────────────────────────────────────────── */
.login-container {
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 50%, #1e3a5f 100%);
    position: relative;
    overflow: hidden;
}

/* Animated background orbs */
.login-container::before,
.login-container::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    animation: floatOrb 6s ease-in-out infinite alternate;
}
.login-container::before {
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(37,99,235,0.3), transparent 70%);
    top: -100px; left: -100px;
}
.login-container::after {
    width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(16,185,129,0.15), transparent 70%);
    bottom: -150px; right: -100px;
    animation-delay: -3s;
}

@keyframes floatOrb {
    from { transform: translate(0, 0) scale(1); }
    to   { transform: translate(30px, 20px) scale(1.05); }
}

.login-card {
    background: rgba(255,255,255,0.97);
    backdrop-filter: blur(20px);
    padding: 2.5rem 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255,255,255,0.1);
    width: 100%;
    max-width: 400px;
    position: relative;
    z-index: 1;
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: translateY(0); }
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h2 {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.5px;
}

.login-header p {
    color: var(--text-muted);
    font-size: 0.88rem;
    margin-top: 0.25rem;
}

/* App logo mark above title */
.login-header::before {
    content: '⚡';
    display: block;
    font-size: 2.2rem;
    margin-bottom: 0.5rem;
    filter: drop-shadow(0 2px 8px rgba(37,99,235,0.4));
}

/* ── Dashboard Wrapper ─────────────────────────────────────────────────────── */
.dashboard-wrapper {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* ── Sidebar ───────────────────────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-collapsed);
    background: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: width 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    white-space: nowrap;
    position: relative;
    z-index: 10;
    border-right: 1px solid rgba(255,255,255,0.04);
}

.sidebar.expanded {
    width: var(--sidebar-expanded);
}

/* Subtle top gradient accent */
.sidebar::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, #2563eb, #10b981);
    flex-shrink: 0;
}

/* Sidebar Header */
.sidebar-header {
    padding: 0 0.9rem;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    display: flex;
    align-items: center;
    height: 58px;
    overflow: hidden;
    flex-shrink: 0;
}

.sidebar-header h2 {
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    white-space: nowrap;
}

.logo-icon {
    min-width: 32px;
    text-align: center;
    font-weight: 800;
    color: #60a5fa;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-text {
    margin-left: 10px;
    opacity: 0;
    transition: opacity 0.2s ease;
    visibility: hidden;
    background: linear-gradient(135deg, #fff, #93c5fd);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

.sidebar.expanded .logo-text { opacity: 1; visibility: visible; }

/* Nav Links */
.nav-links {
    list-style: none;
    padding: 0.6rem 0;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.nav-links::-webkit-scrollbar { display: none; }

.nav-links li a {
    display: flex;
    align-items: center;
    padding: 0 0.8rem;
    color: #94a3b8;
    text-decoration: none;
    transition: all 0.18s ease;
    font-weight: 500;
    font-size: 0.875rem;
    height: 46px;
    white-space: nowrap;
    overflow: hidden;
    border-radius: var(--radius-sm);
    margin: 1px 6px;
    position: relative;
}

.nav-links li a:hover {
    background: var(--bg-sidebar-hover);
    color: #e2e8f0;
}

.nav-links li a.active {
    background: var(--bg-sidebar-active);
    color: #93c5fd;
    font-weight: 600;
}

/* Active left indicator line */
.nav-links li a.active::before {
    content: '';
    position: absolute;
    left: 0; top: 25%; bottom: 25%;
    width: 3px;
    background: #2563eb;
    border-radius: 0 3px 3px 0;
}

.nav-links li a ion-icon {
    font-size: 1.3rem;
    min-width: 30px;
    text-align: center;
    transition: transform 0.15s;
}

.nav-links li a:hover ion-icon {
    transform: scale(1.1);
}

.link-text {
    margin-left: 8px;
    opacity: 0;
    transition: opacity 0.18s ease;
    visibility: hidden;
    font-size: 0.87rem;
}

.sidebar.expanded .link-text { opacity: 1; visibility: visible; }

/* Sidebar Dropdown */
.nav-item-dropdown { display: flex; flex-direction: column; }

.dropdown-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background: none; border: none;
    padding: 0 0.8rem;
    color: #94a3b8;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.18s;
    height: 46px;
    font-family: inherit;
    font-weight: 500;
    border-radius: var(--radius-sm);
    margin: 1px 6px;
    white-space: nowrap;
}

.dropdown-toggle:hover { background: var(--bg-sidebar-hover); color: #e2e8f0; }

.dropdown-toggle .link-content {
    display: flex; align-items: center;
    white-space: nowrap; overflow: hidden;
}

.dropdown-toggle ion-icon {
    font-size: 1.3rem; min-width: 30px; text-align: center;
}

.dropdown-menu {
    display: none; list-style: none; padding: 0; margin: 0;
    background: rgba(0,0,0,0.15);
}
.dropdown-menu.show { display: block; }

.dropdown-menu li a {
    padding-left: 2.5rem;
    font-size: 0.84rem;
    height: 38px;
}

.sidebar:not(.expanded) .dropdown-icon { display: none; }

.dropdown-icon { transition: transform 0.25s; }
.dropdown-toggle[aria-expanded="true"] .dropdown-icon { transform: rotate(90deg); }

/* User Profile Area */
.user-profile {
    padding: 0.85rem;
    border-top: 1px solid rgba(255,255,255,0.06);
    background: rgba(0,0,0,0.25);
    overflow: hidden;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.user-profile .profile-info {
    opacity: 0; transition: opacity 0.18s ease; visibility: hidden;
    display: flex; flex-direction: column; gap: 1px;
}

.sidebar.expanded .user-profile .profile-info { opacity: 1; visibility: visible; }

.user-profile .role {
    font-size: 0.78rem; color: #94a3b8; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.4px;
}

/* Sidebar Toggle Button */
.sidebar-toggle {
    position: absolute;
    bottom: 12px; right: 12px;
    background: rgba(37,99,235,0.2);
    color: #60a5fa;
    border: 1px solid rgba(37,99,235,0.3);
    border-radius: 50%;
    width: 26px; height: 26px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    z-index: 20;
    transition: all 0.25s;
    font-size: 0.85rem;
}
.sidebar-toggle:hover { background: rgba(37,99,235,0.4); border-color: #2563eb; }
.sidebar.expanded .sidebar-toggle { transform: rotate(180deg); }

/* Logout Link */
.logout-link {
    display: inline-block;
    color: #f87171;
    text-decoration: none;
    font-size: 0.78rem;
    font-weight: 500;
    transition: color 0.15s;
}
.logout-link:hover { color: #ef4444; }

/* ── Main Content ──────────────────────────────────────────────────────────── */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    background: var(--bg-body);
}

.main-content::-webkit-scrollbar { width: 5px; }
.main-content::-webkit-scrollbar-track { background: transparent; }
.main-content::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }

/* ── Page Header ───────────────────────────────────────────────────────────── */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-title {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.4px;
}

/* ── Grid Helpers ──────────────────────────────────────────────────────────── */
.grid-cols-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.grid-cols-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.grid-cols-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }

/* ── Cards ─────────────────────────────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    padding: 1.1rem;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.2s, transform 0.2s;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

a.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    text-decoration: none;
}

.card-title {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-subtle);
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.5px;
    line-height: 1;
}

/* ── Forms ─────────────────────────────────────────────────────────────────── */
.form-compact { display: grid; gap: 12px; }

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}

label {
    font-size: 0.78rem;
    font-weight: 600;
    margin-bottom: 4px;
    display: block;
    color: var(--text-muted);
}

input,
select,
textarea {
    width: 100%;
    padding: 8px 12px;
    font-size: 0.875rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: #f8fafc;
    transition: border-color 0.18s, background 0.18s, box-shadow 0.18s;
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.10);
}

input::placeholder { color: #b0bac6; }
select:focus { outline: none; }

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 18px;
    background: var(--primary);
    color: #fff;
    border: 1.5px solid var(--primary);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: all 0.18s cubic-bezier(0.4,0,0.2,1);
    position: relative;
    overflow: hidden;
    white-space: nowrap;
    font-family: 'Inter', sans-serif;
}

.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0);
    transition: background 0.18s;
}

.btn:hover { background: var(--primary-dark); border-color: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(37,99,235,0.25); }
.btn:active { transform: translateY(0); box-shadow: none; }

.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }

.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { background: #059669; border-color: #059669; box-shadow: 0 4px 12px rgba(16,185,129,0.25); }

.btn-danger  { background: var(--danger);  border-color: var(--danger);  color: #fff; }
.btn-danger:hover  { background: #dc2626; border-color: #dc2626; box-shadow: 0 4px 12px rgba(239,68,68,0.25); }

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--border);
    color: var(--text-main);
}
.btn-outline:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    transform: translateY(-1px);
    box-shadow: none;
}

.btn-sm { padding: 5px 12px; font-size: 0.78rem; border-radius: 5px; }

/* ── Tables ────────────────────────────────────────────────────────────────── */
.table-wrapper {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: #fff;
}

.table-wrapper::-webkit-scrollbar { height: 4px; }
.table-wrapper::-webkit-scrollbar-track { background: transparent; }
.table-wrapper::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }

table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }

th {
    background: #f8fafc;
    text-align: left;
    padding: 11px 14px;
    font-weight: 700;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 1.5px solid var(--border);
    white-space: nowrap;
}

td {
    padding: 10px 14px;
    border-bottom: 1px solid #f1f5f9;
    color: var(--text-main);
    vertical-align: middle;
}

tr:last-child td { border-bottom: none; }

tbody tr { transition: background 0.1s; }
tbody tr:hover { background: #f8fafc; }

/* ── Badges ────────────────────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.2px;
}

.badge.present     { background: #d1fae5; color: #065f46; }
.badge.absent      { background: #fee2e2; color: #991b1b; }
.badge.on-leave    { background: #fef3c7; color: #92400e; }
.badge.rest        { background: #f3e8ff; color: #6b21a8; }
.badge.holiday     { background: #cffafe; color: #155e75; }
.badge.active      { background: #dbeafe; color: #1e40af; }
.badge.Late        { background: #fff7ed; color: #c2410c; }
.badge.half-day    { background: #f0f9ff; color: #0369a1; }

/* ── Utility ───────────────────────────────────────────────────────────────── */
.text-right  { text-align: right; }
.text-center { text-align: center; }
.mt-2 { margin-top: 0.5rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mt-4 { margin-top: 1rem; }