/* 
 * FINAL DESIGN SYSTEM - HR LEAVE FORM
 * Premium, Professional, and Responsive
 */

:root {
    /* Core Palette */
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --sidebar-bg: #111827;
    --sidebar-text: #d1d5db;
    --sidebar-hover: #1f2937;
    --sidebar-active: #2563eb;
    --bg: #f3f4f6;
    --surface: #ffffff;
    --text-main: #111827;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    
    /* Semantic Colors */
    --success: #16a34a;
    --success-bg: #dcfce7;
    --warning: #f59e0b;
    --warning-bg: #fef3c7;
    --danger: #dc2626;
    --danger-bg: #fee2e2;
    --info: #0ea5e9;
    --info-bg: #e0f2fe;

    /* Spacing & Shadows */
    --sidebar-width: 260px;
    --header-height: 64px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 1. RESET & BASE */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    background-color: var(--bg);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

input, select, textarea {
    font-family: inherit;
}

/* 2. LAYOUT */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 1000;
    transition: var(--transition);
}

.sidebar-brand {
    padding: 1.5rem;
    font-size: 1.25rem;
    font-weight: 800;
    color: white;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-brand span {
    color: var(--primary);
}

.sidebar-user {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.03);
}

.sidebar-user .role {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 700;
}

.sidebar-user .name {
    display: block;
    font-weight: 600;
    color: white;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0.75rem;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--sidebar-text);
}

.nav-item:hover {
    background-color: var(--sidebar-hover);
    color: white;
}

.nav-item.active {
    background-color: var(--sidebar-active);
    color: white;
}

.sidebar-footer {
    padding: 1rem 0.75rem;
    border-top: 1px solid rgba(255,255,255,0.05);
}

/* Main Area */
.main-area {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-width: 0;
    transition: var(--transition);
}

.top-header {
    height: var(--header-height);
    background-color: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 900;
}

.top-header .page-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
}

.content-wrapper {
    padding: 2rem;
    width: 100%;
    max-width: 1400px;
}

/* 3. COMPONENTS */
.card {
    background: var(--surface);
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
    border: 1px solid var(--border);
    overflow: hidden;
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fcfcfc;
}

.card-header h2 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
}

.card-body {
    padding: 1.5rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.form-control {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    transition: var(--transition);
    background-color: white;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

/* Tables */
.table-wrapper {
    overflow-x: auto;
    border-radius: 8px;
}

table {
    width: 100%;
    border-collapse: collapse;
    white-space: nowrap;
}

th {
    background: #f9fafb;
    padding: 0.875rem 1.5rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
}

td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
    color: var(--text-main);
}

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

tr:hover td {
    background-color: #f8fafc;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.875rem;
    transition: var(--transition);
    border: 1px solid transparent;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }

.btn-outline { background: transparent; border-color: var(--border); color: var(--text-main); }
.btn-outline:hover { background: #f9fafb; border-color: var(--text-muted); }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #b91c1c; }

.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.75rem; }

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
}

.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
}

.stat-card .label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.stat-card .value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-main);
}

/* Signature Pad */
.signature-container {
    border: 2px dashed var(--border);
    border-radius: 8px;
    background: #fdfdfd;
    position: relative;
    margin-bottom: 1rem;
}

canvas#signature-pad {
    width: 100%;
    height: 200px;
    cursor: crosshair;
}

/* 4. RESPONSIVE */
.mobile-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
}

.mobile-toggle span {
    width: 24px;
    height: 2px;
    background: var(--text-main);
}

@media (max-width: 1024px) {
    .sidebar { left: -100%; }
    .sidebar.active { left: 0; }
    .main-area { margin-left: 0; }
    .mobile-toggle { display: flex; }
    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 999;
        display: none;
    }
    .sidebar-overlay.active { display: block; }
}

@media (max-width: 640px) {
    .top-header { padding: 0 1rem; }
    .content-wrapper { padding: 1rem; }
    .form-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr; }
    .btn { width: 100%; }
}

/* 5. PRINT */
@media print {
    .sidebar, .top-header, .no-print, .btn { display: none !important; }
    .main-area { margin-left: 0 !important; }
    .content-wrapper { padding: 0; }
    body { background: white; }
    .print-form {
        max-width: 800px;
        margin: 0 auto;
        padding: 40px;
        border: 1px solid #ddd;
    }
}

/* Auth Page */
.auth-layout {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg);
}

.auth-card {
    width: 100%;
    max-width: 400px;
    background: white;
    padding: 2.5rem;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
}

.auth-brand {
    text-align: center;
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 2rem;
}

.auth-brand span { color: var(--primary); }

/* Form Section Styling */
.form-section {
    margin-bottom: 2.5rem;
}

.form-section-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1.25rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--bg);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: -1rem;
    margin-bottom: 2rem;
}

.required-mark {
    color: var(--danger);
    margin-left: 2px;
}

.form-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.alert-danger {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid #fecaca;
}

.alert-success {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid #bbf7d0;
}

@media (max-width: 640px) {
    .form-footer {
        flex-direction: column-reverse;
    }
}


/* Fix wide tables horizontal scroll */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}

.table-responsive table,
.data-table {
    min-width: 1100px;
    width: 100%;
    border-collapse: collapse;
}

.card,
.card-body {
    max-width: 100%;
}

.content-wrapper {
    max-width: 100%;
    overflow-x: hidden;
}

/* Make horizontal scroll visible and smooth */
.table-responsive::-webkit-scrollbar {
    height: 8px;
}

.table-responsive::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 20px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 20px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Mobile table fix */
@media (max-width: 768px) {
    .table-responsive {
        overflow-x: auto;
        display: block;
        width: 100%;
    }

    .table-responsive table,
    .data-table {
        min-width: 950px;
    }

    .card-body {
        padding: 1rem;
    }
}


