/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; background: #f0f2f5; color: #333; }

/* ===== Auth pages ===== */
.auth-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #1e3a5f 0%, #2d5a8e 100%); }
.auth-box { background: #fff; border-radius: 12px; padding: 40px; width: 420px; max-width: 95vw; box-shadow: 0 20px 60px rgba(0,0,0,0.3); text-align: center; }
.auth-box h2 { text-align: center; font-size: 28px; margin-bottom: 4px; }
.auth-subtitle { text-align: center; color: #888; margin-bottom: 24px; }
.auth-footer { text-align: center; margin-top: 20px; }
.auth-footer a { color: #2d5a8e; text-decoration: none; font-size: 14px; }
.auth-footer a:hover { text-decoration: underline; }

/* Logo timesheet principal */
.auth-logo-main { margin-bottom: 20px; }
.timesheet-logo { max-width: 300px; max-height: 150px; object-fit: contain; }

/* Logo-uri companie (sub timesheet) */
.auth-logos-company { display: flex; justify-content: center; align-items: center; gap: 20px; margin-bottom: 24px; padding-top: 16px; border-top: 1px solid #eee; flex-wrap: wrap; }
.auth-logo-sm { width: 120px; height: 60px; object-fit: contain; opacity: 0.9; }

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

/* ===== Sidebar ===== */
.sidebar { width: 260px; background: #1a2332; color: #c8d6e5; display: flex; flex-direction: column; flex-shrink: 0; }
.sidebar-header { padding: 24px 20px 16px; border-bottom: 1px solid #2a3a4e; }
.sidebar-header h2 { font-size: 20px; color: #fff; margin-bottom: 8px; }
.user-info { font-size: 15px; color: #74b9ff; font-weight: 600; }
.dept-info { font-size: 12px; color: #8899aa; margin-top: 2px; }

.sidebar-nav { padding: 12px 0; flex: 1; }
.nav-item { display: block; padding: 10px 20px; color: #a0b4c8; text-decoration: none; font-size: 14px; transition: all 0.2s; border-left: 3px solid transparent; }
.nav-item:hover { background: #243447; color: #fff; }
.nav-item.active { background: #243447; color: #74b9ff; border-left-color: #74b9ff; }
.nav-item.logout { color: #ff7675; margin-top: 20px; border-top: 1px solid #2a3a4e; padding-top: 16px; }

.monthly-summary { padding: 16px 20px; border-top: 1px solid #2a3a4e; }
.monthly-summary h4 { font-size: 12px; text-transform: uppercase; color: #8899aa; margin-bottom: 8px; letter-spacing: 1px; }
.month-link { display: block; color: #a0b4c8; text-decoration: none; font-size: 13px; padding: 3px 0; }
.month-link:hover { color: #74b9ff; }
.month-link strong { color: #55efc4; }
.no-data { font-size: 12px; color: #666; }

/* ===== Main ===== */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

/* ===== Topbar ===== */
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 12px 24px; background: #fff; border-bottom: 1px solid #e0e0e0; flex-shrink: 0; flex-wrap: wrap; gap: 8px; }
.month-selector { display: flex; align-items: center; gap: 8px; }
.month-selector select { padding: 8px 12px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; background: #fff; cursor: pointer; }
.btn-nav { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border: 1px solid #ddd; border-radius: 6px; text-decoration: none; color: #555; font-size: 16px; background: #fff; transition: all 0.2s; }
.btn-nav:hover { background: #f0f0f0; border-color: #bbb; }
.topbar-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.total-badge { background: #e8f5e9; color: #2e7d32; padding: 6px 14px; border-radius: 20px; font-size: 14px; }
.lock-badge { display: inline-flex; align-items: center; gap: 4px; background: #fff3e0; color: #e65100; padding: 4px 12px; border-radius: 12px; font-size: 13px; font-weight: 600; }

/* ===== Legend ===== */
.legend { display: flex; align-items: center; gap: 20px; padding: 8px 24px; background: #fff; border-bottom: 1px solid #eee; font-size: 12px; flex-shrink: 0; }
.legend-item { display: flex; align-items: center; gap: 6px; }
.legend-color { width: 18px; height: 14px; border-radius: 3px; display: inline-block; }

/* ===== Buttons ===== */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border: none; border-radius: 6px; font-size: 14px; cursor: pointer; text-decoration: none; transition: all 0.2s; font-weight: 500; }
.btn-primary { background: #2d5a8e; color: #fff; }
.btn-primary:hover { background: #1e3a5f; }
.btn-danger { background: #e74c3c; color: #fff; }
.btn-danger:hover { background: #c0392b; }
.btn-export { background: #27ae60; color: #fff; }
.btn-export:hover { background: #1e8449; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; }

/* ===== Flash ===== */
.flash-messages { padding: 12px 24px 0; }
.flash { padding: 10px 16px; border-radius: 6px; margin-bottom: 8px; font-size: 14px; }
.flash.error { background: #fdecea; color: #c0392b; border: 1px solid #f5c6cb; }
.flash.success { background: #e8f5e9; color: #2e7d32; border: 1px solid #a5d6a7; }

/* ===== Table ===== */
.table-wrapper { flex: 1; overflow: auto; padding: 16px 24px; }
.timesheet-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,0.08); font-size: 13px; }
.timesheet-table thead th { background: #2d5a8e; color: #fff; padding: 10px 6px; text-align: center; font-weight: 600; white-space: nowrap; position: sticky; top: 0; z-index: 10; }
.timesheet-table thead th.col-code { min-width: 90px; text-align: left; padding-left: 12px; }
.timesheet-table thead th.col-name { min-width: 180px; text-align: left; padding-left: 12px; }
.timesheet-table thead th.col-activity { min-width: 120px; text-align: left; padding-left: 12px; }
.timesheet-table thead th.col-day { width: 36px; font-size: 11px; }
.timesheet-table thead th.col-total { min-width: 50px; }
.timesheet-table thead th.col-pct { min-width: 40px; }

/* Weekend / Holiday headers */
.timesheet-table thead th.day-saturday { background: #5dade2; }
.timesheet-table thead th.day-sunday { background: #5dade2; }
.timesheet-table thead th.day-holiday { background: #c0392b; }

.timesheet-table tbody tr:nth-child(even) { background: #f8f9fa; }
.timesheet-table tbody tr:hover { background: #e8f4fd; }
.timesheet-table tbody tr.locked { background: #fafafa; }
.timesheet-table tbody tr.locked:hover { background: #f5f5f5; }
.timesheet-table td { padding: 6px; border-bottom: 1px solid #eee; }
.timesheet-table td.cell-code { font-weight: 600; color: #2d5a8e; padding-left: 12px; }
.timesheet-table td.cell-name { padding-left: 12px; }
.timesheet-table td.cell-activity { padding-left: 12px; color: #888; font-style: italic; }

/* Hour inputs */
.hour-input { width: 34px; height: 28px; text-align: center; border: 1px solid #ddd; border-radius: 4px; font-size: 12px; background: #fff; transition: all 0.2s; }
.hour-input:focus { outline: none; border-color: #2d5a8e; box-shadow: 0 0 0 2px rgba(45,90,142,0.2); }
.hour-input.saved { background: #c8e6c9; border-color: #66bb6a; }
.hour-input:disabled { background: #f5f5f5; color: #999; cursor: not-allowed; }

/* Weekend / Holiday cells */
td.day-saturday { background: #d6eaf8; }
td.day-sunday { background: #d6eaf8; }
td.day-holiday { background: #fadbd8; }
td.day-saturday .hour-input { background: #d6eaf8; }
td.day-sunday .hour-input { background: #d6eaf8; }
td.day-holiday .hour-input { background: #fadbd8; }
td.day-saturday .hour-input:disabled { background: #d0e0f0; }
td.day-sunday .hour-input:disabled { background: #d0e0f0; }
td.day-holiday .hour-input:disabled { background: #f5c6c6; }

/* Total columns */
.timesheet-table td.cell-total { text-align: center; font-weight: 700; color: #2d5a8e; background: #e3f2fd; }
.timesheet-table td.cell-pct { text-align: center; font-size: 11px; color: #888; }

/* Total row */
.timesheet-table tfoot td { background: #2d5a8e; color: #fff; font-weight: 700; padding: 10px 6px; text-align: center; border: none; }
.timesheet-table tfoot td:first-child { text-align: left; padding-left: 12px; }
.timesheet-table tfoot td.day-saturday { background: #4a90b8; }
.timesheet-table tfoot td.day-sunday { background: #4a90b8; }
.timesheet-table tfoot td.day-holiday { background: #a93226; }

/* Locked row */
tr.locked td { background: #fafafa; }
tr.locked .hour-input { background: #f0f0f0; color: #999; }

/* ===== Add project ===== */
.add-project { padding: 16px 24px; background: #fff; border-top: 1px solid #e0e0e0; }
.add-project h4 { margin-bottom: 12px; color: #555; }
#addProjectForm { display: flex; gap: 8px; align-items: center; }
#addProjectForm input { padding: 8px 12px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; }
#addProjectForm input:focus { outline: none; border-color: #2d5a8e; }

/* ===== Cards ===== */
.card { background: #fff; border-radius: 8px; padding: 20px; margin: 16px 24px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.card h4 { margin-bottom: 16px; color: #333; }

/* ===== Data table ===== */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { background: #f8f9fa; padding: 10px 14px; text-align: left; font-weight: 600; border-bottom: 2px solid #dee2e6; font-size: 13px; }
.data-table td { padding: 10px 14px; border-bottom: 1px solid #eee; font-size: 14px; }
.data-table tr:hover { background: #f8f9fa; }

/* ===== Form ===== */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 4px; font-weight: 500; font-size: 14px; color: #555; }
.form-group input { width: 100%; padding: 10px 12px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; }
.form-group input:focus { outline: none; border-color: #2d5a8e; box-shadow: 0 0 0 2px rgba(45,90,142,0.15); }

.form-row { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.form-row input { padding: 8px 12px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; }
.form-row input:focus { outline: none; border-color: #2d5a8e; }

.checkbox-label { display: flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; }

/* ===== Approval section ===== */
.approval-section { padding: 16px 24px; background: #fff; border-top: 1px solid #e0e0e0; }
.approval-table { width: 100%; border-collapse: collapse; margin-bottom: 12px; }
.approval-table td { padding: 8px 12px; vertical-align: middle; }
.approval-label { font-weight: 700; font-size: 13px; color: #2d5a8e; white-space: nowrap; padding-right: 4px !important; }
.approval-name { font-weight: 700; font-size: 14px; color: #1a2332; border-bottom: 2px solid #2d5a8e; min-width: 180px; }
.approval-input input { width: 100%; padding: 6px 10px; border: 1px solid #ccc; border-radius: 4px; font-size: 13px; }
.approval-input input:focus { outline: none; border-color: #2d5a8e; box-shadow: 0 0 0 2px rgba(45,90,142,0.15); }
.approval-date { font-size: 11px; color: #999; font-style: italic; padding-top: 2px !important; }
.approval-actions { text-align: right; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .sidebar { width: 60px; }
  .sidebar-header h2, .user-info, .dept-info, .monthly-summary, .nav-item:not(.logout) { display: none; }
  .nav-item { text-align: center; padding: 12px 0; font-size: 20px; }
  .form-row { flex-direction: column; }
}
