/* Molia Admin — Sora, oq / #111a2f / #7f0000 */
@import url('https://fonts.googleapis.com/css2?family=Sora:wght@300;400;500;600;700&display=swap');

:root {
  --bg: #ffffff;
  --text: #111a2f;
  --accent: #7f0000;
  --accent-hover: #9a0000;
  --border: #e5e7eb;
  --muted: #6b7280;
  --sidebar-bg: #f9fafb;
  --card-shadow: 0 1px 3px rgba(17, 26, 47, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Sora', sans-serif;
  font-weight: 400;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}

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

/* Sidebar */
.sidebar {
  width: 72px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 0;
  flex-shrink: 0;
}

.sidebar-logo {
  width: 40px;
  height: auto;
  margin-bottom: 24px;
  display: block;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-nav a {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.sidebar-nav a:hover {
  background: var(--border);
  color: var(--text);
}

.sidebar-nav a.active {
  background: rgba(127, 0, 0, 0.08);
  color: var(--accent);
}

.sidebar-nav svg {
  width: 22px;
  height: 22px;
}

/* Main */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Header */
.header {
  height: 64px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: var(--bg);
}

.header-nav {
  display: flex;
  gap: 8px;
}

.header-nav a {
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}

.header-nav a:hover {
  background: var(--sidebar-bg);
}

.header-nav a.active {
  background: rgba(127, 0, 0, 0.08);
  color: var(--accent);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-actions button {
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  border-radius: 10px;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-actions button:hover {
  background: var(--sidebar-bg);
  color: var(--text);
}

/* Content */
.content {
  flex: 1;
  padding: 24px;
  overflow-auto;
}

.welcome {
  margin-bottom: 24px;
}

.welcome h1 {
  font-size: 22px;
  font-weight: 600;
  margin: 0 0 4px 0;
  color: var(--text);
}

.welcome p {
  font-size: 14px;
  color: var(--muted);
  margin: 0;
}

/* Cards grid */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--card-shadow);
}

.card.accent {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.card.accent .card-label,
.card.accent .card-change {
  color: rgba(255, 255, 255, 0.85);
}

.card-label {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}

.card-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
}

.card.accent .card-value {
  color: #fff;
}

.card-change {
  font-size: 13px;
  margin-top: 8px;
}

.card-change.positive {
  color: var(--accent);
}

.card.accent .card-change.positive {
  color: rgba(255, 255, 255, 0.95);
}

.card-change.negative {
  color: var(--muted);
}

/* Table */
.table-wrap {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--card-shadow);
  overflow: hidden;
}

.table-wrap h2 {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

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

.table-wrap th {
  text-align: left;
  padding: 12px 20px;
  font-weight: 600;
  color: var(--text);
  background: var(--sidebar-bg);
  border-bottom: 1px solid var(--border);
}

.table-wrap td {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.table-wrap tr:last-child td {
  border-bottom: none;
}

.table-wrap tr:hover td {
  background: #fafafa;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
  vertical-align: middle;
}

.status-dot.ok {
  background: var(--accent);
}

.status-dot.pending {
  background: #f59e0b;
}

/* Login */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--sidebar-bg);
}

.login-box {
  width: 100%;
  max-width: 400px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  box-shadow: var(--card-shadow);
}

.login-box .logo-wrap {
  text-align: center;
  margin-bottom: 24px;
}

.login-box .logo-wrap img {
  max-width: 180px;
  height: auto;
}

.login-box h1 {
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 8px 0;
  text-align: center;
}

.login-box p {
  font-size: 14px;
  color: var(--muted);
  text-align: center;
  margin: 0 0 24px 0;
}

.login-box label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text);
}

.login-box input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  margin-bottom: 16px;
}

.login-box input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(127, 0, 0, 0.1);
}

.login-box button[type="submit"] {
  width: 100%;
  padding: 12px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.login-box button[type="submit"]:hover {
  background: var(--accent-hover);
}

.login-error {
  font-size: 13px;
  color: var(--accent);
  margin-bottom: 12px;
  display: none;
}

.login-error.show {
  display: block;
}

/* Loading / empty */
.loading, .empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
  font-size: 14px;
}

/* Toolbar */
.toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.search-input {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  min-width: 200px;
}

.filter-select {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
}

.filter-date {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
}

.filter-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
}

.filter-checkbox input {
  margin: 0;
}

.toolbar-hint {
  font-size: 13px;
  color: var(--muted);
  margin: -8px 0 16px 0;
}

.btn {
  padding: 10px 18px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.back-link {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--accent);
  text-decoration: none;
  font-size: 14px;
}

.back-link:hover {
  text-decoration: underline;
}

.detail-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.tab-btn {
  padding: 10px 16px;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.tab-btn:hover {
  color: var(--text);
}

.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* Billing tabs */
.billing-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 18px 0;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fbfbfc;
}

.billing-tab {
  -webkit-appearance: none;
  appearance: none;
  border: 1px solid #d9dee8;
  background: #ffffff;
  color: #293041;
  border-radius: 999px;
  padding: 9px 14px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(17, 26, 47, 0.04);
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.08s ease;
}

.billing-tab:hover {
  border-color: #bfc7d6;
  background: #f8fafc;
  color: #111a2f;
  box-shadow: 0 2px 8px rgba(17, 26, 47, 0.08);
}

.billing-tab:active {
  transform: translateY(1px);
}

.billing-tab:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(127, 0, 0, 0.18);
}

.billing-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
  box-shadow: 0 6px 16px rgba(127, 0, 0, 0.25);
}

.monetization-section .welcome {
  margin-bottom: 14px;
}

.pagination {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 12px 20px;
  font-size: 14px;
  color: var(--muted);
}

.pagination button {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  cursor: pointer;
  font-family: inherit;
}

.pagination button:hover:not(:disabled) {
  background: var(--sidebar-bg);
}

.pagination button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.panel-section .table-wrap {
  margin-top: 0;
}

.table-wrap table tbody tr.clickable {
  cursor: pointer;
}

.table-wrap table tbody tr.clickable:hover td {
  background: rgba(127, 0, 0, 0.06);
}

.detail-block {
  margin-bottom: 24px;
}

.detail-block h3 {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 12px 0;
  color: var(--text);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.detail-kv {
  font-size: 13px;
}

.detail-kv strong {
  display: block;
  color: var(--muted);
  margin-bottom: 2px;
}

/* Stats blocks */
.stats-blocks {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.stats-block {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--card-shadow);
}

.stats-block h3 {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 12px 0;
  color: var(--text);
}

.stats-content {
  min-height: 40px;
}

.stats-hint {
  font-size: 13px;
  color: #666;
  margin: -4px 0 12px 0;
}

/* Aktivlik (soatlik): blok doim bir xil o‘lchovda, ko‘p foydalanuvchida ham sig‘adi */
#activity-stats-wrap {
  max-height: 280px;
  overflow-y: auto;
  overflow-x: auto;
}

.activity-bars {
  display: flex;
  gap: 4px;
  align-items: flex-end;
  min-height: 100px;
}

/* 2 qator: har qatorda 12 soat (0–11, 12–23) */
.activity-bars-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  margin-bottom: 12px;
}
.activity-bars-row:last-of-type {
  margin-bottom: 0;
}

.activity-bar-item {
  flex: 1;
  min-width: 0;
  max-width: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.activity-hour {
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
}

.activity-bar {
  height: 60px;
  min-height: 4px;
  background: var(--accent);
  border-radius: 4px 4px 0 0;
  opacity: 0.8;
}

.activity-count {
  font-size: 11px;
  color: var(--muted);
  min-width: 2em;
  text-align: center;
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

/* ——— Post yuborish (broadcast) ——— */
.broadcast-form .stats-block {
  margin-bottom: 20px;
}
.broadcast-target-extra {
  margin-top: 12px;
}
.broadcast-target-extra.toolbar {
  flex-wrap: wrap;
  gap: 8px;
}
.broadcast-content select {
  margin-bottom: 12px;
}
.broadcast-media {
  margin-bottom: 12px;
}
.broadcast-media .search-input {
  display: block;
  margin-bottom: 8px;
}
.broadcast-file-label {
  font-size: 13px;
  color: var(--muted);
}
.broadcast-file-label input[type="file"] {
  margin-left: 8px;
}
.format-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 8px;
}
.format-btn {
  padding: 6px 10px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
}
.format-btn:hover {
  background: var(--border);
}
.format-btn[data-tag="b"] { font-weight: 700; }
.format-btn[data-tag="i"] { font-style: italic; }
.format-btn[data-tag="u"] { text-decoration: underline; }
.broadcast-text-wrap textarea {
  width: 100%;
  max-width: 600px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
}
.broadcast-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 16px;
}
.broadcast-summary {
  min-width: 200px;
  font-weight: 500;
}
.broadcast-result {
  font-size: 13px;
}

.broadcast-health-warn {
  margin-top: 12px;
  padding: 12px 16px;
  background: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: 8px;
  font-size: 13px;
  color: #92400e;
}
.broadcast-health-warn code {
  background: rgba(0,0,0,0.06);
  padding: 2px 6px;
  border-radius: 4px;
}

.broadcast-recipients-section {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.broadcast-recipients-title {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 12px 0;
  color: var(--text);
}
.broadcast-recipients-wrap {
  min-height: 80px;
  max-height: 420px;
  overflow-y: auto;
}
.broadcast-recipients-wrap .table-wrap table {
  font-size: 13px;
}
.btn-small {
  padding: 5px 10px;
  font-size: 12px;
}
.btn-secondary {
  background: var(--sidebar-bg);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background: var(--border);
}
.btn-sm {
  padding: 4px 8px;
  font-size: 12px;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal-content {
  background: var(--bg);
  border-radius: 12px;
  padding: 24px;
  max-width: 480px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-content h3 { margin: 0 0 16px 0; }
.modal-content label { display: block; margin: 12px 0 4px 0; font-size: 14px; color: var(--muted); }
.modal-content input[type="text"],
.modal-content input[type="url"],
.modal-content input[type="number"],
.modal-content input[type="file"] {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.modal-actions { margin-top: 20px; display: flex; gap: 12px; }
.stats-row { display: flex; gap: 24px; margin-bottom: 12px; }
