/* ==========================================================================
   Cairo Space — Blog & Admin Styles
   Matches the main design system: Navy #0B1A38 & Gold #D4A855
   ========================================================================== */

/* ═══════════════════════════════════════════
   BLOG LISTING PAGE
   ═══════════════════════════════════════════ */

.blog-section { padding: 80px 0 40px; }

/* Toolbar */
.blog-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 48px;
}

.blog-search {
  position: relative;
  flex: 1;
  min-width: 260px;
  max-width: 400px;
}
.blog-search svg {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  color: var(--text-muted);
  pointer-events: none;
}
.blog-search input {
  width: 100%;
  padding: 12px 46px 12px 16px;
  border: 2px solid var(--cream-dark);
  border-radius: var(--r-md);
  font-size: .95rem;
  background: var(--white);
  transition: border-color var(--dur) var(--ease);
}
.blog-search input:focus {
  border-color: var(--gold);
  outline: none;
}

.blog-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.filter-btn {
  padding: 8px 20px;
  border: 2px solid var(--cream-dark);
  border-radius: var(--r-full);
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--white);
  color: var(--text-secondary);
  transition: all var(--dur) var(--ease);
  font-family: var(--font-body);
}
.filter-btn:hover {
  border-color: var(--gold);
  color: var(--gold-dark);
}
.filter-btn.active {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--white);
}

/* Blog Grid */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 32px;
  margin-bottom: 48px;
}

/* Blog Card */
.blog-card {
  background: var(--white);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--sh-md);
  transition: all var(--dur) var(--ease);
  cursor: pointer;
  border: 1px solid rgba(0,0,0,.05);
}
.blog-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--sh-card-hover);
}
.blog-card:hover .blog-card-img img {
  transform: scale(1.08);
}

.blog-card-img {
  position: relative;
  height: 200px;
  overflow: hidden;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
}
.blog-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .5s var(--ease);
}
.blog-card-img .blog-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: var(--gold);
}
.blog-card-img .blog-placeholder svg {
  width: 48px;
  height: 48px;
  opacity: .5;
}

.blog-card-cat {
  position: absolute;
  top: 14px;
  right: 14px;
  padding: 4px 14px;
  background: var(--gold);
  color: var(--white);
  border-radius: var(--r-full);
  font-size: .75rem;
  font-weight: 700;
}

.blog-card-body {
  padding: 24px;
}
.blog-card-body h3 {
  font-size: 1.15rem;
  margin-bottom: 10px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.blog-card-body p {
  font-size: .9rem;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 16px;
  line-height: 1.7;
}

.blog-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  border-top: 1px solid var(--cream-dark);
  font-size: .8rem;
  color: var(--text-muted);
}
.blog-card-meta svg {
  width: 14px;
  height: 14px;
  margin-left: 4px;
}
.blog-card-read {
  color: var(--gold-dark);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: color var(--dur) var(--ease);
}
.blog-card:hover .blog-card-read { color: var(--gold); }

/* Blog Empty State */
.blog-empty {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
}
.blog-empty svg {
  margin-bottom: 20px;
  opacity: .4;
}
.blog-empty h3 {
  color: var(--text-secondary);
  margin-bottom: 8px;
}

/* ═══════════════════════════════════════════
   SINGLE BLOG POST
   ═══════════════════════════════════════════ */
.blog-single-section {
  padding: 60px 0 80px;
}
.blog-back {
  margin-bottom: 30px;
}
.blog-article {
  max-width: 800px;
  margin: 0 auto;
}
.blog-article-header {
  margin-bottom: 40px;
}
.blog-article-cat {
  display: inline-block;
  padding: 4px 16px;
  background: var(--gold-subtle);
  color: var(--gold-dark);
  border-radius: var(--r-full);
  font-size: .8rem;
  font-weight: 700;
  margin-bottom: 14px;
  border: 1px solid rgba(212,168,85,.15);
}
.blog-article-header h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  margin-bottom: 16px;
  line-height: 1.4;
}
.blog-article-date {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: .9rem;
}
.blog-article-date svg { width: 16px; height: 16px; }

.blog-article-img {
  width: 100%;
  border-radius: var(--r-lg);
  overflow: hidden;
  margin-bottom: 36px;
  max-height: 400px;
}
.blog-article-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.blog-article-content {
  font-size: 1.05rem;
  line-height: 2;
  color: var(--text-primary);
}
.blog-article-content h2 {
  font-size: 1.5rem;
  margin: 32px 0 16px;
  color: var(--navy);
}
.blog-article-content h3 {
  font-size: 1.25rem;
  margin: 24px 0 12px;
  color: var(--navy);
}
.blog-article-content p {
  margin-bottom: 18px;
  color: var(--text-primary);
}
.blog-article-content ul,
.blog-article-content ol {
  margin: 16px 0;
  padding-right: 24px;
}
.blog-article-content li {
  margin-bottom: 8px;
  list-style: disc;
  color: var(--text-primary);
}
.blog-article-content ol li { list-style: decimal; }
.blog-article-content a {
  color: var(--gold-dark);
  text-decoration: underline;
}
.blog-article-content a:hover {
  color: var(--gold);
}

.blog-article-footer {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 2px solid var(--cream-dark);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}
.blog-share {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-secondary);
  font-weight: 600;
}
.blog-share a {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--cream);
  color: var(--navy);
  transition: all var(--dur) var(--ease);
}
.blog-share a:hover {
  background: var(--gold);
  color: var(--white);
}
.blog-share a svg { width: 16px; height: 16px; }

/* ═══════════════════════════════════════════
   ADMIN — LOGIN
   ═══════════════════════════════════════════ */
.admin-login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--navy-dark) 0%, var(--navy) 50%, var(--navy-light) 100%);
  padding: 24px;
}
.admin-login-card {
  background: var(--white);
  border-radius: var(--r-xl);
  padding: 48px 40px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow: var(--sh-xl);
}
.admin-logo {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  margin: 0 auto 20px;
  object-fit: cover;
}
.admin-login-card h2 {
  margin-bottom: 8px;
  font-size: 1.5rem;
}
.admin-login-card > p {
  color: var(--text-muted);
  margin-bottom: 28px;
  font-size: .95rem;
}
.admin-login-card .admin-form-group {
  margin-bottom: 20px;
}
.admin-login-card input {
  width: 100%;
  padding: 14px 18px;
  border: 2px solid var(--cream-dark);
  border-radius: var(--r-md);
  font-size: 1rem;
  text-align: center;
  transition: border-color var(--dur) var(--ease);
}
.admin-login-card input:focus {
  border-color: var(--gold);
  outline: none;
}
.login-error {
  color: #e74c3c;
  font-size: .85rem;
  margin-top: 12px;
}
.admin-back-link {
  display: inline-block;
  margin-top: 20px;
  color: var(--text-muted);
  font-size: .85rem;
  transition: color var(--dur) var(--ease);
}
.admin-back-link:hover { color: var(--gold); }

/* ═══════════════════════════════════════════
   ADMIN — DASHBOARD
   ═══════════════════════════════════════════ */
.admin-header {
  background: var(--navy);
  padding: 14px 0;
  position: sticky;
  top: 0;
  z-index: 100;
}
.admin-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.admin-header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}
.admin-header-right .logo img {
  height: 40px;
  width: 40px;
  border-radius: 50%;
  object-fit: cover;
}
.admin-title {
  color: var(--gold);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.1rem;
}
.admin-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-main {
  padding: 40px 0 80px;
  min-height: calc(100vh - 68px);
  background: var(--cream);
}

/* Stats */
.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 36px;
}
.admin-stat-card {
  background: var(--white);
  border-radius: var(--r-lg);
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 18px;
  box-shadow: var(--sh-sm);
  border: 1px solid rgba(0,0,0,.04);
}
.admin-stat-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--r-md);
  background: var(--cream);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.admin-stat-icon svg {
  width: 24px;
  height: 24px;
  color: var(--text-secondary);
}
.admin-stat-icon.gold {
  background: var(--gold-subtle);
}
.admin-stat-icon.gold svg { color: var(--gold-dark); }
.admin-stat-icon.navy {
  background: rgba(11,26,56,.06);
}
.admin-stat-icon.navy svg { color: var(--navy); }
.admin-stat-num {
  display: block;
  font-size: 1.75rem;
  font-weight: 800;
  font-family: var(--font-heading);
  color: var(--navy);
  line-height: 1;
}
.admin-stat-label {
  font-size: .85rem;
  color: var(--text-muted);
}

/* Action Bar */
.admin-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.admin-action-bar h2 {
  font-size: 1.35rem;
  margin-bottom: 0;
}

/* Table */
.admin-table-wrap {
  background: var(--white);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--sh-sm);
  border: 1px solid rgba(0,0,0,.04);
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
}
.admin-table th {
  background: var(--navy);
  color: var(--white);
  padding: 14px 18px;
  text-align: right;
  font-size: .85rem;
  font-weight: 600;
  white-space: nowrap;
}
.admin-table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--cream-dark);
  font-size: .9rem;
  vertical-align: middle;
}
.admin-table tbody tr:hover {
  background: var(--cream);
}
.admin-table .td-title {
  font-weight: 600;
  color: var(--navy);
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.admin-table .badge-cat {
  display: inline-block;
  padding: 3px 12px;
  border-radius: var(--r-full);
  font-size: .75rem;
  font-weight: 700;
  background: var(--gold-subtle);
  color: var(--gold-dark);
  border: 1px solid rgba(212,168,85,.15);
}
.admin-table .badge-status {
  display: inline-block;
  padding: 3px 12px;
  border-radius: var(--r-full);
  font-size: .75rem;
  font-weight: 700;
}
.badge-status.published {
  background: rgba(16,185,129,.1);
  color: #059669;
  border: 1px solid rgba(16,185,129,.2);
}
.badge-status.draft {
  background: rgba(245,158,11,.1);
  color: #d97706;
  border: 1px solid rgba(245,158,11,.2);
}

.admin-table .td-actions {
  display: flex;
  gap: 8px;
  white-space: nowrap;
}
.admin-table .td-actions button {
  width: 34px;
  height: 34px;
  border-radius: var(--r-sm);
  border: 1px solid var(--cream-dark);
  background: var(--white);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--dur) var(--ease);
}
.admin-table .td-actions button svg {
  width: 16px;
  height: 16px;
}
.admin-table .td-actions .btn-edit:hover {
  background: var(--gold-subtle);
  border-color: var(--gold);
  color: var(--gold-dark);
}
.admin-table .td-actions .btn-delete:hover {
  background: rgba(239,68,68,.08);
  border-color: #ef4444;
  color: #ef4444;
}

.admin-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.admin-empty svg { margin-bottom: 12px; opacity: .4; }

/* ═══════════════════════════════════════════
   ADMIN — MODAL
   ═══════════════════════════════════════════ */
.admin-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 20px;
  overflow-y: auto;
  backdrop-filter: blur(4px);
}
.admin-modal {
  background: var(--white);
  border-radius: var(--r-xl);
  max-width: 720px;
  width: 100%;
  box-shadow: var(--sh-xl);
  animation: modalSlideIn .3s var(--ease);
}
@keyframes modalSlideIn {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}
.admin-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px;
  border-bottom: 1px solid var(--cream-dark);
}
.admin-modal-header h3 {
  margin-bottom: 0;
  font-size: 1.2rem;
}
.admin-modal-close {
  width: 36px;
  height: 36px;
  border: none;
  background: var(--cream);
  border-radius: 50%;
  font-size: 1.3rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--dur) var(--ease);
  color: var(--text-secondary);
}
.admin-modal-close:hover {
  background: #ef4444;
  color: #fff;
}
.admin-modal-body {
  padding: 28px;
}
.admin-form-row {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
}
.admin-form-group {
  flex: 1;
}
.admin-form-group.full { flex: 0 0 100%; }
.admin-form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  font-size: .9rem;
  color: var(--navy);
}
.admin-form-group label .required { color: #ef4444; }
.admin-form-group input,
.admin-form-group select,
.admin-form-group textarea {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--cream-dark);
  border-radius: var(--r-md);
  font-size: .95rem;
  transition: border-color var(--dur) var(--ease);
  background: var(--white);
}
.admin-form-group input:focus,
.admin-form-group select:focus,
.admin-form-group textarea:focus {
  border-color: var(--gold);
  outline: none;
}
.admin-form-group small {
  display: block;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: .8rem;
}
.admin-form-group.has-error input,
.admin-form-group.has-error select,
.admin-form-group.has-error textarea,
.admin-form-group.has-error .editor-content {
  border-color: #ef4444;
}

/* Rich Text Editor */
.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 8px 12px;
  background: var(--cream);
  border: 2px solid var(--cream-dark);
  border-bottom: none;
  border-radius: var(--r-md) var(--r-md) 0 0;
}
.editor-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: var(--r-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .85rem;
  color: var(--text-secondary);
  transition: all var(--dur) var(--ease);
  font-family: var(--font-body);
}
.editor-btn:hover {
  background: var(--white);
  color: var(--gold-dark);
}
.editor-sep {
  width: 1px;
  height: 24px;
  background: var(--cream-dark);
  margin: 0 4px;
  align-self: center;
}
.editor-content {
  min-height: 250px;
  padding: 16px;
  border: 2px solid var(--cream-dark);
  border-top: none;
  border-radius: 0 0 var(--r-md) var(--r-md);
  font-size: .95rem;
  line-height: 1.8;
  overflow-y: auto;
  max-height: 500px;
  outline: none;
  transition: border-color var(--dur) var(--ease);
}
.editor-content:focus {
  border-color: var(--gold);
}
.editor-content:empty::before {
  content: attr(data-placeholder);
  color: var(--text-muted);
  pointer-events: none;
}

.admin-modal-footer {
  display: flex;
  gap: 12px;
  justify-content: flex-start;
  padding-top: 16px;
  border-top: 1px solid var(--cream-dark);
  margin-top: 8px;
}

/* Delete Confirm */
.admin-confirm-modal {
  max-width: 400px;
  text-align: center;
  padding: 40px 32px;
}
.admin-confirm-icon {
  color: #ef4444;
  margin-bottom: 16px;
}
.admin-confirm-modal h3 {
  margin-bottom: 8px;
}
.admin-confirm-modal p {
  font-size: .95rem;
  color: var(--text-secondary);
  margin-bottom: 28px;
}
.admin-confirm-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}
.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: var(--r-sm);
  font-weight: 600;
  font-size: .95rem;
  cursor: pointer;
  border: none;
  background: #ef4444;
  color: #fff;
  transition: all var(--dur) var(--ease);
  font-family: var(--font-body);
}
.btn-danger:hover {
  background: #dc2626;
}

.btn-sm {
  padding: 8px 16px;
  font-size: .85rem;
}
.btn-full { width: 100%; }

/* ═══════════════════════════════════════════
   CATEGORY LABELS
   ═══════════════════════════════════════════ */
.cat-tax { background: rgba(239,68,68,.08); color: #dc2626; border-color: rgba(239,68,68,.15); }
.cat-legal { background: rgba(99,102,241,.08); color: #4f46e5; border-color: rgba(99,102,241,.15); }
.cat-company { background: var(--gold-subtle); color: var(--gold-dark); border-color: rgba(212,168,85,.15); }
.cat-finance { background: rgba(16,185,129,.08); color: #059669; border-color: rgba(16,185,129,.15); }
.cat-news { background: rgba(59,130,246,.08); color: #2563eb; border-color: rgba(59,130,246,.15); }

/* ═══════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════ */
@media (max-width: 768px) {
  .blog-grid {
    grid-template-columns: 1fr;
  }
  .blog-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .blog-search { max-width: 100%; }
  .blog-filters {
    justify-content: center;
  }
  .admin-form-row {
    flex-direction: column;
    gap: 16px;
  }
  .admin-modal {
    margin: 20px;
  }
  .admin-modal-body {
    padding: 20px;
  }
  .admin-stats {
    grid-template-columns: 1fr;
  }
  .admin-header .container {
    flex-wrap: wrap;
  }
  .admin-table {
    font-size: .82rem;
  }
  .admin-table th,
  .admin-table td {
    padding: 10px 12px;
  }
  .admin-table .td-title { max-width: 160px; }
  .admin-action-bar {
    flex-direction: column;
    gap: 16px;
    align-items: stretch;
  }
}

@media (max-width: 480px) {
  .admin-login-card {
    padding: 32px 24px;
  }
  .blog-card-img {
    height: 160px;
  }
}
