/* ============================================================
   assets/css/app.css  –  Globalne style OSP
   ============================================================ */

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #1a1c21; }
::-webkit-scrollbar-thumb { background: #4b4f5b; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #e52314; }

/* Smooth transitions */
*, *::before, *::after { box-sizing: border-box; }
body { transition: background-color 0.2s; }

/* ── Custom badge styles ─────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.badge-fire    { background: rgba(229,35,20,0.15); color: #f83b2f; border: 1px solid rgba(229,35,20,0.3); }
.badge-green   { background: rgba(34,197,94,0.12);  color: #22c55e; border: 1px solid rgba(34,197,94,0.3); }
.badge-yellow  { background: rgba(234,179,8,0.12);  color: #eab308; border: 1px solid rgba(234,179,8,0.3); }
.badge-gray    { background: rgba(100,116,139,0.15); color: #94a3b8; border: 1px solid rgba(100,116,139,0.2); }
.badge-blue    { background: rgba(59,130,246,0.12);  color: #60a5fa; border: 1px solid rgba(59,130,246,0.3); }

/* ── Nav item ────────────────────────────────────────────── */
.nav-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.75rem;
  border-radius: 0.6rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #9ea1ad;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  user-select: none;
}
.nav-item:hover { background: rgba(255,255,255,0.05); color: #fff; }
.nav-item.active { background: rgba(229,35,20,0.18); color: #f83b2f; }
.nav-item.active svg { color: #f83b2f; }
.nav-section-title {
  padding: 0.5rem 0.75rem 0.25rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #4b4f5b;
  margin-top: 0.75rem;
}

/* ── Card ────────────────────────────────────────────────── */
.card {
  background: #33363e;
  border: 1px solid #3e4149;
  border-radius: 1rem;
  padding: 1.5rem;
}
@media (max-width: 640px) {
  .card { padding: 1rem; border-radius: 0.75rem; }
  #app { padding: 1rem !important; }
}
.card-sm {
  background: #33363e;
  border: 1px solid #3e4149;
  border-radius: 0.75rem;
  padding: 1rem;
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1.1rem;
  border-radius: 0.6rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  outline: none;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: #e52314; color: #fff; }
.btn-primary:hover:not(:disabled) { background: #c0170b; }
.btn-secondary { background: #3e4149; color: #e2e3e6; }
.btn-secondary:hover:not(:disabled) { background: #4b4f5b; }
.btn-ghost { background: transparent; color: #9ea1ad; }
.btn-ghost:hover:not(:disabled) { background: rgba(255,255,255,0.06); color: #fff; }
.btn-danger { background: rgba(239,68,68,0.12); color: #f87171; border: 1px solid rgba(239,68,68,0.25); }
.btn-danger:hover:not(:disabled) { background: rgba(239,68,68,0.22); }
.btn-success { background: rgba(34,197,94,0.12); color: #22c55e; border: 1px solid rgba(34,197,94,0.25); }
.btn-success:hover:not(:disabled) { background: rgba(34,197,94,0.22); }
.btn-sm { padding: 0.3rem 0.75rem; font-size: 0.8rem; }
.btn-xs { padding: 0.2rem 0.55rem; font-size: 0.72rem; }

/* ── Form inputs ─────────────────────────────────────────── */
.input {
  width: 100%;
  background: #1a1c21;
  border: 1px solid #3e4149;
  color: #e2e3e6;
  border-radius: 0.6rem;
  padding: 0.6rem 0.85rem;
  font-size: 0.875rem;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}
.input:focus { border-color: #e52314; box-shadow: 0 0 0 3px rgba(229,35,20,0.15); }
.input::placeholder { color: #4b4f5b; }
.input-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #9ea1ad;
  margin-bottom: 0.35rem;
  letter-spacing: 0.01em;
}
select.input option { background: #1a1c21; }

/* ── Table ───────────────────────────────────────────────── */
.osp-table { width: 100%; border-collapse: collapse; }
.osp-table thead tr { border-bottom: 1px solid #3e4149; }
.osp-table thead th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #5e6270;
}
.osp-table tbody tr { border-bottom: 1px solid #2d2f36; transition: background 0.1s; }
.osp-table tbody tr:last-child { border-bottom: none; }
.osp-table tbody tr:hover { background: rgba(255,255,255,0.03); }
.osp-table tbody td { padding: 0.85rem 1rem; font-size: 0.875rem; color: #c4c6cd; }

/* Table Container (Responsive) */
.table-container {
  width: 100%;
  margin-bottom: 1rem;
}

/* Card-based Tables for Mobile */
@media (max-width: 768px) {
  .osp-table, .osp-table thead, .osp-table tbody, .osp-table th, .osp-table td, .osp-table tr { 
    display: block; 
  }
  
  .osp-table thead tr { 
    position: absolute;
    top: -9999px;
    left: -9999px;
  }
  
  .osp-table tbody tr {
    border: 1px solid #3e4149;
    border-radius: 0.75rem;
    margin-bottom: 1rem;
    background: rgba(255,255,255,0.02);
    padding: 0.5rem;
  }
  
  .osp-table tbody td {
    border: none;
    position: relative;
    padding-left: 50% !important;
    text-align: right;
    min-height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    border-bottom: 1px solid rgba(62, 65, 73, 0.4);
  }
  
  .osp-table tbody td:last-child {
    border-bottom: none;
    padding-top: 1rem;
    justify-content: center;
    padding-left: 1rem !important;
  }

  .osp-table tbody td::before {
    content: attr(data-label);
    position: absolute;
    left: 1rem;
    width: 45%;
    padding-right: 10px;
    white-space: nowrap;
    text-align: left;
    font-weight: 700;
    font-size: 0.7rem;
    text-transform: uppercase;
    color: #5e6270;
    letter-spacing: 0.05em;
  }
  
  /* Special handling for cells without labels (like full-row actions) */
  .osp-table tbody td[data-label=""]::before,
  .osp-table tbody td:not([data-label])::before {
    display: none;
  }
  
  .osp-table tbody td[data-label=""] ,
  .osp-table tbody td:not([data-label]) {
    padding-left: 1rem !important;
    text-align: center;
    justify-content: center;
  }
}

/* ── Stat card ───────────────────────────────────────────── */
.stat-card {
  background: #33363e;
  border: 1px solid #3e4149;
  border-radius: 1rem;
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.stat-card .stat-value { font-size: 2rem; font-weight: 800; color: #fff; line-height: 1; }
.stat-card .stat-label { font-size: 0.8rem; color: #5e6270; font-weight: 500; }
.stat-card .stat-icon {
  width: 2.5rem; height: 2.5rem;
  border-radius: 0.6rem;
  display: flex; align-items: center; justify-content: center;
}

/* ── Animate in ──────────────────────────────────────────── */
@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.animate-in { animation: fadeSlideIn 0.2s ease both; }

/* ── Toast ───────────────────────────────────────────────── */
.toast {
  pointer-events: all;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 1.1rem;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  min-width: 280px;
  max-width: 380px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  animation: fadeSlideIn 0.2s ease both;
  backdrop-filter: blur(8px);
}
.toast-success { background: rgba(22,163,74,0.9);  color: #fff; }
.toast-error   { background: rgba(220,38,38,0.9);  color: #fff; }
.toast-info    { background: rgba(59,130,246,0.9);  color: #fff; }
.toast-warning { background: rgba(234,179,8,0.9);   color: #fff; }

/* Responsive adjustments for Modal */
@media (max-width: 640px) {
  #modal-box {
    margin: 1rem auto;
    max-height: calc(100vh - 2rem);
    width: 100%;
  }
}

/* ── Checkbox custom ─────────────────────────────────────── */
.osp-checkbox {
  width: 1.1rem; height: 1.1rem;
  accent-color: #e52314;
  cursor: pointer;
  flex-shrink: 0;
}

/* ── Avatar initials ─────────────────────────────────────── */
.avatar {
  width: 2.25rem; height: 2.25rem;
  border-radius: 50%;
  background: linear-gradient(135deg, #e52314, #9f170e);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.avatar-lg {
  width: 3.5rem; height: 3.5rem;
  font-size: 1.1rem;
}

/* ── Empty state ─────────────────────────────────────────── */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  gap: 1rem; padding: 3rem 1rem; color: #4b4f5b;
  text-align: center;
}
.empty-state svg { width: 3rem; height: 3rem; opacity: 0.4; }
.empty-state p { font-size: 0.875rem; }

/* ── Spinner ─────────────────────────────────────────────── */
.spinner {
  width: 1.5rem; height: 1.5rem;
  border: 2px solid rgba(255,255,255,0.15);
  border-top-color: #e52314;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Tab bar ───────────────────────────────────────────────── */
.tab-bar { 
  display: flex; 
  gap: 0.25rem; 
  border-bottom: 1px solid #3e4149; 
  margin-bottom: 1.5rem; 
  overflow-x: auto;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
}
.tab-bar::-webkit-scrollbar { display: none; }
.tab-bar { -ms-overflow-style: none; scrollbar-width: none; }

.tab-btn {
  padding: 0.65rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #5e6270;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
  white-space: nowrap;
}
.tab-btn:hover { color: #c4c6cd; }
.tab-btn.active { color: #f83b2f; border-bottom-color: #f83b2f; }

/* ── Progress bar ────────────────────────────────────────── */
.progress-bar { background: #2d2f36; border-radius: 9999px; height: 6px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 9999px; background: linear-gradient(90deg, #e52314, #f83b2f); transition: width 0.5s ease; }
