/* ============================================
   Generate NotifCenter — App Styles
   ============================================ */

:root {
  --sidebar-bg: #111112;
  --teal: #56948D;
  --teal-dark: #3d7069;
  --teal-light: #7ab5ae;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #1a202c;
  --text-muted: #718096;
  --red: #e53e3e;
  --amber: #d97706;
  --green: #38a169;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --radius: 8px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

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

html, body { height: 100%; font-family: var(--font); background: var(--bg); color: var(--text); font-size: 14px; }

a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============================================
   Layout
   ============================================ */

#app { display: flex; height: 100vh; overflow: hidden; }

/* Sidebar */
#sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 24px 20px 16px;
  font-size: 22px;
  font-weight: 700;
  color: var(--teal);
  letter-spacing: -0.5px;
}

.sidebar-brand span { color: #fff; font-weight: 300; font-size: 13px; display: block; margin-top: 2px; }

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

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: #a0aec0;
  font-size: 13.5px;
  transition: color .15s, background .15s;
  border-radius: 0;
  text-decoration: none;
}

.sidebar-nav a:hover { color: #fff; background: rgba(255,255,255,.05); }
.sidebar-nav a.active { color: #fff; background: rgba(86,148,141,.2); border-right: 3px solid var(--teal); }
.sidebar-nav a svg { width: 16px; height: 16px; flex-shrink: 0; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,.08);
}

.sidebar-footer button {
  width: 100%;
  padding: 8px;
  background: transparent;
  border: 1px solid rgba(255,255,255,.15);
  color: #a0aec0;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  transition: all .15s;
}

.sidebar-footer button:hover { color: #fff; border-color: rgba(255,255,255,.3); }

/* Main content */
#main { flex: 1; overflow-y: auto; display: flex; flex-direction: column; }

.main-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 16px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.main-header h1 { font-size: 18px; font-weight: 600; }

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

/* ============================================
   Cards / Stat Cards
   ============================================ */

.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }

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

.stat-card .label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 8px; }
.stat-card .value { font-size: 32px; font-weight: 700; color: var(--text); }
.stat-card .value.teal { color: var(--teal); }

/* ============================================
   Tables
   ============================================ */

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  margin-bottom: 20px;
}

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

.card-header h2 { font-size: 15px; font-weight: 600; }

.card-body { padding: 20px; }

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

table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; text-align: left; font-size: 13px; }
th { font-weight: 600; color: var(--text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: .5px; border-bottom: 2px solid var(--border); }
tbody tr { border-bottom: 1px solid var(--border); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg); }

/* ============================================
   Badges
   ============================================ */

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .3px;
}

.badge-hosting { background: #e8f5e9; color: #2e7d32; }
.badge-domain { background: #e3f2fd; color: #1565c0; }
.badge-maintenance { background: #fff3e0; color: #e65100; }
.badge-annual { background: #f3e5f5; color: #6a1b9a; }
.badge-monthly { background: #fce4ec; color: #880e4f; }
.badge-draft { background: #f5f5f5; color: #616161; }
.badge-sent { background: #e3f2fd; color: #1565c0; }
.badge-accepted { background: #e8f5e9; color: #2e7d32; }
.badge-rejected { background: #ffebee; color: #c62828; }
.badge-website { background: #e8eaf6; color: #283593; }
.badge-eshop { background: #fce4ec; color: #880e4f; }
.badge-client { background: #e8f5e9; color: #2e7d32; }
.badge-admin { background: #e3f2fd; color: #1565c0; }
.badge-success { background: #e8f5e9; color: #2e7d32; }
.badge-failed { background: #ffebee; color: #c62828; }
.badge-scheduled { background: #e3f2fd; color: #1565c0; }
.badge-sending { background: #fff8e1; color: #f57f17; }

/* Broadcast message type badges */
.badge-type-announcement { background: #e0f2f1; color: #00695c; }
.badge-type-maintenance { background: #fff3e0; color: #e65100; }
.badge-type-pricing { background: #f3e5f5; color: #6a1b9a; }
.badge-type-security { background: #ffebee; color: #c62828; }
.badge-type-other { background: #f5f5f5; color: #616161; }

/* Broadcast status badges */
.badge-broadcast-draft { background: #f5f5f5; color: #616161; }
.badge-broadcast-scheduled { background: #e3f2fd; color: #1565c0; }
.badge-broadcast-sending { background: #fff8e1; color: #f57f17; }
.badge-broadcast-sent { background: #e8f5e9; color: #2e7d32; }
.badge-broadcast-failed { background: #ffebee; color: #c62828; }

/* Client tag chips */
.tag-chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  background: #e0f2f1;
  color: #00695c;
  margin: 1px 2px 1px 0;
}

/* Radio button label */
.form-radio {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 13px;
  padding: 6px 0;
}

/* Days left chip */
.chip-days {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.chip-red { background: #ffebee; color: #c62828; }
.chip-amber { background: #fff8e1; color: #f57f17; }
.chip-green { background: #e8f5e9; color: #2e7d32; }
.chip-gray { background: #f5f5f5; color: #616161; }

/* Notification pills */
.pill {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 700;
  margin-right: 2px;
}
.pill-sent { background: var(--teal); color: #fff; }
.pill-unsent { background: #e2e8f0; color: #718096; }

/* ============================================
   Buttons
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  text-decoration: none;
  line-height: 1;
  font-family: var(--font);
}

.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-dark); }

.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--bg); }

.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #c53030; }

.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { color: var(--text); background: var(--bg); }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon { padding: 6px; border-radius: var(--radius); }

.analytics-period-btn.active {
  background: var(--teal);
  color: #fff;
  border-color: var(--teal);
  font-weight: 600;
}
.analytics-period-btn:hover:not(.active) {
  border-color: var(--teal);
  color: var(--teal);
}

#broadcasts-compose-view .vars-panel {
  margin-bottom: 8px;
}

/* ============================================
   Forms
   ============================================ */

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 5px; color: var(--text); }
.form-group label small { font-weight: 400; color: var(--text-muted); }

.form-control {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  font-family: var(--font);
  color: var(--text);
  background: var(--surface);
  transition: border .15s, box-shadow .15s;
  outline: none;
}

.form-control:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(86,148,141,.12); }
.form-control.is-invalid { border-color: var(--red); }

textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control { appearance: none; 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='%23718096' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px; }

.form-check { display: flex; align-items: center; gap: 8px; }
.form-check input[type=checkbox] { width: 15px; height: 15px; accent-color: var(--teal); cursor: pointer; }
.form-check label { font-size: 13px; cursor: pointer; }

.internal-notes-box {
  background: #fffbeb;
  border: 1px solid #f6e05e;
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 16px;
}

.internal-notes-box label { color: #92400e; font-size: 12px; font-weight: 600; display: block; margin-bottom: 6px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

.price-custom-tag { font-size: 11px; color: var(--teal); font-weight: 500; margin-left: 6px; }

/* ============================================
   Modal
   ============================================ */

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.modal-lg { max-width: 780px; }
.modal-xl { max-width: 960px; }

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

.modal-body { padding: 20px 24px; flex: 1; overflow-y: auto; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; flex-shrink: 0; }

.btn-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
  border-radius: 4px;
  transition: color .15s;
}
.btn-close:hover { color: var(--text); }

/* ============================================
   Toast
   ============================================ */

#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
  font-size: 13px;
  max-width: 360px;
  animation: slideIn .2s ease;
  color: #fff;
}

.toast-success { background: var(--green); }
.toast-error { background: var(--red); }
.toast-info { background: var(--teal); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ============================================
   Search / Filter
   ============================================ */

.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 12px;
}

.search-bar input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 13px;
  font-family: var(--font);
  width: 200px;
}

/* ============================================
   Settings Tabs
   ============================================ */

.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 24px; }

.tab-btn {
  padding: 10px 16px;
  border: none;
  background: none;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all .15s;
  font-family: var(--font);
}

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

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ============================================
   Variables Reference Panel
   ============================================ */

.vars-panel {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 16px;
}

.vars-panel h4 { font-size: 13px; font-weight: 600; margin-bottom: 12px; color: var(--text); }
.vars-group { margin-bottom: 14px; }
.vars-group-label { font-size: 11px; font-weight: 600; text-transform: uppercase; color: var(--text-muted); letter-spacing: .5px; margin-bottom: 6px; }
.vars-grid { display: flex; flex-wrap: wrap; gap: 6px; }

.var-chip {
  display: inline-block;
  padding: 3px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 11.5px;
  cursor: pointer;
  font-family: 'Courier New', monospace;
  color: var(--teal);
  transition: all .15s;
}

.var-chip:hover { background: var(--teal); color: #fff; border-color: var(--teal); }

/* ============================================
   Extra service rows
   ============================================ */

.extra-row {
  display: grid;
  grid-template-columns: 1fr 120px 36px;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

/* ============================================
   QR Code
   ============================================ */

.qr-container {
  text-align: center;
  padding: 20px;
  background: var(--bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 16px;
}
.qr-container img { max-width: 200px; }
.qr-secret {
  font-family: 'Courier New', monospace;
  font-size: 12px;
  background: #f0f0f0;
  padding: 6px 10px;
  border-radius: 4px;
  margin-top: 8px;
  word-break: break-all;
}

/* ============================================
   Cron log viewer
   ============================================ */

.log-viewer {
  background: #1a1a2e;
  color: #a8d8a8;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  padding: 16px;
  border-radius: var(--radius);
  max-height: 300px;
  overflow-y: auto;
  line-height: 1.6;
}

.log-viewer .log-line { border-bottom: 1px solid rgba(255,255,255,.05); padding: 2px 0; }

/* ============================================
   Empty state
   ============================================ */

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}

.empty-state svg { opacity: .3; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* ============================================
   Loading spinner
   ============================================ */

.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .6s linear infinite;
}

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

/* ============================================
   Tooltip
   ============================================ */

[data-tooltip] { position: relative; }
[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #1a202c;
  color: #fff;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 4px;
  white-space: nowrap;
  z-index: 999;
  pointer-events: none;
}

/* ============================================
   Section visibility
   ============================================ */

.section { display: none; }
.section.active { display: block; }

/* ============================================
   TinyMCE container
   ============================================ */

.tinymce-wrap { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 768px) {
  #sidebar { width: 60px; }
  .sidebar-brand, .sidebar-nav a span, .sidebar-footer button span { display: none; }
  .sidebar-nav a { justify-content: center; padding: 12px; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .main-content { padding: 16px; }
}
