/* ============================================================
   WELDEW REMEDIES HRMS — Complete Responsive Stylesheet
   ============================================================ */

:root {
    --primary: #2563EB;
    --primary-dark: #1D4ED8;
    --primary-light: #DBEAFE;
    --success: #10B981;
    --success-light: #D1FAE5;
    --warning: #F59E0B;
    --warning-light: #FEF3C7;
    --danger: #EF4444;
    --danger-light: #FEE2E2;
    --info: #06B6D4;
    --info-light: #CFFAFE;
    --gray-50: #F9FAFB;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-300: #D1D5DB;
    --gray-400: #9CA3AF;
    --gray-500: #6B7280;
    --gray-600: #4B5563;
    --gray-700: #374151;
    --gray-800: #1F2937;
    --gray-900: #111827;
    --sidebar-width: 260px;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-lg: 0 4px 14px rgba(0,0,0,0.1);
}

/* ============ RESET ============ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: var(--gray-100); color: var(--gray-800); line-height: 1.6; font-size: 14px; }
a { color: var(--primary); text-decoration: none; }
img { max-width: 100%; }
table { width: 100%; border-collapse: collapse; }

/* ============ LOGIN PAGE ============ */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #1e3a5f 0%, #2563EB 100%); padding: 20px; }
.login-container { width: 100%; max-width: 420px; }
.login-card { background: white; border-radius: 16px; padding: 40px 32px; box-shadow: var(--shadow-lg); }
.login-header { text-align: center; margin-bottom: 32px; }
.login-logo { font-size: 48px; color: var(--primary); margin-bottom: 12px; }
.login-header h1 { font-size: 22px; color: var(--gray-800); margin-bottom: 4px; }
.login-header p { color: var(--gray-500); font-size: 13px; }
.login-form .form-group { margin-bottom: 20px; }
.login-form label { display: block; font-size: 13px; color: var(--gray-600); margin-bottom: 6px; font-weight: 500; }
.login-form input { width: 100%; padding: 12px 14px; border: 1.5px solid var(--gray-200); border-radius: 8px; font-size: 14px; transition: border-color 0.2s; }
.login-form input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.login-footer { text-align: center; margin-top: 24px; color: var(--gray-400); }

/* ============ LAYOUT ============ */
.mobile-header { display: none; position: fixed; top: 0; left: 0; right: 0; z-index: 1000; background: white; height: 56px; padding: 0 16px; align-items: center; justify-content: space-between; box-shadow: var(--shadow); }
.menu-toggle { background: none; border: none; font-size: 20px; color: var(--gray-700); cursor: pointer; padding: 8px; }
.mobile-title { font-size: 16px; font-weight: 700; color: var(--gray-800); }
.mobile-user { width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: white; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; }

.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 1001; }

.sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: var(--sidebar-width); background: white; z-index: 1002; display: flex; flex-direction: column; box-shadow: 2px 0 8px rgba(0,0,0,0.06); overflow-y: auto; transition: transform 0.25s ease; }
.sidebar-close { display: none; background: none; border: none; font-size: 18px; color: var(--gray-400); cursor: pointer; }

.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 20px; border-bottom: 1px solid var(--gray-100); font-weight: 700; font-size: 16px; color: var(--primary-dark); }
.sidebar-brand i { font-size: 22px; }

.sidebar-user { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--gray-100); }
.user-avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--primary); color: white; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 600; flex-shrink: 0; overflow: hidden; }
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-info strong { display: block; font-size: 14px; color: var(--gray-800); }
.user-info small { color: var(--gray-500); font-size: 12px; }

.sidebar-nav { flex: 1; padding: 8px 0; overflow-y: auto; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 10px 20px; color: var(--gray-600); font-size: 13.5px; font-weight: 500; transition: all 0.15s; position: relative; }
.nav-item:hover { background: var(--gray-50); color: var(--primary); }
.nav-item.active { background: var(--primary-light); color: var(--primary-dark); font-weight: 600; }
.nav-item i { width: 20px; text-align: center; font-size: 15px; }
.nav-item .badge { position: absolute; right: 16px; background: var(--danger); color: white; font-size: 11px; padding: 2px 7px; border-radius: 10px; font-weight: 600; }

.nav-divider { padding: 16px 20px 6px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.8px; color: var(--gray-400); font-weight: 600; }

.sidebar-footer { border-top: 1px solid var(--gray-100); padding: 8px 0; }
.logout-btn { color: var(--danger) !important; }

.main-content { margin-left: var(--sidebar-width); padding: 24px; min-height: 100vh; }

/* ============ PAGE HEADER ============ */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.page-header h2 { font-size: 22px; font-weight: 700; color: var(--gray-800); }
.page-date { color: var(--gray-500); font-size: 13px; }

/* ============ CARDS ============ */
.card { background: white; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 20px; overflow: hidden; }
.card-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--gray-100); flex-wrap: wrap; gap: 10px; }
.card-header h3 { font-size: 15px; font-weight: 600; color: var(--gray-800); }
.card-header h3 i { margin-right: 8px; color: var(--primary); }
.card-body { padding: 20px; }
.header-actions { display: flex; gap: 8px; align-items: center; }

/* ============ BUTTONS ============ */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border: none; border-radius: 8px; font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.15s; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-warning { background: var(--warning); color: white; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 14px 24px; font-size: 16px; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-outline { background: white; border: 1.5px solid var(--gray-200); color: var(--gray-700); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }

/* ============ FORMS ============ */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; color: var(--gray-700); margin-bottom: 5px; }
.form-control, select, textarea, input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="date"], input[type="tel"], input[type="time"] {
    width: 100%; padding: 10px 12px; border: 1.5px solid var(--gray-200); border-radius: 8px;
    font-size: 14px; color: var(--gray-800); background: white; transition: border-color 0.2s;
}
.form-control:focus, select:focus, textarea:focus, input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.form-control-sm { padding: 6px 10px; font-size: 13px; border-radius: 6px; border: 1.5px solid var(--gray-200); }
select { appearance: auto; }
textarea { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.form-hint { font-size: 12px; color: var(--gray-400); margin-top: 4px; }
.form-check { display: flex; align-items: center; gap: 8px; }
.form-check input[type="checkbox"] { width: 18px; height: 18px; }

/* ============ ALERTS ============ */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; display: flex; align-items: center; justify-content: space-between; font-size: 14px; animation: slideDown 0.3s ease; }
.alert button { background: none; border: none; font-size: 18px; cursor: pointer; opacity: 0.5; }
.alert-success { background: var(--success-light); color: #065F46; border-left: 4px solid var(--success); }
.alert-danger { background: var(--danger-light); color: #991B1B; border-left: 4px solid var(--danger); }
.alert-warning { background: var(--warning-light); color: #92400E; border-left: 4px solid var(--warning); }
.alert-info { background: var(--info-light); color: #155E75; border-left: 4px solid var(--info); }
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

/* ============ TABLES ============ */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table th { padding: 10px 12px; text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--gray-500); background: var(--gray-50); border-bottom: 2px solid var(--gray-200); white-space: nowrap; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
.table tr:hover { background: var(--gray-50); }

/* ============ BADGES ============ */
.badge-pill { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 11px; font-weight: 600; }
.badge-success { background: var(--success-light); color: #065F46; }
.badge-danger { background: var(--danger-light); color: #991B1B; }
.badge-warning { background: var(--warning-light); color: #92400E; }
.badge-info { background: var(--info-light); color: #155E75; }
.badge-secondary { background: var(--gray-100); color: var(--gray-600); }

/* ============ STATS GRID ============ */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card { display: flex; align-items: center; gap: 16px; padding: 20px; background: white; border-radius: var(--radius); box-shadow: var(--shadow); }
.stat-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 20px; }
.stat-blue .stat-icon { background: var(--primary-light); color: var(--primary); }
.stat-green .stat-icon { background: var(--success-light); color: var(--success); }
.stat-orange .stat-icon { background: var(--warning-light); color: var(--warning); }
.stat-red .stat-icon { background: var(--danger-light); color: var(--danger); }
.stat-info h3 { font-size: 24px; font-weight: 700; color: var(--gray-800); }
.stat-info p { color: var(--gray-500); font-size: 13px; }

/* ============ GRID LAYOUTS ============ */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }

/* ============ QUICK PUNCH CARD ============ */
.quick-punch-card .card-body { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; }
.punch-timeline { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.punch-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 20px; font-size: 13px; font-weight: 500; }
.chip-in { background: var(--success-light); color: #065F46; }
.chip-out { background: var(--info-light); color: #155E75; }

/* ============ DEPARTMENT BARS ============ */
.dept-bar { margin-bottom: 14px; }
.dept-bar-info { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; }
.progress-bar { height: 8px; background: var(--gray-100); border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--primary); border-radius: 4px; transition: width 0.5s; }

/* ============ LEAVE BALANCE GRID ============ */
.leave-balance-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.leave-balance-card { background: var(--gray-50); border-radius: 8px; padding: 14px; }
.lb-header { font-size: 13px; font-weight: 600; color: var(--gray-700); margin-bottom: 8px; }
.lb-numbers { text-align: center; margin: 8px 0; }
.lb-available { font-size: 28px; font-weight: 700; color: var(--primary); }
.lb-label { display: block; font-size: 12px; color: var(--gray-500); }
.lb-details { font-size: 12px; color: var(--gray-500); text-align: center; }

/* ============ APPROVAL ITEMS ============ */
.approval-item { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--gray-100); gap: 12px; }
.approval-info { flex: 1; }
.approval-info strong { display: block; }
.approval-info span { font-size: 13px; color: var(--gray-500); }
.approval-actions { display: flex; gap: 6px; }

/* ============ ATTENDANCE MARK PAGE ============ */
.gps-status { display: flex; align-items: center; gap: 10px; padding: 14px; background: var(--gray-50); border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.gps-spinner { width: 20px; height: 20px; border: 3px solid var(--gray-200); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.punch-map { height: 250px; border-radius: 8px; margin-bottom: 16px; z-index: 1; }

.location-details { background: var(--gray-50); border-radius: 8px; padding: 14px; margin-bottom: 16px; }
.loc-row { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 6px; font-size: 13px; }
.loc-row i { margin-top: 2px; color: var(--primary); }
.loc-coords { color: var(--gray-500); }

.selfie-section { margin-bottom: 20px; }
.selfie-section h4 { font-size: 14px; margin-bottom: 10px; color: var(--gray-700); }
.selfie-preview { width: 200px; height: 150px; border-radius: 8px; overflow: hidden; background: var(--gray-800); margin-bottom: 8px; }
.selfie-preview video, .selfie-preview img { width: 100%; height: 100%; object-fit: cover; }
.selfie-controls { display: flex; gap: 8px; }

.punch-actions { margin: 20px 0; }
.punch-btn { font-size: 18px; padding: 16px; border-radius: 12px; font-weight: 700; letter-spacing: 1px; }

.punch-result { padding: 16px; border-radius: 10px; margin-top: 16px; }
.result-success { background: var(--success-light); color: #065F46; }
.result-success i { font-size: 24px; color: var(--success); }
.result-error { background: var(--danger-light); color: #991B1B; }
.result-error i { font-size: 24px; color: var(--danger); }
.punch-result strong { display: block; margin: 4px 0; }
.punch-result p { margin: 2px 0; font-size: 13px; }

.current-time { font-size: 20px; font-weight: 700; color: var(--primary); font-variant-numeric: tabular-nums; }

/* Punch History */
.punch-history { display: flex; flex-direction: column; gap: 12px; }
.history-item { display: flex; align-items: flex-start; gap: 12px; padding: 12px; background: var(--gray-50); border-radius: 8px; }
.hi-icon { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: white; flex-shrink: 0; }
.hi-in { background: var(--success); }
.hi-out { background: var(--info); }
.hi-info { flex: 1; }
.hi-info strong { display: block; font-size: 14px; }
.hi-info small { display: block; color: var(--gray-500); font-size: 12px; margin-top: 2px; }
.hi-selfie { width: 48px; height: 48px; border-radius: 6px; object-fit: cover; }

/* ============ LIVE MAP ============ */
.emp-location-list { max-height: 400px; overflow-y: auto; }
.emp-loc-item { display: flex; align-items: center; gap: 12px; padding: 12px; border-bottom: 1px solid var(--gray-100); cursor: pointer; transition: background 0.15s; }
.emp-loc-item:hover { background: var(--gray-50); }
.eli-avatar { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: white; font-size: 12px; font-weight: 600; flex-shrink: 0; }
.eli-info { flex: 1; }
.eli-info strong { display: block; font-size: 14px; }
.eli-info small { display: block; font-size: 12px; color: var(--gray-500); }

/* ============ PAGINATION ============ */
.pagination { display: flex; gap: 4px; justify-content: center; margin-top: 20px; flex-wrap: wrap; }
.pagination a, .pagination span { padding: 6px 12px; border-radius: 6px; font-size: 13px; font-weight: 500; }
.pagination a { background: white; border: 1px solid var(--gray-200); color: var(--gray-700); }
.pagination a:hover { background: var(--primary-light); border-color: var(--primary); }
.pagination .active { background: var(--primary); color: white; border: 1px solid var(--primary); }

/* ============ FILTER BAR ============ */
.filter-bar { display: flex; gap: 12px; padding: 16px 20px; background: var(--gray-50); flex-wrap: wrap; align-items: end; }
.filter-bar .form-group { margin-bottom: 0; flex: 1; min-width: 160px; }

/* ============ EMPLOYEE LIST ============ */
.emp-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.emp-card { display: flex; align-items: center; gap: 14px; padding: 16px; background: white; border-radius: var(--radius); box-shadow: var(--shadow); transition: box-shadow 0.2s; }
.emp-card:hover { box-shadow: var(--shadow-lg); }
.emp-card-avatar { width: 48px; height: 48px; border-radius: 50%; background: var(--primary); color: white; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 16px; flex-shrink: 0; overflow: hidden; }
.emp-card-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ============ TEXT UTILITIES ============ */
.text-muted { color: var(--gray-500); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.mb-0 { margin-bottom: 0; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }

/* ============ PROFILE / SHOW PAGE ============ */
.profile-header { display: flex; align-items: center; gap: 20px; padding: 24px; flex-wrap: wrap; }
.profile-avatar { width: 80px; height: 80px; border-radius: 50%; background: var(--primary); color: white; display: flex; align-items: center; justify-content: center; font-size: 28px; font-weight: 600; overflow: hidden; flex-shrink: 0; }
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-name h2 { font-size: 20px; margin-bottom: 2px; }
.profile-name p { color: var(--gray-500); font-size: 13px; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; padding: 20px; }
.detail-item label { font-size: 12px; color: var(--gray-400); text-transform: uppercase; letter-spacing: 0.5px; display: block; margin-bottom: 2px; }
.detail-item span { font-size: 14px; color: var(--gray-800); font-weight: 500; }

/* ============ TABS ============ */
.tabs { display: flex; border-bottom: 2px solid var(--gray-200); margin-bottom: 20px; overflow-x: auto; }
.tab { padding: 10px 20px; font-size: 14px; font-weight: 500; color: var(--gray-500); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; white-space: nowrap; }
.tab:hover { color: var(--gray-700); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* ============ GEOFENCE CREATE/EDIT ============ */
.geofence-map { height: 400px; border-radius: 8px; margin-bottom: 20px; }

/* ============ 404 / ERROR PAGES ============ */
.error-page { text-align: center; padding: 80px 20px; }
.error-page h1 { font-size: 72px; color: var(--gray-300); }
.error-page p { color: var(--gray-500); margin: 12px 0 24px; }

/* ============================================================
   RESPONSIVE DESIGN
   ============================================================ */

@media (max-width: 1024px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .grid-2 { grid-template-columns: 1fr; }
    .form-row-3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
    /* Show mobile header, hide desktop sidebar by default */
    .mobile-header { display: flex; }
    .sidebar-close { display: block; }

    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .sidebar-overlay.open {
        display: block;
    }
    .sidebar-brand { justify-content: space-between; }

    .main-content {
        margin-left: 0;
        padding: 72px 16px 24px;
    }

    .page-header { flex-direction: column; align-items: flex-start; gap: 4px; }
    .page-header h2 { font-size: 18px; }

    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .stat-card { padding: 14px; gap: 10px; }
    .stat-icon { width: 40px; height: 40px; font-size: 16px; }
    .stat-info h3 { font-size: 20px; }
    .stat-info p { font-size: 12px; }

    .form-row { grid-template-columns: 1fr; }
    .form-row-3 { grid-template-columns: 1fr; }

    .filter-bar { flex-direction: column; }
    .filter-bar .form-group { min-width: 100%; }

    .card-header { padding: 12px 16px; }
    .card-body { padding: 16px; }

    .table th, .table td { padding: 8px 10px; font-size: 12px; }

    .quick-punch-card .card-body { flex-direction: column; align-items: stretch; }

    .leave-balance-grid { grid-template-columns: 1fr 1fr; }

    .punch-map { height: 200px; }

    .profile-header { flex-direction: column; text-align: center; }
    .detail-grid { grid-template-columns: 1fr 1fr; }

    .emp-card-grid { grid-template-columns: 1fr; }

    .approval-item { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .stat-card { flex-direction: column; text-align: center; padding: 12px; }

    .leave-balance-grid { grid-template-columns: 1fr; }
    .detail-grid { grid-template-columns: 1fr; }

    .selfie-preview { width: 160px; height: 120px; }

    .header-actions { flex-wrap: wrap; }
}

/* ============ PRINT ============ */
@media print {
    .sidebar, .mobile-header, .sidebar-overlay, .btn, .filter-bar { display: none !important; }
    .main-content { margin-left: 0; padding: 0; }
    .card { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
}
