/* ============================================================
   Credit Rapid Mureș — CSS Principal
   Desktop-first, min-width 1200px, responsive down to 390px
   Culori: #1A5276 (albastru închis), #2E86C1 (albastru),
           #F4F6F7 (fundal), #2D2D2D (text)
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue-dark: #1A5276;
  --blue:      #2E86C1;
  --blue-light: #D6EAF8;
  --blue-pale:  #EBF5FB;
  --bg:        #F4F6F7;
  --surface:   #FFFFFF;
  --text:      #2D2D2D;
  --text-light: #5D6D7E;
  --border:    #D5D8DC;
  --success:   #1E8449;
  --success-bg:#D5F5E3;
  --warning:   #B7770D;
  --warning-bg:#FDEBD0;
  --danger:    #C0392B;
  --danger-bg: #FADBD8;
  --info:      #1A5276;
  --info-bg:   #D6EAF8;
  --sidebar-w: 240px;
  --header-h:  60px;
  --radius:    6px;
  --shadow:    0 1px 4px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.10);
  font-size: 15px;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ===== LOGIN ===== */
#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--blue-dark) 0%, var(--blue) 100%);
}

.login-card {
  background: var(--surface);
  border-radius: 12px;
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo .logo-icon {
  width: 56px;
  height: 56px;
  background: var(--blue-dark);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
  font-size: 28px;
  color: white;
}

.login-logo h1 {
  font-size: 20px;
  font-weight: 700;
  color: var(--blue-dark);
  line-height: 1.2;
}

.login-logo p {
  font-size: 13px;
  color: var(--text-light);
  margin-top: 4px;
}

.login-card .form-group { margin-bottom: 20px; }

.login-card label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-light);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.login-card input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 15px;
  transition: border-color 0.15s;
}

.login-card input:focus {
  outline: none;
  border-color: var(--blue);
}

.btn-login {
  width: 100%;
  padding: 13px;
  background: var(--blue-dark);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  margin-top: 8px;
}

.btn-login:hover { background: var(--blue); }

.login-error {
  background: var(--danger-bg);
  color: var(--danger);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13px;
  margin-top: 12px;
  display: none;
}

/* ===== APP LAYOUT ===== */
#app { display: none; }

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

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-w);
  background: var(--blue-dark);
  color: white;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  transition: transform 0.25s ease;
}

.sidebar-header {
  padding: 20px 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-brand .brand-icon {
  width: 36px;
  height: 36px;
  background: rgba(255,255,255,0.15);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.sidebar-brand .brand-text h2 {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
}

.sidebar-brand .brand-text span {
  font-size: 11px;
  opacity: 0.6;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  overflow-y: auto;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  opacity: 0.45;
  padding: 12px 8px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s;
  font-size: 14px;
  font-weight: 500;
  color: rgba(255,255,255,0.8);
  text-decoration: none;
  margin-bottom: 2px;
}

.nav-item:hover { background: rgba(255,255,255,0.1); color: white; }

.nav-item.active {
  background: rgba(255,255,255,0.15);
  color: white;
  font-weight: 600;
}

.nav-item .nav-icon { font-size: 16px; width: 20px; text-align: center; }

.sidebar-footer {
  padding: 14px 10px;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s;
}

.user-info:hover { background: rgba(255,255,255,0.08); }

.user-avatar {
  width: 32px;
  height: 32px;
  background: var(--blue);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.user-details { flex: 1; min-width: 0; }
.user-details .user-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-details .user-role { font-size: 11px; opacity: 0.55; }

.btn-logout {
  background: none;
  border: none;
  color: rgba(255,255,255,0.5);
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
  transition: color 0.15s;
}
.btn-logout:hover { color: white; }

/* ===== MAIN CONTENT ===== */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow);
}

.topbar-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--blue-dark);
  flex: 1;
}

.topbar-actions { display: flex; gap: 10px; align-items: center; }

.page-content {
  padding: 28px;
  flex: 1;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  white-space: nowrap;
  text-decoration: none;
}

.btn-primary   { background: var(--blue-dark); color: white; }
.btn-primary:hover { background: var(--blue); }
.btn-secondary { background: var(--surface); color: var(--text); border: 1.5px solid var(--border); }
.btn-secondary:hover { background: var(--bg); }
.btn-success   { background: var(--success); color: white; }
.btn-success:hover { filter: brightness(1.1); }
.btn-danger    { background: var(--danger); color: white; }
.btn-danger:hover { filter: brightness(1.1); }
.btn-outline   { background: transparent; color: var(--blue-dark); border: 1.5px solid var(--blue-dark); }
.btn-outline:hover { background: var(--blue-pale); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-xs { padding: 4px 10px; font-size: 12px; }
.btn-icon { padding: 8px; }

/* ===== CARDS ===== */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.card-header {
  padding: 18px 22px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--blue-dark);
}

.card-body { padding: 22px; }

/* ===== STAT CARDS ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 22px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 16px;
}

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.stat-icon.blue     { background: var(--blue-light); color: var(--blue-dark); }
.stat-icon.green    { background: var(--success-bg); color: var(--success); }
.stat-icon.orange   { background: var(--warning-bg); color: var(--warning); }
.stat-icon.purple   { background: #E8DAEF; color: #6C3483; }

.stat-info .stat-label { font-size: 12px; color: var(--text-light); font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; }
.stat-info .stat-value { font-size: 26px; font-weight: 800; color: var(--blue-dark); line-height: 1.2; }
.stat-info .stat-sub   { font-size: 12px; color: var(--text-light); margin-top: 2px; }

/* ===== TABLE ===== */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

table thead th {
  background: var(--blue-pale);
  color: var(--blue-dark);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  padding: 11px 14px;
  text-align: left;
  white-space: nowrap;
  border-bottom: 2px solid var(--blue-light);
}

table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}

table tbody tr:hover { background: var(--blue-pale); }
table tbody tr:last-child { border-bottom: none; }

table tbody td {
  padding: 11px 14px;
  vertical-align: middle;
  color: var(--text);
}

.row-overdue { background: #FEF9F9 !important; }
.row-today   { background: #FFFDF5 !important; }

/* ===== BADGES / STATUS ===== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.badge-nou      { background: var(--info-bg);    color: var(--info); }
.badge-lucru    { background: var(--warning-bg); color: var(--warning); }
.badge-aprobat  { background: var(--success-bg); color: var(--success); }
.badge-respins  { background: var(--danger-bg);  color: var(--danger); }
.badge-anulat   { background: #EAECEE;           color: #707B7C; }
.badge-overdue  { background: var(--danger-bg);  color: var(--danger); }
.badge-today    { background: var(--warning-bg); color: var(--warning); }

/* ===== FORMS ===== */
.form-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: 1fr 1fr;
}

.form-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-full   { grid-column: 1 / -1; }

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

.form-group label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.15s;
  font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--blue);
}

.form-group textarea { resize: vertical; min-height: 70px; }

/* ===== SEARCH BAR ===== */
.search-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 240px;
}

.search-input-wrap input {
  width: 100%;
  padding: 9px 12px 9px 36px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  background: var(--surface);
}

.search-input-wrap input:focus { outline: none; border-color: var(--blue); }

.search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  pointer-events: none;
}

.filter-select {
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  background: var(--surface);
  color: var(--text);
  min-width: 150px;
}

.filter-select:focus { outline: none; border-color: var(--blue); }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.modal-lg { max-width: 860px; }
.modal-xl { max-width: 1080px; }

.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--blue-dark);
}

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-light);
  line-height: 1;
  padding: 4px;
  transition: color 0.15s;
}

.modal-close:hover { color: var(--text); }

.modal-body {
  padding: 22px 24px;
  overflow-y: auto;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ===== TABS ===== */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.tab-btn {
  padding: 9px 16px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-light);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.15s;
}

.tab-btn:hover { color: var(--blue-dark); }
.tab-btn.active { color: var(--blue-dark); border-bottom-color: var(--blue-dark); }

/* ===== DASHBOARD SECTIONS ===== */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
  margin-top: 22px;
}

.remind-section { margin-bottom: 10px; }

.remind-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.remind-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 6px;
  cursor: pointer;
  transition: all 0.15s;
  background: var(--surface);
}

.remind-item:hover { border-color: var(--blue); background: var(--blue-pale); }

.remind-item.overdue { border-left: 3px solid var(--danger); }
.remind-item.today   { border-left: 3px solid var(--warning); }

.remind-info { flex: 1; min-width: 0; }
.remind-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.remind-meta { font-size: 12px; color: var(--text-light); margin-top: 2px; }
.remind-date { font-size: 12px; font-weight: 600; white-space: nowrap; }
.remind-date.overdue { color: var(--danger); }
.remind-date.today   { color: var(--warning); }

/* ===== PAGINATION ===== */
.pagination {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
  margin-top: 20px;
  flex-wrap: wrap;
}

.page-btn {
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.page-btn:hover { border-color: var(--blue); color: var(--blue); }
.page-btn.active { background: var(--blue-dark); border-color: var(--blue-dark); color: white; }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ===== ALERTS ===== */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

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

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-light);
}

.empty-state .empty-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.5; }
.empty-state h3 { font-size: 17px; font-weight: 700; margin-bottom: 8px; color: var(--text); }
.empty-state p  { font-size: 14px; }

/* ===== LOADER ===== */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--text-light);
  gap: 10px;
  font-size: 14px;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ===== MOBILE HAMBURGER ===== */
.mobile-header {
  display: none;
  background: var(--blue-dark);
  color: white;
  height: 54px;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 110;
}

.hamburger {
  background: none;
  border: none;
  color: white;
  font-size: 22px;
  cursor: pointer;
  padding: 6px;
}

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

/* ===== RAPOARTE ===== */
.chart-container {
  position: relative;
  height: 280px;
  margin-top: 10px;
}

.raport-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
  margin-top: 22px;
}

/* ===== IMPORT ===== */
.import-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s;
}

.import-zone:hover, .import-zone.drag-over { border-color: var(--blue); background: var(--blue-pale); }
.import-zone .import-icon { font-size: 40px; margin-bottom: 12px; color: var(--text-light); }
.import-zone h4 { font-size: 15px; font-weight: 700; margin-bottom: 6px; }
.import-zone p  { font-size: 13px; color: var(--text-light); }

.col-mapping-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 16px;
}

.preview-table-wrap {
  overflow: auto;
  max-height: 300px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-top: 16px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1100px) {
  :root { --sidebar-w: 200px; }
}

@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    width: 260px;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  .main-content { margin-left: 0; }
  .mobile-header { display: flex; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .raport-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid-3 { grid-template-columns: 1fr; }
  .page-content { padding: 16px; }
  .topbar { padding: 0 16px; }
}

@media (max-width: 600px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .modal { max-height: 100vh; border-radius: 10px 10px 0 0; align-self: flex-end; }
  .modal-overlay { align-items: flex-end; padding: 0; }
  table { min-width: 600px; }
  .topbar-actions .btn span { display: none; }
}

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

/* ===== UTILITIES ===== */
.hidden { display: none !important; }
.flex  { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-4  { margin-top: 16px; }
.mt-6  { margin-top: 24px; }
.fw-7  { font-weight: 700; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.text-light { color: var(--text-light); }
.text-right { text-align: right; }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }

/* Top notification bar */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background: var(--blue-dark);
  color: white;
  padding: 12px 18px;
  border-radius: var(--radius);
  font-size: 14px;
  box-shadow: var(--shadow-md);
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideUp 0.25s ease;
  min-width: 240px;
}

.toast.success { background: var(--success); }
.toast.error   { background: var(--danger); }
.toast.warning { background: #B7770D; }

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