/**
 * CIBA Blog Editor - myciba.org styling
 * Professional institute look: navy, white, clean typography.
 */

:root {
  /* Brand (myciba.org / CIBA) */
  --ciba-navy: #0f2e5e;
  --ciba-navy-light: #1a3d7a;
  --ciba-navy-dark: #0a1f3d;
  --ciba-gold: #c4a035;
  --ciba-gold-light: #d4b855;
  --ciba-white: #ffffff;
  --ciba-off-white: #f5f6f8;
  --ciba-border: #e0e3e8;
  --ciba-text: #1a1a1a;
  --ciba-text-muted: #5a5f66;
  --ciba-success: #2d6a4f;
  --ciba-warning: #b8860b;
  --ciba-danger: #c1121f;

  /* Editor */
  --sidebar-width: 220px;
  --right-panel-width: 300px;
  --header-height: 56px;
  --radius: 6px;
  --shadow: 0 1px 3px rgba(15, 46, 94, 0.08);
  --shadow-md: 0 4px 12px rgba(15, 46, 94, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ciba-text);
  background: var(--ciba-off-white);
}

/* Layout: app shell */
.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app-header {
  height: var(--header-height);
  background: var(--ciba-navy);
  color: var(--ciba-white);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  flex-shrink: 0;
  box-shadow: var(--shadow-md);
}

.app-header .brand {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.02em;
}
.app-header .brand a {
  color: inherit;
  text-decoration: none;
}

.app-header .nav-main {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.app-header .nav-main a {
  color: rgba(255,255,255,0.9);
  text-decoration: none;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
}
.app-header .nav-main a:hover {
  background: rgba(255,255,255,0.1);
  color: var(--ciba-white);
}
.app-header .nav-main a.active {
  background: rgba(255,255,255,0.15);
  color: var(--ciba-white);
}

.app-header .nav-dropdown {
  position: relative;
}
.app-header .nav-dropdown .nav-dropdown-trigger {
  display: inline-block;
  color: rgba(255,255,255,0.9);
  text-decoration: none;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
}
.app-header .nav-dropdown .nav-dropdown-trigger:hover,
.app-header .nav-dropdown.nav-dropdown-open .nav-dropdown-trigger {
  background: rgba(255,255,255,0.1);
  color: var(--ciba-white);
}
.app-header .nav-dropdown .nav-dropdown-trigger.active {
  background: rgba(255,255,255,0.15);
  color: var(--ciba-white);
}
.app-header .nav-dropdown .nav-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 0.25rem;
  min-width: 160px;
  background: var(--ciba-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 0.35rem 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 0.15s, visibility 0.15s, transform 0.15s;
  z-index: 100;
}
.app-header .nav-dropdown:hover .nav-dropdown-menu,
.app-header .nav-dropdown.nav-dropdown-open .nav-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.app-header .nav-dropdown .nav-dropdown-menu a {
  display: block;
  padding: 0.5rem 1rem;
  color: var(--ciba-text);
  background: none;
  font-size: 0.9rem;
}
.app-header .nav-dropdown .nav-dropdown-menu a:hover {
  background: var(--ciba-off-white);
  color: var(--ciba-navy);
}
.app-header .nav-dropdown .nav-dropdown-menu a.active {
  background: rgba(15, 46, 94, 0.08);
  color: var(--ciba-navy);
  font-weight: 500;
}

.app-header .header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.app-header .header-actions a {
  color: rgba(255,255,255,0.9);
  text-decoration: none;
  font-size: 0.9rem;
}

/* Main content area: sidebar + content + right panel */
.app-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Left sidebar (jump-to sections in editor) */
.app-sidebar {
  width: var(--sidebar-width);
  background: var(--ciba-white);
  border-right: 1px solid var(--ciba-border);
  padding: 1rem 0;
  overflow-y: auto;
  flex-shrink: 0;
}

.app-sidebar .sidebar-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ciba-text-muted);
  padding: 0 1rem 0.5rem;
  margin: 0;
}

.app-sidebar nav a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1rem;
  color: var(--ciba-text);
  text-decoration: none;
  font-size: 0.9rem;
  border-left: 3px solid transparent;
}
.app-sidebar nav a:hover {
  background: var(--ciba-off-white);
  color: var(--ciba-navy);
}
.app-sidebar nav a.active {
  border-left-color: var(--ciba-navy);
  background: rgba(15, 46, 94, 0.06);
  color: var(--ciba-navy);
  font-weight: 500;
}
.app-sidebar nav a .badge {
  font-size: 0.75rem;
  color: var(--ciba-text-muted);
}
.app-sidebar nav a.active .badge { color: var(--ciba-navy); }

.app-content {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  background: var(--ciba-off-white);
}

.app-right-panel {
  width: var(--right-panel-width);
  background: var(--ciba-white);
  border-left: 1px solid var(--ciba-border);
  padding: 1rem;
  overflow-y: auto;
  flex-shrink: 0;
}

/* Cards */
.card {
  background: var(--ciba-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--ciba-border);
  margin-bottom: 1rem;
}
.card-header {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--ciba-border);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ciba-navy);
}
.card-body {
  padding: 1rem;
}

/* Form controls */
.form-group {
  margin-bottom: 1rem;
}
.form-group label {
  display: block;
  font-weight: 500;
  font-size: 0.9rem;
  margin-bottom: 0.35rem;
  color: var(--ciba-text);
}
.category-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
}
.category-checkboxes .checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: normal;
  margin-bottom: 0;
  cursor: pointer;
}
.category-checkboxes .checkbox-inline input {
  margin: 0;
}
.form-control {
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 0.95rem;
  border: 1px solid var(--ciba-border);
  border-radius: var(--radius);
  background: var(--ciba-white);
  color: var(--ciba-text);
}
.form-control:focus {
  outline: none;
  border-color: var(--ciba-navy);
  box-shadow: 0 0 0 3px rgba(15, 46, 94, 0.15);
}
textarea.form-control {
  min-height: 100px;
  resize: vertical;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.btn-primary {
  background: var(--ciba-navy);
  color: var(--ciba-white);
}
.btn-primary:hover {
  background: var(--ciba-navy-light);
}
.btn-secondary {
  background: var(--ciba-off-white);
  color: var(--ciba-text);
  border: 1px solid var(--ciba-border);
}
.btn-secondary:hover {
  background: var(--ciba-border);
}
.btn-success {
  background: var(--ciba-success);
  color: var(--ciba-white);
}
.btn-success:hover {
  filter: brightness(1.1);
}
.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.85rem;
}

/* SEO / progress indicators */
.seo-score {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 600;
  font-size: 0.9rem;
}
.seo-score--poor   { color: var(--ciba-danger); }
.seo-score--medium { color: var(--ciba-warning); }
.seo-score--good   { color: var(--ciba-success); }

.progress-bar {
  height: 6px;
  background: var(--ciba-border);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 0.25rem;
}
.progress-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.2s;
}
.progress-bar-fill--poor   { background: var(--ciba-danger); }
.progress-bar-fill--medium { background: var(--ciba-warning); }
.progress-bar-fill--good   { background: var(--ciba-success); }

/* Editor title (H1) */
.editor-page-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ciba-navy);
  margin: 0 0 1rem;
}

/* Dashboard / list */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}
.page-header h1 {
  margin: 0;
  font-size: 1.5rem;
  color: var(--ciba-navy);
}

.table-wrap {
  overflow-x: auto;
}
table.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--ciba-white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
table.data-table th,
table.data-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--ciba-border);
}
table.data-table th {
  background: var(--ciba-off-white);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--ciba-navy);
}
table.data-table tr:hover td {
  background: rgba(15, 46, 94, 0.02);
}
table.data-table a {
  color: var(--ciba-navy);
  text-decoration: none;
}
table.data-table a:hover {
  text-decoration: underline;
}

/* Status pills */
.status-pill {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  font-size: 0.8rem;
  font-weight: 500;
  border-radius: 999px;
}
.status-pill--draft     { background: #e9ecef; color: #495057; }
.status-pill--published { background: #d4edda; color: #155724; }
.status-pill--scheduled { background: #fff3cd; color: #856404; }
.status-pill--sent      { background: #e2e3e5; color: #383d41; }
.status-pill--delivered { background: #cce5ff; color: #004085; }
.status-pill--opened    { background: #d4edda; color: #155724; }
.status-pill--clicked   { background: #c3e6cb; color: #155724; font-weight: 500; }

/* Post list thumbnails */
.post-list-thumb {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: var(--radius);
  display: block;
  background: var(--ciba-off-white);
}
.post-list-no-img {
  display: inline-block;
  width: 56px;
  height: 56px;
  line-height: 56px;
  text-align: center;
  color: var(--ciba-text-muted);
  font-size: 0.85rem;
  background: var(--ciba-off-white);
  border-radius: var(--radius);
}

/* Author list avatar */
.author-list-avatar {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 50%;
  display: block;
  background: var(--ciba-off-white);
}
.author-list-no-avatar {
  display: inline-block;
  width: 40px;
  height: 40px;
  line-height: 40px;
  text-align: center;
  color: var(--ciba-text-muted);
  font-size: 0.85rem;
  background: var(--ciba-off-white);
  border-radius: 50%;
}

/* Quill rich text editor */
.quill-container {
  min-height: 320px;
  background: var(--ciba-white);
  border: 1px solid var(--ciba-border);
  border-radius: var(--radius);
}
.quill-container .ql-toolbar {
  border: none;
  border-bottom: 1px solid var(--ciba-border);
  background: var(--ciba-off-white);
  border-radius: var(--radius) var(--radius) 0 0;
}
.quill-container .ql-container {
  border: none;
  font-size: 15px;
  min-height: 280px;
  border-radius: 0 0 var(--radius) var(--radius);
}
.quill-container .ql-editor {
  min-height: 280px;
}
.quill-container .ql-editor.ql-blank::before {
  color: var(--ciba-text-muted);
  font-style: normal;
}

/* Modal (image insert) */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}
.modal-overlay[hidden] {
  display: none !important;
}
.modal-box {
  background: var(--ciba-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  max-width: 420px;
  width: 100%;
  max-height: 90vh;
  overflow: auto;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--ciba-border);
}
.modal-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--ciba-navy);
}
.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--ciba-text-muted);
  cursor: pointer;
  padding: 0 0.25rem;
}
.modal-close:hover {
  color: var(--ciba-text);
}
.modal-body {
  padding: 1.25rem;
}
.image-modal-tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1rem;
}
.image-tab {
  padding: 0.4rem 0.75rem;
  font-size: 0.9rem;
  border: 1px solid var(--ciba-border);
  background: var(--ciba-off-white);
  color: var(--ciba-text);
  border-radius: var(--radius);
  cursor: pointer;
}
.image-tab:hover {
  background: var(--ciba-border);
}
.image-tab.active {
  background: var(--ciba-navy);
  color: var(--ciba-white);
  border-color: var(--ciba-navy);
}
.image-tab-panel label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
}
.image-tab-panel .form-control {
  margin-bottom: 0;
}

/* Article / SEO image row: URL input + Upload button */
.image-url-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}
.image-url-row .form-control {
  flex: 1;
  min-width: 200px;
}
.image-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
.image-upload-label {
  flex-shrink: 0;
  cursor: pointer;
  margin: 0;
}
.image-upload-status {
  margin-top: 0.25rem;
  margin-bottom: 0;
  font-size: 0.85rem;
}
