@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600&family=Tiro+Devanagari+Sanskrit&display=swap');

:root {
  --primary: #c44d24;
  --primary-dark: #a33d1a;
  --primary-light: #f9c26b;
  --bg: #f5f0eb;
  --white: #fff;
  --text: #444;
  --text-light: #888;
  --border: #e2d5c8;
  --sidebar-w: 260px;
}

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

body {
  font-family: 'Poppins', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

a { text-decoration: none; color: inherit; }

/* ===== HEADER ===== */
.header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: 40px;
  background: var(--white);
  border-bottom: 2px solid var(--primary);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 14px;
  box-shadow: 0 2px 8px rgba(196,77,36,.1);
}

.header-left { display: flex; align-items: center; gap: 14px; }

.hamburger {
  background: none; border: none; cursor: pointer;
  color: var(--primary); padding: 4px;
  display: flex; align-items: center;
}

.logo {
  font-size: .95rem; font-weight: 600; color: var(--primary);
  letter-spacing: .5px;
}
.logo span { color: var(--text-light); font-weight: 300; }

.btn-logout {
  display: flex; align-items: center; gap: 5px;
  background: none; border: 1.5px solid var(--primary);
  color: var(--primary); padding: 4px 10px; border-radius: 5px;
  cursor: pointer; font-size: .78rem; font-family: inherit;
  transition: all .2s;
}
.btn-logout:hover { background: var(--primary); color: #fff; }

/* ===== SIDEBAR ===== */
.sidebar {
  position: fixed; top: 40px; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--white);
  border-right: 2px solid var(--border);
  transform: translateX(-100%);
  transition: transform .3s ease;
  z-index: 90; overflow-y: auto;
  padding: 20px 0;
}
.sidebar.open { transform: translateX(0); }

.sidebar-overlay {
  display: none; position: fixed; inset: 0; z-index: 89;
  background: rgba(0,0,0,.25);
}
.sidebar-overlay.show { display: block; }

.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 20px; color: var(--text);
  transition: all .2s; font-size: .9rem;
}
.nav-item:hover, .nav-item.active {
  background: #fdf2ec; color: var(--primary);
  border-left: 3px solid var(--primary);
}
.nav-item svg { flex-shrink: 0; }

.nav-section {
  font-size: .7rem; text-transform: uppercase;
  letter-spacing: 1px; color: var(--text-light);
  padding: 16px 20px 6px;
}

/* ===== MAIN ===== */
.main { padding-top: 40px; min-height: 100vh; }
.page { padding: 16px; max-width: 1100px; margin: 0 auto; }
.page.full-width { max-width: 100%; }

/* ===== CARD ===== */
.card {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 28px;
  box-shadow: 0 2px 10px rgba(0,0,0,.05);
}
.card-title {
  font-size: 1.1rem; font-weight: 600; color: var(--primary);
  margin-bottom: 22px; padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
}
.kundli-title-info {
  min-width: 0;
}
.kundli-main-title {
  display: flex;
  align-items: center;
  gap: 8px;
}
.kundli-subtitle {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 4px;
  color: var(--text-light);
  font-size: .76rem;
  font-weight: 400;
}

/* ===== FORM ===== */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; }
.form-row.single { grid-template-columns: 1fr; }
.form-row.triple { grid-template-columns: 1fr 1fr 1fr; }

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: .82rem; font-weight: 500; color: var(--text); }

.form-group input, .form-group select, .form-group textarea {
  padding: 9px 12px; border: 1.5px solid var(--border);
  border-radius: 7px; font-family: inherit; font-size: .9rem;
  color: var(--text); background: var(--white);
  transition: border-color .2s;
  outline: none;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--primary);
}
.form-group textarea { resize: vertical; min-height: 80px; }

.field-label {
  font-size: .75rem; color: var(--text-light);
  font-weight: 500; letter-spacing: .3px;
}

.dob-group { display: flex; gap: 8px; }
.dob-group select { flex: 1; }

.time-group { display: flex; gap: 8px; align-items: center; }
.time-group input { flex: 1; }
.time-sep { color: var(--text-light); font-weight: 600; }

.btn-primary {
  background: var(--primary); color: #fff;
  border: none; padding: 10px 28px; border-radius: 7px;
  font-family: inherit; font-size: .9rem; font-weight: 500;
  cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
  transition: background .2s;
}
.btn-primary:hover { background: var(--primary-dark); }

.btn-secondary {
  background: none; color: var(--primary);
  border: 1.5px solid var(--primary); padding: 10px 22px;
  border-radius: 7px; font-family: inherit; font-size: .9rem;
  cursor: pointer; transition: all .2s;
}
.btn-secondary:hover { background: var(--primary); color: #fff; }

.form-actions { display: flex; gap: 12px; margin-top: 24px; }

/* ===== LOGIN ===== */
.login-page {
  min-height: 100vh; display: flex; align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #fdf2ec 0%, #f5f0eb 100%);
}

.login-box {
  width: 100%; max-width: 400px;
  background: var(--white); border-radius: 14px;
  border: 2px solid var(--primary);
  padding: 40px 36px;
  box-shadow: 0 8px 32px rgba(196,77,36,.12);
}

.login-logo {
  text-align: center; margin-bottom: 28px;
}
.login-logo .circle {
  width: 64px; height: 64px; border-radius: 50%;
  background: #fdf2ec; border: 2px solid var(--primary-light);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 12px;
}
.login-logo h1 { font-size: 1.3rem; font-weight: 600; color: var(--primary); }
.login-logo p { font-size: .8rem; color: var(--text-light); margin-top: 2px; }

.login-box .form-group { margin-bottom: 16px; }
.login-box .btn-primary { width: 100%; justify-content: center; margin-top: 8px; }

/* ===== DASHBOARD ===== */
.kundli-grid {
  display: grid;
  grid-template-columns: 42% 58%;
  gap: 16px;
}

.left-panel {
  display: flex; flex-direction: column; align-items: center;
  border-right: 1px dashed var(--border);
  padding-right: 16px;
}

.right-panel { display: flex; flex-direction: column; gap: 14px; padding-right: 16px; }
.right-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }

.kundli-wrapper { text-align: center; color: var(--primary); width: 100%; }
.kundli-title { margin-top: 6px; font-size: .82rem; font-weight: 500; color: var(--text); }

.svg-chart {
  width: 90%; height: auto;
  border: 2px solid var(--primary); border-radius: 8px;
  padding: 4px; background: #fff;
  box-shadow: inset 0 0 0 2px var(--primary-light);
}
.kundli-small .svg-chart { width: 90%; }

.panchang-section { width: 100%; margin-top: 24px; }

.section-header {
  text-align: center; color: var(--primary);
  font-size: 1rem; font-weight: 600;
  border-bottom: 1px solid var(--primary);
  padding-bottom: 6px; margin-bottom: 14px;
}

.panchang-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; font-size: .82rem; }
.panchang-column { border-left: 2px solid var(--border); padding-left: 10px; }
.panchang-column.no-border { border-left: none; }
.panchang-row { display: flex; justify-content: space-between; margin-bottom: 7px; }
.panchang-row span:last-child { color: var(--primary); font-weight: 500; }
.date-header { font-size: .75rem; color: var(--text-light); display: block; margin-bottom: 10px; border-bottom: 1px solid var(--border); padding-bottom: 5px; }

.dasha-panel {
  width: auto;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
  margin-right: 0;
}
.dasha-panel-wrap {
  min-width: 0;
  padding-right: 0;
  margin-right: 16px;
}
.dasha-header {
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.dasha-view-btn {
  flex-shrink: 0;
  border: 1px solid var(--primary);
  background: #fff;
  color: var(--primary);
  border-radius: 5px;
  padding: 4px 9px;
  font-size: .72rem;
  font-weight: 500;
  line-height: 1.2;
}
.dasha-view-btn:hover { background: var(--primary); color: #fff; }
.dasha-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: .76rem;
  margin-bottom: 0;
  table-layout: fixed;
}
.dasha-table th, .dasha-table td {
  border: 1px solid var(--border);
  padding: 7px 8px;
  color: var(--text);
  vertical-align: middle;
  overflow-wrap: anywhere;
}
.dasha-table th {
  font-weight: 600;
  color: var(--primary);
  background: #fdf2ec;
}
.dasha-current-table th:first-child,
.dasha-current-table td:first-child { width: 27%; }
.dasha-current-table th:nth-child(2),
.dasha-current-table td:nth-child(2) {
  width: 18%;
  text-align: center;
  color: var(--primary);
  font-weight: 600;
}
.current-paryantar-row td { background: #fff8e8; }
.lal-kitab-arse {
  margin-top: 12px;
}
.lal-kitab-title {
  color: var(--primary);
  font-size: .82rem;
  font-weight: 600;
  margin-bottom: 6px;
}
.lal-kitab-table {
  font-size: .74rem;
}
.lal-kitab-table td:first-child {
  width: 38px;
  text-align: center;
  color: var(--primary);
  font-weight: 600;
}
.dasha-empty {
  border: 1px dashed var(--border);
  border-radius: 7px;
  padding: 12px;
  color: var(--text-light);
  font-size: .82rem;
  text-align: center;
}

/* ===== ALERTS ===== */
.alert { padding: 12px 16px; border-radius: 7px; margin-bottom: 18px; font-size: .88rem; display: flex; align-items: center; gap: 8px; }
.alert-error { background: #fef2f2; border: 1px solid #fca5a5; color: #b91c1c; }
.alert-success { background: #f0fdf4; border: 1px solid #86efac; color: #166534; }

/* ===== ICON BTN ===== */
.icon-btn {
  background: none; border: none; cursor: pointer;
  color: var(--primary); padding: 2px 4px;
  display: inline-flex; align-items: center;
  border-radius: 4px; transition: background .15s;
  flex-shrink: 0;
}
.icon-btn:hover { background: #fdf2ec; }
.kundli-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.kundli-action-btn {
  width: 30px;
  height: 30px;
  justify-content: center;
  border: 1px solid var(--border);
  background: #fff;
}
.kundli-action-btn.is-loading {
  opacity: .55;
  pointer-events: none;
}
.chart-loading {
  opacity: .45;
  transition: opacity .15s;
}

/* ===== TITLE BARS ===== */
.kundli-title-bar {
  display: flex; align-items: center; justify-content: center;
  gap: 6px; margin-top: 6px;
  font-size: .82rem; font-weight: 500; color: var(--text);
}

.section-header-bar {
  display: flex; align-items: center; justify-content: center;
  gap: 6px; color: var(--primary);
  font-size: 1rem; font-weight: 600;
  border-bottom: 1px solid var(--primary);
  padding-bottom: 6px; margin-bottom: 14px;
}

/* ===== POPUP ===== */
.popup-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.4);
  display: flex; align-items: center; justify-content: center;
  visibility: hidden; opacity: 0;
  transition: opacity .2s, visibility .2s;
}
.popup-overlay.show { visibility: visible; opacity: 1; }

.popup-box {
  background: var(--white); border-radius: 10px;
  border: 2px solid var(--primary);
  width: 90%; max-width: 640px; max-height: 80vh;
  display: flex; flex-direction: column;
  box-shadow: 0 8px 32px rgba(0,0,0,.18);
}

.popup-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 600; font-size: .95rem; color: var(--primary);
  flex-shrink: 0;
}
.popup-header button {
  background: none; border: none; cursor: pointer;
  color: var(--text-light); display: flex; align-items: center;
  padding: 2px; border-radius: 4px; transition: color .15s;
}
.popup-header button:hover { color: var(--primary); }

.popup-body { overflow-y: auto; padding: 16px; }

.popup-table {
  width: 100%; border-collapse: collapse; font-size: .85rem;
}
.popup-table th, .popup-table td {
  border: 1px solid var(--border); padding: 8px 10px;
  text-align: center;
}
.popup-table thead tr { background: #fdf2ec; }
.popup-table th { color: var(--primary); font-weight: 600; }
.popup-table tbody tr:nth-child(even) { background: #fdf9f7; }
.popup-table td { color: var(--text); }
.dasha-popup-box { max-width: 760px; }
.brief-popup-box { max-width: 840px; }
.house-brief-popup-box { max-width: 780px; }
.pdf-preparing-overlay { z-index: 320; }
.pdf-preparing-box {
  max-width: 380px;
  align-items: center;
  text-align: center;
  padding: 28px 24px 24px;
  border-color: var(--primary);
}
.pdf-preparing-animation {
  position: relative;
  width: 74px;
  height: 74px;
  margin-bottom: 16px;
}
.pdf-preparing-animation span {
  position: absolute;
  inset: 0;
  border: 3px solid transparent;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: pdf-spin 1.2s linear infinite;
}
.pdf-preparing-animation span:nth-child(2) {
  inset: 9px;
  border-top-color: #2c3e50;
  animation-duration: 1.6s;
  animation-direction: reverse;
}
.pdf-preparing-animation span:nth-child(3) {
  inset: 21px;
  border-top-color: #f0a36f;
  animation-duration: .9s;
}
.pdf-preparing-title {
  color: var(--primary);
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 8px;
}
.pdf-preparing-text {
  color: var(--text);
  font-size: .88rem;
  line-height: 1.5;
  min-height: 38px;
}
.pdf-preparing-bar {
  width: 100%;
  height: 5px;
  overflow: hidden;
  border-radius: 99px;
  background: #f3e2d9;
  margin-top: 18px;
}
.pdf-preparing-bar span {
  display: block;
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
  animation: pdf-progress 1.35s ease-in-out infinite;
}
@keyframes pdf-spin {
  to { transform: rotate(360deg); }
}
@keyframes pdf-progress {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(260%); }
}
.brief-kundli-body {
  color: var(--text);
  font-size: .86rem;
  line-height: 1.65;
}
.brief-kundli-body table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 12px;
}
.brief-kundli-body th,
.brief-kundli-body td {
  border: 1px solid var(--border);
  padding: 7px 9px;
  vertical-align: top;
}
.brief-kundli-body th {
  background: #fdf2ec;
  color: var(--primary);
  font-weight: 600;
}
.brief-kundli-body h1,
.brief-kundli-body h2,
.brief-kundli-body h3,
.brief-kundli-body .section-title {
  color: var(--primary);
  font-size: 1rem;
  font-weight: 600;
  margin: 12px 0 8px;
}
.house-brief-body {
  color: var(--text);
  font-size: .88rem;
  line-height: 1.65;
}
.house-brief-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.house-brief-meta span {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fdf9f7;
  padding: 5px 9px;
  color: var(--text-light);
}
.house-brief-meta strong { color: var(--primary); }
.house-brief-item {
  border-top: 1px solid var(--border);
  padding-top: 12px;
  margin-top: 12px;
}
.house-brief-item:first-of-type {
  border-top: none;
  padding-top: 0;
}
.house-brief-item h3 {
  color: var(--primary);
  font-size: .95rem;
  font-weight: 600;
  margin: 0 0 7px;
}
.house-brief-category {
  margin-top: 10px;
}
.house-brief-category h4 {
  color: var(--text);
  background: #fdf2ec;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: .82rem;
  font-weight: 600;
  margin: 0 0 8px;
  padding: 5px 8px;
}
.house-brief-text p {
  margin: 0 0 8px;
}
.house-brief-empty {
  border: 1px dashed var(--border);
  border-radius: 7px;
  padding: 12px;
  color: var(--text-light);
  text-align: center;
}
.dasha-popup-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  font-size: .84rem;
}
.dasha-popup-summary span {
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 5px 8px;
  background: #fffaf7;
}
.dasha-full-table .is-current-dasha td {
  background: #fff4d8;
  color: var(--primary);
  font-weight: 600;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 700px) {
  .form-row, .form-row.triple { grid-template-columns: 1fr; }
  .kundli-grid { grid-template-columns: 1fr; height: auto; }
  .left-panel { border-right: none; border-bottom: 1px dashed var(--border); padding-right: 0; padding-bottom: 20px; }
  .right-panel { padding-right: 0; }
  .right-row { grid-template-columns: 1fr; }
  .dasha-panel-wrap { margin-right: 0; padding-right: 0; }
  .dasha-panel { margin-right: 0; }
}
