/* =============================================
   Grant Consulting — Admin Dashboard
   Same design tokens as grant-consulting.uz
   ============================================= */

/* --- Same variables as the main site --- */
:root {
  --black: #1a1a1a;
  --gray-900: #2d2d2d;
  --gray-700: #4a4a4a;
  --gray-500: #535353;
  --gray-300: #9e9e9e;
  --white: #ffffff;
  --yellow: #f5c518;
  --yellow-dark: #e0b000;
  --bg-dark: #1a1a1a;
  --card-dark: #252525;
  --radius: 8px;
  --radius-lg: 12px;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --sidebar-w: 260px;
  --header-h: 64px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  color: var(--black);
  line-height: 1.5;
  background: #f8f8f8;
}

img { max-width: 100%; display: block; }

a, button, input, textarea {
  transition: color 180ms ease, background-color 180ms ease,
    border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(245, 197, 24, 0.45);
  outline-offset: 3px;
}

/* =============================================
   LOGIN PAGE
   ============================================= */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 50% 0%, #f9f5e8 0%, var(--white) 60%);
  padding: 24px;
}

.login-box {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 40px rgba(0, 0, 0, 0.08);
  padding: 52px 44px;
  width: 100%;
  max-width: 420px;
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 36px;
}

.logo-mark {
  width: 40px;
  height: 40px;
  background: var(--yellow);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.875rem;
  color: var(--black);
  flex-shrink: 0;
  letter-spacing: -0.02em;
}

.login-logo .logo-text {
  font-size: 1rem;
  font-weight: 700;
  color: var(--black);
}

.login-title {
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 8px;
  color: var(--black);
}

.login-subtitle {
  font-size: 0.9375rem;
  color: var(--gray-500);
  margin-bottom: 32px;
}

.form-error {
  color: #b63a2b;
  font-size: 0.875rem;
  margin-top: 12px;
  font-weight: 500;
}

/* =============================================
   LAYOUT
   ============================================= */
.app-layout { display: flex; min-height: 100vh; }

/* =============================================
   SIDEBAR  — uses the site's dark section tone
   ============================================= */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--bg-dark);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  height: var(--header-h);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-logo {
  width: 34px;
  height: 34px;
  background: var(--yellow);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.8125rem;
  color: var(--black);
  flex-shrink: 0;
}

.sidebar-name {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--white);
  letter-spacing: -0.01em;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-label {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.3);
  padding: 8px 12px 4px;
  margin-top: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.9rem;
  font-weight: 500;
  user-select: none;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: var(--font-sans);
}

.nav-item:hover {
  color: var(--white);
  background: rgba(255, 255, 255, 0.06);
}

.nav-item.active {
  color: var(--yellow);
  background: rgba(245, 197, 24, 0.1);
  font-weight: 600;
}

.nav-icon { font-size: 1rem; width: 18px; text-align: center; flex-shrink: 0; }

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

/* =============================================
   MAIN CONTENT
   ============================================= */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.main-header {
  height: var(--header-h);
  background: var(--white);
  border-bottom: 1px solid #eee;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.main-header-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--black);
}

.main-header-meta {
  font-size: 0.8125rem;
  color: var(--gray-300);
}

.section-body {
  padding: 32px;
  flex: 1;
}

/* =============================================
   SECTION PANES
   ============================================= */
.section-pane { display: none; }
.section-pane.active { display: block; }

/* =============================================
   OVERVIEW CARDS — matches the features bar
   ============================================= */
.overview-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.ov-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  cursor: pointer;
  text-align: center;
}

.ov-card:hover {
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.ov-num {
  font-size: 2.75rem;
  font-weight: 800;
  color: var(--black);
  line-height: 1;
  margin-bottom: 6px;
}

.ov-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* =============================================
   CARD  — matches the site's white card style
   ============================================= */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 28px 28px;
  margin-bottom: 20px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--black);
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid #eee;
}

/* =============================================
   SECTION HEADER
   ============================================= */
.actions-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.section-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--black);
}

/* =============================================
   BUTTONS — exact match of the main site
   ============================================= */

/* Black button — same as site's .btn-primary */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 32px;
  background: var(--black);
  color: var(--white);
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 700;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  width: 100%;
}

.btn-primary:hover { background: var(--gray-900); transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* Yellow CTA button — matches .service-card-cta style */
.btn-accent {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 12px 24px;
  background: var(--yellow);
  color: var(--black);
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 700;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
}

.btn-accent:hover { background: var(--yellow-dark); transform: translateY(-1px); }
.btn-accent:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* Outlined cancel button */
.btn-cancel {
  display: inline-flex;
  align-items: center;
  padding: 12px 24px;
  background: none;
  color: var(--gray-500);
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 600;
  border: 1px solid #ddd;
  border-radius: var(--radius);
  cursor: pointer;
}

.btn-cancel:hover { border-color: var(--gray-300); color: var(--black); }

/* Small button */
.btn-sm {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  background: none;
  color: var(--gray-500);
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 600;
  border: 1px solid #ddd;
  border-radius: var(--radius);
  cursor: pointer;
}

.btn-sm:hover { color: var(--black); border-color: var(--gray-300); }
.btn-sm.btn-danger { color: #b63a2b; border-color: rgba(182, 58, 43, 0.3); }
.btn-sm.btn-danger:hover { background: rgba(182, 58, 43, 0.06); border-color: #b63a2b; }

/* Sidebar logout button — white on dark */
.btn-sidebar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px 14px;
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius);
  color: rgba(255, 255, 255, 0.6);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-sidebar:hover { border-color: rgba(255, 255, 255, 0.4); color: var(--white); }

/* =============================================
   FORMS — exact match of the main site's forms
   ============================================= */
form { width: 100%; }

label {
  display: inline-block;
  margin-bottom: 0.375rem;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--black);
}

label small {
  font-weight: 400;
  color: var(--gray-500);
}

input[type="text"],
input[type="password"],
input[type="date"],
input[type="file"],
select,
textarea {
  width: 100%;
  border: 1px solid #ddd;
  border-radius: var(--radius);
  padding: 11px 14px;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  background: var(--white);
  color: var(--black);
  outline: none;
}

input::placeholder, textarea::placeholder { color: var(--gray-300); }

input:focus, textarea:focus, select:focus {
  border-color: var(--yellow);
  box-shadow: 0 0 0 3px rgba(245, 197, 24, 0.15);
}

input[type="file"] { padding: 9px 12px; cursor: pointer; }

textarea { resize: vertical; min-height: 88px; line-height: 1.55; }

.form-group { margin-bottom: 16px; }

.row { display: flex; gap: 16px; }
.row .form-group { flex: 1; }

/* Status messages — same as site */
.form-status {
  min-height: 1.5rem;
  margin-top: 12px;
  font-size: 0.9375rem;
  color: var(--gray-500);
  font-weight: 500;
}

.form-status.success { color: #1d6b43; }
.form-status.error   { color: #b63a2b; }

.form-hint {
  font-size: 0.8125rem;
  color: var(--gray-300);
  margin-top: 8px;
  transition: opacity 0.2s;
}

.form-hint.hidden { display: none; }

/* =============================================
   LANGUAGE TABS
   ============================================= */
.lang-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  padding-bottom: 0;
  border-bottom: 2px solid #eee;
}

.lang-tab {
  padding: 8px 18px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  color: var(--gray-500);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.02em;
}

.lang-tab:hover { color: var(--black); }
.lang-tab.active { color: var(--black); border-bottom-color: var(--yellow); }

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

/* =============================================
   LIST ITEMS
   ============================================= */
.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid #eee;
}

.list-item:last-child { border-bottom: none; }

.list-item-info { flex: 1; min-width: 0; }

.list-item-info strong {
  display: block;
  font-weight: 600;
  font-size: 0.9375rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--black);
}

.list-item-info .meta {
  font-size: 0.8125rem;
  color: var(--gray-500);
  margin-top: 2px;
}

.list-item-info .quote-preview {
  font-size: 0.8125rem;
  color: var(--gray-500);
  margin-top: 3px;
  font-style: italic;
}

.list-item-actions { display: flex; gap: 8px; flex-shrink: 0; }

.list-item--archived { opacity: 0.55; }
.list-item--archived:hover { opacity: 1; }

.btn-restore-sm {
  background: #edf7f1;
  border: 1px solid #a8d9bb;
  color: #1a7a3c;
  cursor: pointer;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.8125rem;
  font-family: var(--font-sans);
  font-weight: 600;
}
.btn-restore-sm:hover { background: #1a7a3c; color: var(--white); border-color: #1a7a3c; }

/* =============================================
   SECTIONS BUILDER
   ============================================= */
.sections-builder { display: flex; flex-direction: column; gap: 12px; }

.section-item {
  background: #f8f8f8;
  border: 1px solid #eee;
  border-radius: var(--radius);
  padding: 16px;
}

.section-item .section-heading { margin-bottom: 10px; }
.paragraphs { display: flex; flex-direction: column; gap: 8px; }
.section-item-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

/* =============================================
   GALLERY ADMIN GRID
   ============================================= */
.gallery-admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
  margin-top: 4px;
}

.gallery-admin-item {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: #f8f8f8;
  border: 1px solid #eee;
}

.gallery-admin-item img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
}

.video-thumb {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
  font-size: 1.5rem;
  color: var(--gray-300);
  padding: 8px;
}

.video-thumb span { font-size: 0.6875rem; color: var(--gray-500); text-align: center; word-break: break-all; }

.gallery-admin-label {
  font-size: 0.6875rem;
  color: var(--gray-500);
  padding: 4px 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-del {
  position: absolute;
  top: 4px; right: 4px;
  background: rgba(255,255,255,0.9);
  border: 1px solid #ddd;
  color: #b63a2b;
  cursor: pointer;
  border-radius: 4px;
  padding: 2px 7px;
  font-size: 0.75rem;
  font-family: var(--font-sans);
  font-weight: 600;
  line-height: 1.6;
}

.btn-del:hover { background: #b63a2b; color: var(--white); border-color: #b63a2b; }

.btn-restore {
  position: absolute;
  top: 4px; right: 4px;
  background: rgba(255,255,255,0.9);
  border: 1px solid #ddd;
  color: #1a7a3c;
  cursor: pointer;
  border-radius: 4px;
  padding: 2px 7px;
  font-size: 0.75rem;
  font-family: var(--font-sans);
  font-weight: 700;
  line-height: 1.6;
}
.btn-restore:hover { background: #1a7a3c; color: var(--white); border-color: #1a7a3c; }

.gallery-admin-item--archived {
  opacity: 0.6;
  border-style: dashed;
}
.gallery-admin-item--archived:hover { opacity: 1; }

.archived-section {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid #eee;
}
.archived-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0 0 6px;
}

/* =============================================
   UTILITY
   ============================================= */
.muted { color: var(--gray-500); font-size: 0.9rem; }
.loading { color: var(--gray-300); font-style: italic; }
.error-msg { color: #b63a2b; }

/* info box like site's about-badge */
.info-box {
  background: #fff9e6;
  border-left: 3px solid var(--yellow);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 0.875rem;
  color: var(--gray-700);
  line-height: 1.55;
  margin-bottom: 20px;
}

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 1024px) {
  .overview-cards { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  :root { --sidebar-w: 220px; }
  .section-body { padding: 20px; }
  .main-header { padding: 0 20px; }
}

@media (max-width: 600px) {
  .sidebar { transform: translateX(-100%); }
  .main-content { margin-left: 0; }
  .row { flex-direction: column; }
}
