/* ==========================================================================
   GLENDA PINTO SEGUROS — ADMIN STYLES
   ========================================================================== */

:root {
  --primary: #062866;
  --primary-light: #0a3d91;
  --primary-dark: #031533;
  --gold: #d4af37;
  --gold-hover: #bfa030;
  --background: #f4f7fc;
  --card-bg: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --success: #10b981;
  --error: #ef4444;
  --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
  background-color: var(--background);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================
   COMMON COMPONENTS
   ========================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  font-weight: 500;
  font-size: 0.875rem;
  border-radius: 0.5rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

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

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

.btn-gold {
  background-color: var(--gold);
  color: var(--primary-dark);
}

.btn-gold:hover {
  background-color: var(--gold-hover);
}

.btn-outline {
  background-color: transparent;
  border-color: var(--border);
  color: var(--text);
}

.btn-outline:hover {
  background-color: #f8fafc;
  border-color: var(--text-muted);
}

.btn-danger {
  background-color: var(--error);
  color: white;
}

.btn-danger:hover {
  background-color: #dc2626;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 9999px;
  text-transform: capitalize;
}

.badge-published {
  background-color: #d1fae5;
  color: #065f46;
}

.badge-draft {
  background-color: #f1f5f9;
  color: #475569;
}

/* Form controls */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.375rem;
  color: var(--text);
}

.form-control {
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
  border-radius: 0.375rem;
  border: 1px solid var(--border);
  background-color: white;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s ease;
}

.form-control:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(10, 61, 145, 0.1);
}

textarea.form-control {
  resize: vertical;
  min-height: 100px;
}

/* Alert Notification */
#alertContainer {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 400px;
  width: 100%;
}

.alert {
  padding: 1rem;
  border-radius: 0.5rem;
  color: white;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  transform: translateX(120%);
  animation: slideIn 0.3s forwards cubic-bezier(0.16, 1, 0.3, 1);
}

.alert-success {
  background-color: var(--success);
}

.alert-error {
  background-color: var(--error);
}

@keyframes slideIn {
  to { transform: translateX(0); }
}

.alert-close {
  background: transparent;
  border: none;
  color: white;
  cursor: pointer;
  opacity: 0.8;
}

.alert-close:hover {
  opacity: 1;
}

/* ==========================================
   LOGIN PAGE
   ========================================== */

.login-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1.5rem;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
  position: relative;
  overflow: hidden;
}

.login-wrapper::before {
  content: '';
  position: absolute;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: rgba(212, 175, 55, 0.1);
  top: -100px;
  right: -100px;
  filter: blur(50px);
}

.login-wrapper::after {
  content: '';
  position: absolute;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: rgba(10, 61, 145, 0.3);
  bottom: -150px;
  left: -150px;
  filter: blur(70px);
}

.login-card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  width: 100%;
  max-width: 420px;
  border-radius: 1rem;
  box-shadow: var(--shadow-lg);
  padding: 2.5rem;
  position: relative;
  z-index: 10;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.login-logo {
  text-align: center;
  margin-bottom: 2rem;
}

.login-logo .logo-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.5rem;
  height: 3.5rem;
  background-color: var(--primary);
  color: var(--gold);
  font-size: 1.75rem;
  font-weight: 700;
  border-radius: 0.75rem;
  margin-bottom: 0.75rem;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.login-logo h1 {
  font-size: 1.5rem;
  color: var(--primary-dark);
  font-weight: 700;
}

.login-logo p {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* ==========================================
   DASHBOARD PAGE
   ========================================== */

.dashboard-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.header-nav {
  background-color: var(--primary-dark);
  color: white;
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-nav .brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: white;
}

.header-nav .brand-logo {
  background: var(--gold);
  color: var(--primary-dark);
  font-weight: 700;
  font-size: 1.1rem;
  width: 2rem;
  height: 2rem;
  border-radius: 0.375rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-nav .brand-name {
  font-weight: 600;
  letter-spacing: 0.5px;
}

.header-nav .brand-sub {
  font-size: 0.75rem;
  opacity: 0.7;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.user-email {
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.8);
}

.dashboard-main {
  flex: 1;
  padding: 2rem;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.dashboard-title h2 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--primary-dark);
}

.dashboard-title p {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.posts-card-container {
  background: var(--card-bg);
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.posts-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.posts-table th {
  padding: 1rem 1.5rem;
  background-color: #f8fafc;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  letter-spacing: 0.5px;
}

.posts-table td {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
  vertical-align: middle;
}

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

.post-row-title {
  font-weight: 600;
  color: var(--primary-dark);
  margin-bottom: 0.25rem;
}

.post-row-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.post-img-preview {
  width: 60px;
  height: 40px;
  object-fit: cover;
  border-radius: 0.25rem;
  background-color: #e2e8f0;
  border: 1px solid var(--border);
}

.table-actions {
  display: flex;
  gap: 0.5rem;
}

.action-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.375rem;
  border-radius: 0.25rem;
  color: var(--text-muted);
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.action-btn:hover {
  background-color: #f1f5f9;
  color: var(--primary);
}

.action-btn.delete-btn:hover {
  background-color: #fee2e2;
  color: var(--error);
}

/* Empty State */
.empty-state {
  padding: 4rem 2rem;
  text-align: center;
}

.empty-state-icon {
  font-size: 3rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.empty-state h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.empty-state p {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
}

/* ==========================================
   SLIDE-OVER / MODAL FORM SHEET
   ========================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(3, 21, 51, 0.4);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  justify-content: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-sheet {
  background-color: white;
  width: 100%;
  max-width: 680px;
  height: 100%;
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-backdrop.show .modal-sheet {
  transform: translateX(0);
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary-dark);
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  background-color: #f8fafc;
}

/* Image input row layout */
.image-input-group {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.image-upload-preview {
  width: 100px;
  height: 70px;
  border-radius: 0.375rem;
  border: 1px solid var(--border);
  object-fit: cover;
  background-color: #f8fafc;
}

/* Rich Text Editor Overrides (Quill) */
.ql-container {
  border-bottom-left-radius: 0.375rem;
  border-bottom-right-radius: 0.375rem;
  min-height: 250px;
  max-height: 400px;
  font-family: inherit !important;
  font-size: 0.875rem !important;
}

.ql-toolbar {
  border-top-left-radius: 0.375rem;
  border-top-right-radius: 0.375rem;
  background-color: #f8fafc;
}

/* Config Warning banner */
.config-warning {
  background-color: #fffbeb;
  border: 1px solid #fef3c7;
  border-radius: 0.5rem;
  padding: 1rem;
  margin-bottom: 1.5rem;
  color: #92400e;
  font-size: 0.875rem;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.config-warning-icon {
  font-size: 1.25rem;
  margin-top: -0.1rem;
}

/* Local Config Panel */
.local-config-btn-container {
  text-align: right;
  margin-top: 1rem;
}

.local-config-card {
  margin-top: 1.5rem;
  border: 1px dashed var(--gold);
  border-radius: 0.5rem;
  padding: 1rem;
  background-color: rgba(212, 175, 55, 0.05);
}

.local-config-card h4 {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--primary-dark);
  margin-bottom: 0.5rem;
}
