/* 
  =========================================
  MIS DESIGN SYSTEM & CUSTOM DARK THEME
  =========================================
*/

:root {
    /* Color Palette */
    --bg-main: #0a0c10;
    --bg-surface: #101216;
    --bg-surface-elevated: #161b22;
    --bg-input: #0d1117;
    
    --border-color: #21262d;
    --border-color-hover: #30363d;
    
    --text-primary: #f0f6fc;
    --text-muted: #8b949e;
    --text-dark: #21262d;
    
    /* Accents */
    --accent-primary: #58a6ff;
    --accent-primary-hover: #1f6feb;
    --accent-glow: rgba(88, 166, 255, 0.15);
    
    /* Status Colors */
    --status-p-bg: rgba(46, 160, 67, 0.15);
    --status-p-color: #3fb950;
    
    --status-a-bg: rgba(248, 81, 73, 0.15);
    --status-a-color: #f85149;
    
    --status-hd-bg: rgba(210, 153, 34, 0.15);
    --status-hd-color: #d29922;
    
    --status-leave-bg: rgba(187, 128, 250, 0.15);
    --status-leave-color: #bc8cff;
    
    --status-holiday-bg: rgba(139, 148, 158, 0.15);
    --status-holiday-color: #c9d1d9;

    /* Spacing & Transitions */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --transition-smooth: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Global Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
}

/* Scrollbar Customization */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
    background: var(--border-color-hover);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* App Loader */
.loader-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    gap: 15px;
    background-color: var(--bg-main);
}
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top: 3px solid var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

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

/* Sidebar Navigation */
.sidebar {
    width: 260px;
    background-color: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px;
    position: fixed;
    height: 100vh;
    z-index: 10;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 40px;
}
.logo-icon {
    font-size: 24px;
    color: var(--accent-primary);
}
.logo-text {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.nav-item:hover, .nav-item.active {
    color: var(--text-primary);
    background-color: var(--bg-surface-elevated);
}
.nav-item.active {
    border-left: 3px solid var(--accent-primary);
}

.user-profile-widget {
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background-color: var(--bg-surface-elevated);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-primary);
    font-weight: bold;
    border: 1px solid var(--border-color);
}
.user-info {
    flex-grow: 1;
    overflow: hidden;
}
.username {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.user-role {
    font-size: 12px;
    color: var(--text-muted);
}
.btn-logout {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    transition: var(--transition-smooth);
}
.btn-logout:hover {
    color: var(--status-a-color);
}

/* Main Content Area */
.main-content {
    margin-left: 260px;
    flex-grow: 1;
    padding: 40px;
    background-color: var(--bg-main);
    min-height: 100vh;
    min-width: 0;
}

/* Headers */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}
.page-title {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
}
.header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

/* Forms & Inputs */
.form-group {
    margin-bottom: 20px;
}
.form-label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
}
.input-control {
    width: 100%;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    color: var(--text-primary);
    font-size: 14px;
    transition: var(--transition-smooth);
}
select option {
    background-color: var(--bg-surface-elevated);
    color: var(--text-primary);
}
.input-control:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    cursor: pointer;
    border: none;
    transition: var(--transition-smooth);
}
.btn-primary {
    background-color: var(--accent-primary);
    color: #0a0c10;
    font-weight: 600;
}
.btn-primary:hover {
    background-color: var(--accent-primary-hover);
    color: #ffffff;
}
.btn-secondary {
    background-color: var(--bg-surface-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}
.btn-secondary:hover {
    background-color: var(--border-color-hover);
}
.btn-danger {
    background-color: rgba(248, 81, 73, 0.15);
    color: var(--status-a-color);
    border: 1px solid rgba(248, 81, 73, 0.2);
}
.btn-danger:hover {
    background-color: var(--status-a-color);
    color: #ffffff;
}

/* Login Page */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}
.login-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 420px;
    padding: 40px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.login-header {
    text-align: center;
    margin-bottom: 30px;
}
.login-logo {
    font-size: 32px;
    color: var(--accent-primary);
    margin-bottom: 12px;
}
.login-title {
    font-size: 24px;
    font-weight: 700;
}
.login-subtitle {
    font-size: 14px;
    color: var(--text-muted);
}
.login-error {
    background-color: rgba(248, 81, 73, 0.1);
    border: 1px solid rgba(248, 81, 73, 0.2);
    border-radius: var(--radius-sm);
    color: var(--status-a-color);
    padding: 12px;
    font-size: 14px;
    margin-bottom: 20px;
    text-align: center;
}

/* Dashboard Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}
.metric-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
    overflow: hidden;
}
.metric-icon-box {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 28px;
    color: var(--border-color-hover);
}
.metric-title {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 500;
}
.metric-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}
.metric-footer {
    font-size: 12px;
    color: var(--text-muted);
}
.metric-footer.up { color: var(--status-p-color); }
.metric-footer.down { color: var(--status-a-color); }

/* Dashboard Content Grid */
.dashboard-details {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}
.content-box {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
}
.content-box-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Tables styling */
.table-wrapper {
    overflow-x: auto;
    width: 100%;
}
.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 14px;
}
.data-table th {
    background-color: var(--bg-surface-elevated);
    padding: 14px 16px;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}
.data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}
.data-table tbody tr:hover {
    background-color: rgba(255,255,255,0.02);
}

.attendance-grid-container {
    max-height: calc(100vh - 200px);
    max-width: 100%;
    overflow: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--bg-surface);
}
.attendance-table {
    border-collapse: separate;
    border-spacing: 0;
    width: max-content;
    min-width: 100%;
}
.attendance-table th {
    position: sticky;
    top: 0;
    z-index: 2;
    background-color: var(--bg-surface-elevated);
}
.attendance-table th:first-child,
.attendance-table td:first-child {
    position: sticky;
    left: 0;
    z-index: 3;
    background-color: var(--bg-surface-elevated);
    border-right: 2px solid var(--border-color);
}
.attendance-table td:first-child {
    background-color: var(--bg-surface);
}
.attendance-table tbody tr:hover td:first-child {
    background-color: var(--bg-surface-elevated);
}
.attendance-cell {
    padding: 8px !important;
    text-align: center !important;
    min-width: 65px;
}

/* Attendance Status Badge styles */
.status-select {
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 4px 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    width: 100%;
    outline: none;
    transition: var(--transition-smooth);
}
.status-select:focus {
    border-color: var(--accent-primary);
}
.status-select[data-status="P"] { background-color: var(--status-p-bg); color: var(--status-p-color); border-color: rgba(63, 185, 80, 0.3); }
.status-select[data-status="A"] { background-color: var(--status-a-bg); color: var(--status-a-color); border-color: rgba(248, 81, 73, 0.3); }
.status-select[data-status="HD"] { background-color: var(--status-hd-bg); color: var(--status-hd-color); border-color: rgba(210, 153, 34, 0.3); }
.status-select[data-status="SL"] { background-color: var(--status-leave-bg); color: var(--status-leave-color); border-color: rgba(188, 140, 255, 0.3); }
.status-select[data-status="CL"] { background-color: var(--status-leave-bg); color: var(--status-leave-color); border-color: rgba(188, 140, 255, 0.3); }
.status-select[data-status="LOP"] { background-color: var(--status-a-bg); color: var(--status-a-color); border-color: rgba(248, 81, 73, 0.3); }
.status-select[data-status="H"] { background-color: var(--status-holiday-bg); color: var(--status-holiday-color); border-color: rgba(139, 148, 158, 0.3); }
.status-select[data-status=""] { background: transparent; color: var(--text-muted); border-color: var(--border-color); }

/* Employee Grid/Directory Cards */
.employee-directory {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}
.employee-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.employee-card:hover {
    border-color: var(--border-color-hover);
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}
.emp-card-header {
    display: flex;
    align-items: center;
    gap: 15px;
}
.emp-badge {
    background-color: var(--border-color-hover);
    color: var(--accent-primary);
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 700;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
}
.emp-card-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 14px;
    border-top: 1px solid var(--border-color);
    padding-top: 15px;
    margin-top: 5px;
}
.emp-detail-row {
    display: flex;
    justify-content: space-between;
}
.emp-detail-label {
    color: var(--text-muted);
}
.emp-detail-val {
    font-weight: 500;
}
.emp-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 15px;
}

/* Modals */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}
.modal-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}
.modal-container {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 32px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    transform: scale(0.9);
    transition: transform 0.2s ease;
}
.modal-backdrop.open .modal-container {
    transform: scale(1);
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}
.modal-title {
    font-size: 20px;
    font-weight: 700;
}
.modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
}
.modal-close:hover {
    color: var(--text-primary);
}
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 28px;
}

/* Month Navigation widget */
.month-picker-container {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 4px 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.month-picker-select {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
    outline: none;
    cursor: pointer;
}
.month-picker-select option {
    background-color: var(--bg-surface);
    color: var(--text-primary);
}

/* Utilities */
.text-center { text-align: center; }
.text-right { text-align: right; }
.flex-row { display: flex; align-items: center; gap: 10px; }
.badge-status {
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}
.badge-status.present { background-color: var(--status-p-bg); color: var(--status-p-color); }
.badge-status.absent { background-color: var(--status-a-bg); color: var(--status-a-color); }

/* Project Management Tabbed Navigation */
.project-tabs {
    display: flex;
    gap: 8px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 24px;
}
.project-tab-btn {
    padding: 10px 20px;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
}
.project-tab-btn:hover {
    color: var(--text-primary);
}
.project-tab-btn.active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
}

/* Editor task list layouts */
.editor-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    margin-top: 20px;
}
.editor-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    transition: var(--transition-smooth);
}
.editor-card:hover {
    border-color: var(--border-color-hover);
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}
.editor-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}
.editor-card-title {
    font-size: 16px;
    font-weight: 700;
}
.editor-card-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Holiday Post Tracker Status Select Styles */
.holiday-select {
    width: 100%;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 4px 8px;
    color: var(--text-primary);
    font-size: 12px;
    cursor: pointer;
}
.holiday-select.approved {
    border-color: var(--status-p-color);
    color: var(--status-p-color);
}
.holiday-select.pending {
    border-color: var(--status-hd-color);
    color: var(--status-hd-color);
}
.holiday-select.not-needed {
    border-color: var(--border-color);
    color: var(--text-muted);
}

/* Numeric input in cell grids */
.grid-number-input {
    width: 60px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-primary);
    text-align: center;
    font-size: 13px;
    border-radius: 3px;
    padding: 2px;
}
.grid-number-input:focus {
    border-color: var(--accent-primary);
    background-color: var(--bg-input);
    outline: none;
}

/* Sidebar holiday list interactive states */
.holiday-list-item:hover {
    background-color: rgba(255, 255, 255, 0.05) !important;
}
.holiday-list-item.active:hover {
    background-color: rgba(56, 189, 248, 0.25) !important;
}
.holiday-list-scroller::-webkit-scrollbar {
    width: 4px;
}
.holiday-list-scroller::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 2px;
}

/* Distinct scrollbar highlight for table wrappers */
.table-wrapper::-webkit-scrollbar-thumb {
    background: rgba(56, 189, 248, 0.45); /* soft sky-blue */
    border-radius: 4px;
}
.table-wrapper::-webkit-scrollbar-thumb:hover {
    background: rgba(56, 189, 248, 0.7);
}
.table-wrapper::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.6);
    border-radius: 4px;
}

