/* Import modern high-quality typography */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap');

/* Design System Custom Properties (Variables) */
:root {
    --bg-primary: #080c14;
    --bg-secondary: #0f172a;
    --bg-tertiary: #1e293b;
    --card-bg: rgba(15, 23, 42, 0.65);
    --card-border: rgba(255, 255, 255, 0.06);
    --card-border-hover: rgba(255, 255, 255, 0.12);
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-dark: #64748b;
    
    --primary: #38bdf8;         /* Cyan/Sky */
    --primary-glow: rgba(56, 189, 248, 0.15);
    --secondary: #818cf8;       /* Indigo */
    --accent-gradient: linear-gradient(135deg, #38bdf8 0%, #818cf8 100%);
    --accent-gradient-hover: linear-gradient(135deg, #0ea5e9 0%, #6366f1 100%);
    
    --success: #10b981;         /* Emerald */
    --success-bg: rgba(16, 185, 129, 0.1);
    --warning: #f59e0b;         /* Amber */
    --warning-bg: rgba(245, 158, 11, 0.1);
    --danger: #ef4444;          /* Rose/Red */
    --danger-bg: rgba(239, 68, 68, 0.1);
    --info: #06b6d4;            /* Cyan */
    --info-bg: rgba(6, 182, 212, 0.1);
    
    --sidebar-width: 260px;
    --navbar-height: 70px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --shadow-sm: 0 2px 8px -2px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 4px 20px -4px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 10px 30px -10px rgba(0, 0, 0, 0.8);
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Global Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-main);
    font-family: 'Plus Jakarta Sans', 'Outfit', sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
}

/* Base Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-dark);
}

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

/* Sidebar Styling */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--card-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 100;
    transition: var(--transition-smooth);
}

.sidebar-brand {
    height: var(--navbar-height);
    display: flex;
    align-items: center;
    padding: 0 24px;
    border-bottom: 1px solid var(--card-border);
}

.sidebar-brand a {
    text-decoration: none;
    font-weight: 800;
    font-size: 1.25rem;
    letter-spacing: 0.5px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-family: 'Outfit', sans-serif;
}

.sidebar-menu {
    list-style: none;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
    overflow-y: auto;
}

.sidebar-item a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.95rem;
    transition: var(--transition-smooth);
}

.sidebar-item a:hover {
    background-color: rgba(255, 255, 255, 0.03);
    color: var(--text-main);
}

.sidebar-item.active a {
    background: var(--accent-gradient);
    color: var(--bg-primary);
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(56, 189, 248, 0.25);
}

.sidebar-user {
    padding: 16px 24px;
    border-top: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-main);
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.logout-btn {
    color: var(--danger);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 4px;
    transition: var(--transition-smooth);
}

.logout-btn:hover {
    transform: scale(1.1);
}

/* Main Content Area */
.main-wrapper {
    margin-left: var(--sidebar-width);
    flex-grow: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navbar Top Styling */
.navbar-top {
    height: var(--navbar-height);
    background-color: rgba(8, 12, 20, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 90;
}

.nav-title {
    font-size: 1.2rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
}

.nav-date {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Main View Body */
.content-body {
    padding: 32px;
    flex-grow: 1;
    animation: fadeIn 0.4s ease-out;
}

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

/* Premium Card / Panels (Glassmorphism) */
.glass-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(16px);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-md);
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
}

.glass-card:hover {
    border-color: var(--card-border-hover);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

/* Card Header */
.card-header-custom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.card-title-custom {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 1.15rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Dashboard Metric Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.metric-card {
    display: flex;
    align-items: center;
    gap: 20px;
}

.metric-icon {
    width: 54px;
    height: 54px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
}

.metric-details {
    display: flex;
    flex-direction: column;
}

.metric-value {
    font-size: 1.8rem;
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
    line-height: 1.2;
}

.metric-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Specific Metric Themes */
.metric-employees .metric-icon { background: rgba(56, 189, 248, 0.1); color: #38bdf8; }
.metric-present .metric-icon { background: rgba(16, 185, 129, 0.1); color: #10b981; }
.metric-absent .metric-icon { background: rgba(239, 68, 68, 0.1); color: #ef4444; }
.metric-leaves .metric-icon { background: rgba(245, 158, 11, 0.1); color: #f59e0b; }

/* Dashboard Columns Layout */
.dashboard-columns {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 32px;
    margin-bottom: 32px;
}

@media (max-width: 1024px) {
    .dashboard-columns {
        grid-template-columns: 1fr;
    }
}

/* Analytics Row */
.analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 32px;
    margin-bottom: 32px;
}

/* Table Styling */
.table-container {
    width: 100%;
    overflow-x: auto;
    border-radius: var(--radius-md);
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.custom-table th {
    background-color: rgba(255, 255, 255, 0.02);
    padding: 16px;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--card-border);
}

.custom-table td {
    padding: 16px;
    border-bottom: 1px solid var(--card-border);
    font-size: 0.9rem;
    color: var(--text-main);
    transition: var(--transition-smooth);
}

.custom-table tbody tr {
    transition: var(--transition-smooth);
}

.custom-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.015);
}

.custom-table tbody tr:last-child td {
    border-bottom: none;
}

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: capitalize;
}

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

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

/* Forms Styling */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 24px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

.form-control {
    background-color: var(--bg-tertiary);
    border: 1px solid var(--card-border);
    color: var(--text-main);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.95rem;
    transition: var(--transition-smooth);
    width: 100%;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg fill='white' height='24' viewBox='0 0 24 24' width='24' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/><path d='M0 0h24v24H0z' fill='none'/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}

/* Form Action Buttons Container */
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 16px;
    margin-top: 32px;
    border-top: 1px solid var(--card-border);
    padding-top: 24px;
}

/* Button UI System */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    text-decoration: none;
    border: none;
}

.btn-primary {
    background: var(--accent-gradient);
    color: var(--bg-primary);
    box-shadow: 0 4px 12px rgba(56, 189, 248, 0.2);
}

.btn-primary:hover {
    background: var(--accent-gradient-hover);
    box-shadow: 0 6px 16px rgba(56, 189, 248, 0.35);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: var(--bg-tertiary);
    color: var(--text-main);
    border: 1px solid var(--card-border);
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: var(--card-border-hover);
}

.btn-danger {
    background-color: var(--danger-bg);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

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

/* Small Action Icons Buttons */
.btn-icon-only {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid var(--card-border);
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-smooth);
    text-decoration: none;
}

.btn-icon-only:hover {
    border-color: var(--text-muted);
    color: var(--text-main);
    background-color: rgba(255, 255, 255, 0.03);
}

.btn-icon-delete:hover {
    background-color: var(--danger-bg);
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.2);
}

/* Alert Banners */
.alert-container {
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.alert {
    padding: 14px 20px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: space-between;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-success { background-color: var(--success-bg); color: var(--success); border-left: 4px solid var(--success); }
.alert-warning { background-color: var(--warning-bg); color: var(--warning); border-left: 4px solid var(--warning); }
.alert-danger { background-color: var(--danger-bg); color: var(--danger); border-left: 4px solid var(--danger); }
.alert-info { background-color: var(--info-bg); color: var(--info); border-left: 4px solid var(--info); }

.alert-close {
    background: none;
    border: none;
    color: inherit;
    font-size: 1.1rem;
    cursor: pointer;
    line-height: 1;
}

/* Search and Filters Bar */
.filter-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.search-form {
    display: flex;
    gap: 12px;
    flex-grow: 1;
    max-width: 500px;
}

.filters-group {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* Profile Grid View */
.profile-header {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--card-border);
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--bg-primary);
    font-family: 'Outfit', sans-serif;
}

.profile-title h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.8rem;
    font-weight: 700;
}

.profile-title p {
    color: var(--text-muted);
}

.profile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.info-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
}

.info-value {
    font-size: 1.05rem;
    font-weight: 500;
}

/* Authentication Layout (Login View) */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.auth-card {
    width: 100%;
    max-width: 440px;
    padding: 40px;
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-header h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 8px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.auth-header p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* Print Styling for reports export */
@media print {
    .sidebar, .navbar-top, .btn, .filter-bar, .form-actions {
        display: none !important;
    }
    .main-wrapper {
        margin-left: 0 !important;
    }
    body {
        background: white !important;
        color: black !important;
    }
    .glass-card {
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
    }
    .custom-table th, .custom-table td {
        border-bottom: 1px solid #ddd !important;
        color: black !important;
    }
}
