/* =============================================
   COFFEE TALK — CSS Global
   ============================================= */

:root {
  --bg:        #0f0f13;
  --bg2:       #16161d;
  --bg3:       #1e1e28;
  --border:    rgba(255,255,255,0.08);
  --text-1:    #ffffff;
  --text-2:    #b0b0c8;
  --text-3:    #7070a0;
  --brown:     #c8956c;
  --brown-t:   rgba(200,149,108,0.15);
  --brown-d:   #a87550;
  --green:     #4caf82;
  --green-t:   rgba(76,175,130,0.15);
  --red:       #e05c5c;
  --red-t:     rgba(224,92,92,0.15);
  --amber:     #f0b429;
  --amber-t:   rgba(240,180,41,0.15);
  --blue:      #5b8dee;
  --blue-t:    rgba(91,141,238,0.15);
  --radius:    12px;
  --radius-sm: 8px;
  --shadow:    0 4px 24px rgba(0,0,0,0.4);
  --sidebar-w: 240px;
  --topbar-h:  64px;
}

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

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text-1);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* =============================================
   LOADING SCREEN
   ============================================= */
#loading-screen {
  position: fixed; inset: 0;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
  flex-direction: column; gap: 16px;
}
#loading-screen .spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--brown);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* =============================================
   LOGIN PAGE
   ============================================= */
.login-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: radial-gradient(ellipse at 20% 50%, rgba(200,149,108,0.08) 0%, transparent 60%),
              radial-gradient(ellipse at 80% 20%, rgba(91,141,238,0.06) 0%, transparent 50%),
              var(--bg);
}

.login-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 48px;
  width: 100%; max-width: 420px;
  box-shadow: var(--shadow);
}

.login-logo {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 32px;
}
.login-logo-icon {
  width: 44px; height: 44px;
  background: var(--brown-t);
  border: 1px solid rgba(200,149,108,0.3);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
}
.login-logo-text { font-size: 20px; font-weight: 700; }
.login-logo-text span { color: var(--brown); }

.login-title { font-size: 24px; font-weight: 700; margin-bottom: 6px; }
.login-sub { color: var(--text-2); font-size: 13px; margin-bottom: 28px; }

.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 12px; font-weight: 600;
  color: var(--text-2);
  margin-bottom: 6px;
  text-transform: uppercase; letter-spacing: 0.4px;
}
.form-input {
  width: 100%; height: 44px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 14px;
  color: var(--text-1);
  font-size: 14px;
  transition: border-color 0.15s;
  outline: none;
}
.form-input:focus { border-color: var(--brown); }
.form-input::placeholder { color: var(--text-3); }

.form-error {
  background: var(--red-t);
  border: 1px solid rgba(224,92,92,0.3);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px; color: var(--red);
  margin-bottom: 16px;
  display: none;
}
.form-error.show { display: block; }

.form-success {
  background: var(--green-t);
  border: 1px solid rgba(76,175,130,0.3);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px; color: var(--green);
  margin-bottom: 16px;
  display: none;
}
.form-success.show { display: block; }

.btn-primary {
  width: 100%; height: 46px;
  background: var(--brown);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600;
  transition: background 0.15s, opacity 0.15s;
}
.btn-primary:hover { background: var(--brown-d); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.login-footer {
  margin-top: 20px;
  text-align: center;
  font-size: 12px; color: var(--text-2);
}
.login-footer a { color: var(--brown); }

/* =============================================
   APP LAYOUT
   ============================================= */
.app-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
  grid-row: 1 / 3;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 20px 0;
  position: sticky; top: 0; height: 100vh;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 0 20px 24px;
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.sidebar-logo-icon {
  width: 36px; height: 36px;
  background: var(--brown-t);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.sidebar-logo-text { font-size: 16px; font-weight: 700; }
.sidebar-logo-text span { color: var(--brown); }

.nav-section {
  padding: 0 20px;
  font-size: 10px; font-weight: 700;
  color: var(--text-2);
  text-transform: uppercase; letter-spacing: 0.8px;
  margin: 16px 0 6px;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 20px;
  font-size: 14px; font-weight: 700;
  color: #ffffff !important;
  cursor: pointer;
  border-radius: 0;
  transition: all 0.15s;
  border-left: 3px solid transparent;
}
.nav-item:hover { color: #ffffff !important; background: rgba(255,255,255,0.06); }
.nav-item.active {
  color: var(--brown);
  background: var(--brown-t);
  border-left-color: var(--brown);
}
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; }

.sidebar-bottom {
  margin-top: auto;
  padding: 16px 20px 0;
  border-top: 1px solid var(--border);
}
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0;
}
.sidebar-avatar {
  width: 34px; height: 34px;
  background: var(--brown-t);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: var(--brown);
  flex-shrink: 0;
}
.sidebar-user-info { overflow: hidden; }
.sidebar-user-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 11px; color: var(--text-2); }
.btn-logout {
  width: 100%; height: 38px; margin-top: 8px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-2); font-size: 12px;
  transition: all 0.15s;
}
.btn-logout:hover { border-color: var(--red); color: var(--red); }

/* TOPBAR */
.topbar {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px;
  position: sticky; top: 0; z-index: 100;
}
.topbar-left { display: flex; flex-direction: column; }
.topbar-title { font-size: 18px; font-weight: 700; }
.topbar-sub { font-size: 12px; color: var(--text-2); }
.topbar-right { display: flex; align-items: center; gap: 12px; }

/* MAIN CONTENT */
.main-content {
  padding: 28px;
  overflow-y: auto;
}

/* =============================================
   CARDS
   ============================================= */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.card-title { font-size: 14px; font-weight: 600; }
.card-sub { font-size: 12px; color: var(--text-2); margin-top: 2px; }

/* =============================================
   KPI CARDS
   ============================================= */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.kpi-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.kpi-label { font-size: 11px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 8px; }
.kpi-value { font-size: 26px; font-weight: 700; }
.kpi-delta { font-size: 11px; color: var(--text-2); margin-top: 4px; }
.kpi-delta.pos { color: var(--green); }
.kpi-delta.neg { color: var(--red); }

/* =============================================
   TABELE
   ============================================= */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  font-size: 11px; font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase; letter-spacing: 0.4px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 13px;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.02); }

/* =============================================
   BUTOANE
   ============================================= */
.btn {
  height: 38px; padding: 0 16px;
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600;
  border: none; display: inline-flex;
  align-items: center; gap: 7px;
  transition: all 0.15s;
}
.btn-sm { height: 30px; padding: 0 12px; font-size: 12px; }
.btn-brown { background: var(--brown); color: #fff; }
.btn-brown:hover { background: var(--brown-d); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text-1); }
.btn-outline:hover { border-color: var(--brown); color: var(--brown); }
.btn-danger { background: var(--red-t); color: var(--red); border: 1px solid rgba(224,92,92,0.3); }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-success { background: var(--green-t); color: var(--green); border: 1px solid rgba(76,175,130,0.3); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* =============================================
   BADGE-URI
   ============================================= */
.badge {
  display: inline-flex; align-items: center;
  height: 22px; padding: 0 8px;
  border-radius: 20px;
  font-size: 11px; font-weight: 600;
}
.badge-green { background: var(--green-t); color: var(--green); }
.badge-red { background: var(--red-t); color: var(--red); }
.badge-amber { background: var(--amber-t); color: var(--amber); }
.badge-blue { background: var(--blue-t); color: var(--blue); }
.badge-brown { background: var(--brown-t); color: var(--brown); }

/* =============================================
   MODAL
   ============================================= */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  padding: 20px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s;
}
.modal-overlay.show { opacity: 1; pointer-events: all; }
.modal {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 100%; max-width: 520px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow);
  transform: translateY(10px);
  transition: transform 0.2s;
}
.modal-overlay.show .modal { transform: translateY(0); }
.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 16px; font-weight: 700; }
.modal-close {
  width: 30px; height: 30px;
  background: var(--bg3); border: none;
  border-radius: var(--radius-sm);
  color: var(--text-2); font-size: 18px;
  display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { color: var(--text-1); }
.modal-body { padding: 20px 24px; }
.modal-footer {
  padding: 16px 24px 20px;
  border-top: 1px solid var(--border);
  display: flex; gap: 10px; justify-content: flex-end;
}

/* =============================================
   TOAST
   ============================================= */
#toast-container {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 9999;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 13px;
  box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 10px;
  animation: slideIn 0.2s ease;
  min-width: 260px;
}
.toast.success { border-color: rgba(76,175,130,0.4); }
.toast.error { border-color: rgba(224,92,92,0.4); }
.toast-icon { font-size: 16px; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* =============================================
   UTILITARE
   ============================================= */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.text-muted { color: var(--text-2); }
.text-sm { font-size: 12px; }
.text-right { text-align: right; }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-amber { color: var(--amber); }
.text-brown { color: var(--brown); }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.empty-state {
  text-align: center; padding: 48px 20px;
  color: var(--text-2); font-size: 13px;
}
.empty-state-icon { font-size: 36px; margin-bottom: 12px; }

/* Separator */
.divider { height: 1px; background: var(--border); margin: 20px 0; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }
