/* Culori, fonturi si tema: vezi config/theme.css */

/* ============================================================
   Reset + Base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

html {
  font-family: var(--font-family);
  font-size: var(--font-size);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  padding: 0;
  background: var(--bg-base);
  color: var(--text);
  display: flex;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { opacity: 0.85; }

h1, h2, h3, h4, h5, h6 { margin: 0 0 0.5em; font-weight: 600; color: var(--text); line-height: 1.3; }
p { margin: 0 0 0.75em; }
strong { font-weight: 600; }

/* ============================================================
   App Shell
   ============================================================ */
.app-shell { display: flex; width: 100%; min-height: 100vh; }

/* ============================================================
   Sidebar
   ============================================================ */
.sidebar {
  width: 260px;
  min-height: 100vh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 1.071rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
  letter-spacing: -0.01em;
}

.sidebar-logo .dot {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.theme-toggle {
  margin-left: auto;
  padding: 4px 8px;
  font-size: 0.929rem;
  cursor: pointer;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 6px;
  flex-shrink: 0;
  line-height: 1;
  font-family: inherit;
  transition: color 0.12s, border-color 0.12s;
}

.theme-toggle:hover { color: var(--text); border-color: var(--text-muted); }

.sidebar-nav { padding: 10px; flex: 1; }

.nav-section {
  display: block;
  font-size: 0.714rem;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--text-muted);
  opacity: 0.7;
  padding: 14px 10px 4px;
  pointer-events: none;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.964rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: none;
  margin-bottom: 1px;
  transition: background 0.12s, color 0.12s;
}

.nav-item:hover { background: var(--bg-elevated); color: var(--text); opacity: 1; }
.nav-item.active { background: var(--accent-bg); color: var(--accent); }
.nav-item i { flex-shrink: 0; font-size: 1rem; }

/* ============================================================
   Sidebar footer
   ============================================================ */
.sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.929rem;
}

.avatar-circle {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent-bg);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.857rem;
  font-weight: 700;
  flex-shrink: 0;
}

.sidebar-username {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-weight: 500;
}

.logout-btn {
  color: var(--text-muted);
  font-size: 1.214rem;
  text-decoration: none;
  display: flex;
  align-items: center;
  transition: color 0.12s;
}

.logout-btn:hover { color: var(--text); opacity: 1; }

/* ============================================================
   Main Content
   ============================================================ */
.main-content {
  flex: 1;
  padding: 28px 32px;
  overflow-y: auto;
  min-width: 0;
  background: var(--bg-base);
}

/* ============================================================
   Page Header
   ============================================================ */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
}

.page-header-left h2 { margin: 0 0 4px; font-size: 1.571rem; font-weight: 700; }
.page-header-left p  { margin: 0; font-size: 0.929rem; color: var(--text-muted); }
.page-header > h2    { margin: 0; font-size: 1.571rem; font-weight: 700; }

.header-actions { display: flex; gap: 8px; padding-top: 2px; flex-shrink: 0; }

/* ============================================================
   Buttons
   ============================================================ */
button,
[role="button"],
input[type="submit"],
a[role="button"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 0.929rem;
  font-weight: 500;
  font-family: inherit;
  border-radius: 7px;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.12s, background 0.12s;
  border: none;
  background: var(--accent);
  color: #0a1f19;
  white-space: nowrap;
  line-height: 1.4;
}

button:hover,
[role="button"]:hover,
input[type="submit"]:hover,
a[role="button"]:hover { opacity: 0.85; }

/* Outline / secondary */
button.outline,
[role="button"].outline,
a.outline,
a[role="button"].outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

button.outline:hover,
[role="button"].outline:hover,
a.outline:hover,
a[role="button"].outline:hover {
  background: var(--bg-elevated);
  opacity: 1;
}

button.outline.secondary,
[role="button"].outline.secondary,
a.outline.secondary,
a[role="button"].outline.secondary {
  color: var(--text-muted);
}

/* Danger / contrast */
button.contrast,
[role="button"].contrast,
a.contrast {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--danger);
}

button.contrast:hover { background: var(--danger-bg); opacity: 1; }

.small { font-size: 0.857rem !important; padding: 4px 10px !important; }

/* ============================================================
   Form Elements
   ============================================================ */
label {
  display: block;
  font-size: 0.929rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 14px;
}

label > input,
label > select,
label > textarea { display: block; width: 100%; margin-top: 5px; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
select,
textarea {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.929rem;
  padding: 9px 12px;
  width: 100%;
  box-sizing: border-box;
  transition: border-color 0.15s;
  outline: none;
  -webkit-appearance: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a8a8e' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

textarea { resize: vertical; min-height: 80px; }

/* Form card container (article wrapper used in forms) */
article {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px 28px;
}

/* ============================================================
   KPI Row
   ============================================================ */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 22px;
}

.kpi-label {
  font-size: 0.857rem;
  color: var(--text-muted);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}

.kpi-value {
  font-size: 2.143rem;
  font-weight: 700;
  margin: 0;
  line-height: 1.1;
  color: var(--text);
  letter-spacing: -0.02em;
}

.kpi-sub { font-size: 0.786rem; color: var(--text-muted); margin-top: 6px; }

/* ============================================================
   Amount colors
   ============================================================ */
.amount-positive { color: var(--accent) !important; }
.amount-negative { color: var(--danger) !important; }
.amount-zero     { opacity: 0.4; }
.negative        { color: var(--danger); }
.account-amount-sub { font-size: 0.75rem; opacity: 0.55; font-weight: 400; }

/* ============================================================
   Entity Grid
   ============================================================ */
.entity-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.entity-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

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

.entity-card-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.entity-badge {
  font-size: 0.714rem;
  padding: 3px 8px;
  border-radius: 99px;
  background: var(--accent-dim);
  color: var(--accent);
  font-weight: 600;
}

.entity-total { font-size: 1rem; font-weight: 700; }

/* ============================================================
   Account Rows
   ============================================================ */
.account-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 18px;
  border-bottom: 1px solid var(--border);
  transition: background 0.10s;
}

.account-row:last-of-type { border-bottom: none; }
.account-row:hover { background: var(--bg-elevated); }

.account-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1.071rem;
}

.icon-banca   { background: var(--blue-bg);   color: var(--blue); }
.icon-numerar { background: var(--green-bg);  color: var(--green); }
.icon-privat  { background: var(--purple-bg); color: var(--purple); }

.account-info { flex: 1; min-width: 0; }
.account-name { font-size: 0.929rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.account-type { font-size: 0.786rem; color: var(--text-muted); }
.account-amount { font-size: 0.929rem; font-weight: 600; white-space: nowrap; color: var(--text); }

/* ============================================================
   Entity Card Footer
   ============================================================ */
.entity-card-footer {
  display: flex;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
}

.entity-card-footer a,
.entity-card-footer button {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 0;
  font-size: 0.857rem;
  border-radius: 6px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
}

.entity-card-footer a:hover,
.entity-card-footer button:hover {
  background: var(--bg-elevated);
  color: var(--text);
  opacity: 1;
}

/* ============================================================
   Table Card Container
   ============================================================ */
.table-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 1.5rem;
  background: var(--bg-card);
}

.table-card table { margin: 0; }

/* ============================================================
   Tables
   ============================================================ */
table {
  width: 100%;
  font-size: 0.929rem;
  border-collapse: collapse;
  background: var(--bg-card);
  color: var(--text);
}

thead tr { background: var(--bg-elevated); }

th {
  font-size: 0.786rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 10px 14px;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text);
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--bg-elevated); }

tfoot td {
  padding: 10px 14px;
  border-top: 2px solid var(--border);
  background: var(--bg-elevated);
  font-weight: 700;
  border-bottom: none;
}

/* ============================================================
   Badges
   ============================================================ */
.badge {
  font-size: 0.714rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: inline-block;
  background: var(--bg-elevated);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.badge-numerar { background: rgba(97, 196, 89, 0.12); color: var(--green); border-color: rgba(97, 196, 89, 0.25); }
.badge-banca   { background: rgba(133, 183, 235, 0.12); color: var(--blue); border-color: rgba(133, 183, 235, 0.25); }
.badge-privat  { background: rgba(192, 132, 252, 0.12); color: var(--purple); border-color: rgba(192, 132, 252, 0.25); }

/* ============================================================
   Detail Meta Strip
   ============================================================ */
.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
  margin-bottom: 1.5rem;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.929rem;
  color: var(--text);
}

.detail-meta span { white-space: nowrap; }

/* ============================================================
   Rate Summary & Form
   ============================================================ */
.rate-summary {
  display: flex;
  gap: 2rem;
  margin-bottom: 1.25rem;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  color: var(--text);
}

.rate-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem 1.25rem;
  margin-bottom: 0.75rem;
}

/* ============================================================
   Filter Form
   ============================================================ */
.filter-form {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.filter-form input,
.filter-form select { width: auto; margin: 0; }

.filter-form button,
.filter-form a { margin: 0; }

.filter-radio-group {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: .75rem;
  align-items: center;
  align-self: center;
}
.filter-radio-group label {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: .3rem;
  cursor: pointer;
  font-size: .875rem;
  white-space: nowrap;
  font-weight: normal;
  margin: 0;
  padding: 0;
}
.filter-radio-group input[type="radio"] { width: auto; margin: 0; cursor: pointer; }

/* ============================================================
   Misc
   ============================================================ */
.actions { white-space: nowrap; display: flex; gap: 4px; align-items: center; }

/* ============================================================
   Login Page
   ============================================================ */
body.login-page {
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
  flex-direction: column;
}

.login-card {
  width: 100%;
  max-width: 380px;
  padding: 0 1rem;
}

.login-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 32px 28px 28px;
}

.login-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 14px;
  font-size: 2.5rem;
  color: var(--accent);
}

.login-title {
  text-align: center;
  font-size: 1.286rem;
  font-weight: 700;
  margin-bottom: 26px;
  color: var(--text);
  letter-spacing: -0.01em;
}

.login-box button[type="submit"] {
  width: 100%;
  padding: 10px;
  font-size: 1rem;
  font-weight: 600;
  margin-top: 4px;
}

.error-msg { color: var(--danger); margin-bottom: 1rem; font-size: 0.929rem; }

/* ── Stare badges ──────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.786rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.badge-neachitat { background: rgba(244,67,54,.15); color: #f44336; }
.badge-partial   { background: rgba(255,152,0,.15);  color: #ff9800; }
.badge-achitat   { background: rgba(76,175,80,.15);  color: #4caf50; }

/* ============================================================
   Mobile components (hidden on desktop)
   ============================================================ */
.hamburger-btn {
  display: none;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 7px;
  padding: 6px 10px;
  font-size: 1.286rem;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

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

.mobile-topbar {
  display: none;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.mobile-topbar-title {
  font-size: 1.071rem;
  font-weight: 700;
  color: var(--text);
}

/* ============================================================
   Responsive — ≤768px
   ============================================================ */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }

  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }

  .mobile-topbar { display: flex; }
  .hamburger-btn { display: flex; }

  .main-content { padding: 16px; }

  .page-header { flex-direction: column; gap: 12px; margin-bottom: 16px; }
  .header-actions { flex-wrap: wrap; }

  .kpi-row { grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
  .kpi-value { font-size: 1.571rem; }

  .entity-grid { grid-template-columns: 1fr; gap: 12px; }

  .table-card { overflow-x: auto; }

  .rate-form-grid { grid-template-columns: 1fr; }
  .rate-summary { flex-direction: column; gap: 0.5rem; }

  .filter-form input,
  .filter-form select { width: 100%; }

  .detail-meta span { white-space: normal; }
}

/* ============================================================
   Entity row color coding (configurable via config/theme.css)
   ============================================================ */
tr.row-entity-1 td { background: var(--entity-bg-1); }
tr.row-entity-2 td { background: var(--entity-bg-2); }

/* ============================================================
   Responsive — ≤480px
   ============================================================ */
@media (max-width: 480px) {
  .kpi-row { grid-template-columns: 1fr; }
  .kpi-card { padding: 14px 16px; }
  article { padding: 16px; }
}
