/* =======================================
   CSS VARIABLES & MODERN RESET
======================================= */
:root {
    --hd-primary:      #225F75;
    --hd-primary-dark: #1b4e61;
    --hd-accent:       #e67e22;
    --hd-bg:           #f8fafc;
    --hd-card-bg:      #ffffff;
    --hd-text-main:    #334155;
    --hd-text-muted:   #64748b;
    --hd-border:       #e2e8f0;
    --hd-shadow:       0 10px 15px -3px rgba(0,0,0,.10), 0 4px 6px -2px rgba(0,0,0,.05);
    --hd-shadow-sm:    0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
    --hd-radius:       12px;
    --hd-radius-sm:    8px;
}
* { box-sizing: border-box; }

/* =======================================
   DASHBOARD CONTAINER
======================================= */
.hd-dashboard {
    max-width: 850px;
    margin: 40px auto;
    padding: 0 20px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--hd-text-main);
    background-color: var(--hd-bg);
    transition: max-width 0.35s ease;
}

/* =======================================
   USER INFO CARD
======================================= */
.hd-user-info {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 24px;
    padding: 16px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid var(--hd-border);
    align-items: center;
    font-size: 14px;
    font-family: 'Inter', -apple-system, sans-serif;
    color: var(--hd-text-main);
}

.hd-user-info strong {
    color: var(--hd-primary);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: block;
}

/* =======================================
   TAB NAVIGATION
======================================= */
.hd-tab-nav {
    display: flex;
    gap: 8px;
    background: #f1f5f9;
    padding: 6px;
    border-radius: 10px;
    margin-bottom: 30px;
    width: fit-content;
}

.hd-tab-btn {
    padding: 10px 24px;
    font-size: 15px;
    font-weight: 600;
    color: var(--hd-text-muted);
    border-radius: 8px;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}

.hd-tab-btn:hover { color: var(--hd-primary); }

.hd-tab-btn.active {
    background: #fff;
    color: var(--hd-primary);
    box-shadow: 0 4px 6px -1px rgba(0,0,0,.10);
}

/* =======================================
   LAYOUT CONTAINER
======================================= */
.hd-layout-container { display: block; width: 100%; }

/* =======================================
   SECTION CARDS
======================================= */
.hd-section {
    background: var(--hd-card-bg);
    border: 1px solid var(--hd-border);
    border-radius: var(--hd-radius);
    box-shadow: var(--hd-shadow-sm);
    padding: 28px;
    margin-bottom: 24px;
}

/* =======================================
   RESULT PAGE — SECTION TITLES
======================================= */
.hd-section-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--hd-primary);
    margin-bottom: 16px;
    margin-top: 0;
    text-align: center;
}

/* =======================================
   RESULTS CARD
======================================= */
.hd-results-content {
    background: #fff;
    border: 1px solid var(--hd-border);
    border-radius: var(--hd-radius);
    padding: 30px;
    margin-top: 20px;
    box-shadow: var(--hd-shadow);
    font-family: 'Inter', -apple-system, sans-serif;
}

.hd-results-content h2,
.hd-dashboard h2 {
    color: var(--hd-primary);
    font-family: 'Inter', -apple-system, sans-serif;
    margin-bottom: 20px;
}

.hd-results-content h3,
.hd-dashboard h3 {
    color: var(--hd-primary);
    font-family: 'Inter', -apple-system, sans-serif;
    margin: 24px 0 10px;
}

/* =======================================
   TABLES
======================================= */
.hd-fields-table,
.hd-gates-table,
.hd-channels-table,
.hd-centers-table,
.hd-planets-table,
.hd-business-table,
.astro-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    margin-bottom: 2rem;
    font-size: 1rem;
    font-family: 'Inter', -apple-system, sans-serif;
    background: #ffffff;
}

.hd-fields-table th,
.hd-gates-table th,
.hd-channels-table th,
.hd-centers-table th,
.hd-planets-table th,
.hd-business-table th,
.astro-table th {
    background-color: #f2f2f2;
    font-weight: 600;
    color: var(--hd-text-main);
    border: 1px solid #ddd;
    padding: 0.75rem;
    text-align: left;
}

.hd-fields-table td,
.hd-gates-table td,
.hd-channels-table td,
.hd-centers-table td,
.hd-planets-table td,
.hd-business-table td,
.astro-table td {
    border: 1px solid #ddd;
    padding: 0.75rem;
    text-align: left;
    vertical-align: middle;
    line-height: 1.5;
}

.hd-fields-table tr:nth-child(even),
.hd-gates-table tr:nth-child(even),
.hd-channels-table tr:nth-child(even),
.hd-centers-table tr:nth-child(even),
.hd-planets-table tr:nth-child(even),
.hd-business-table tr:nth-child(even),
.astro-table tr:nth-child(even) { background-color: #f9f9f9; }

.hd-fields-table tr:hover,
.hd-gates-table tr:hover,
.hd-channels-table tr:hover,
.hd-centers-table tr:hover,
.hd-planets-table tr:hover,
.hd-business-table tr:hover,
.astro-table tr:hover { background-color: #f1f5f9; }

/* Locked rows */
.hd-fields-table tr.row-locked td {
    filter: blur(4px);
    user-select: none;
    pointer-events: none;
    color: var(--hd-text-muted);
}
.hd-fields-table tr.row-locked { background: #f8fafc; opacity: 0.7; }
.hd-fields-table tr.row-locked td:first-child { filter: none; color: var(--hd-text-muted); font-style: italic; }

/* =======================================
   BUTTONS & ACTIONS
======================================= */
.hd-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
    margin-bottom: 30px;
}

.hd-buttons form,
.hd-buttons #ft-button-container { margin: 0; display: inline-block; }

.hd-btn {
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 24px;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    border-radius: 8px;
    border: none;
    background-color: var(--hd-primary);
    color: #fff !important;
    cursor: pointer;
    width: 260px;
    min-height: 52px;
    box-sizing: border-box;
    text-align: center;
    box-shadow: 0 2px 6px rgba(34,95,117,.18);
    transition: all 0.3s ease;
    line-height: 1.4;
    outline: none;
}

.hd-btn:hover {
    background-color: var(--hd-primary-dark);
    box-shadow: 0 6px 16px rgba(34,95,117,.28);
    transform: translateY(-2px);
    color: #fff !important;
    text-decoration: none;
}

.hd-btn:active { box-shadow: none; transform: translateY(0); }

.full-report-btn {
    background: #0A9BC3;
    color: #ffffff !important;
    padding: 18px 35px;
    font-size: 1.1rem;
    font-weight: bold;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    width: 100%;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(98,0,234,.3);
}

.full-report-btn:hover {
    background: #284B64;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(98,0,234,.4);
}

.hd-full-report-cta { margin: 24px 0 16px; }

.hd-btn-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: transparent;
    color: var(--hd-primary);
    border: 2px solid var(--hd-primary);
    padding: 12px 28px;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    outline: none;
    margin-top: 20px;
}

.hd-btn-outline:hover {
    background-color: var(--hd-primary);
    color: #ffffff !important;
    box-shadow: 0 8px 15px rgba(34,95,117,.2);
    transform: translateY(-2px);
}

.hd-btn-outline:active { transform: translateY(0); box-shadow: none; }

.hd-btn-outline::before {
    content: '←';
    margin-right: 8px;
    font-weight: bold;
    transition: transform 0.2s ease;
}

.hd-btn-outline:hover::before { transform: translateX(-3px); }

#ft-checkout-btn { background: var(--hd-accent) !important; box-shadow: rgba(230,126,34,.20) 0 4px 9px !important; }
#ft-checkout-btn:hover { background: #cf6d17 !important; }

/* =======================================
   LINKS
======================================= */
.hd-link { color: var(--hd-primary); text-decoration: underline; transition: color 0.2s ease; }
.hd-link:hover { color: var(--hd-primary-dark); }

/* =======================================
   PDF BUTTON
======================================= */
.pdf-btn {
    display: inline-block;
    margin-top: 20px;
    padding: 14px 28px;
    background: var(--hd-primary);
    color: #fff;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 700;
    font-size: 15px;
    font-family: 'Inter', -apple-system, sans-serif;
    transition: all 0.3s ease;
    box-shadow: rgba(34,95,117,.2) 0 4px 9px;
}

.pdf-btn:hover {
    background: var(--hd-primary-dark);
    transform: translateY(-2px);
    box-shadow: rgba(34,95,117,.3) 0 8px 15px;
    color: #fff;
    text-decoration: none;
}

/* =======================================
   BODYGRAPH LOADING SPINNER
======================================= */
.hd-spinner {
    width: 56px;
    height: 56px;
    border: 5px solid #e2e8f0;
    border-top-color: #225F75;
    border-radius: 50%;
    animation: hd-spin 0.85s linear infinite;
    margin: 0 auto 24px;
}

@keyframes hd-spin { to { transform: rotate(360deg); } }

.hd-loading-dots span {
    display: inline-block;
    width: 6px;
    height: 6px;
    margin: 0 3px;
    background: #225F75;
    border-radius: 50%;
    animation: hd-bounce 1.2s ease-in-out infinite;
}

.hd-loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.hd-loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes hd-bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40%            { transform: scale(1);   opacity: 1; }
}

/* =======================================
   BODYGRAPH SVG
======================================= */
.bodygraph-svg {
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    display: block;
}

.bodygraph-svg svg { width: 100% !important; height: auto !important; }

.bodygraph-svg-scaled { max-width: 300px; margin: 0 auto; }
.bodygraph-svg-scaled svg { width: 100% !important; height: auto !important; }

/* =======================================
   FULL REPORT GRID
======================================= */
.hd-full-grid {
    display: flex;
    flex-wrap: nowrap;
    justify-content: center;
    align-items: flex-start;
    gap: 5px;
}

.hd-planet-col {
    flex: 0 0 auto;
    min-width: 0;
}

.hd-chart-center {
    flex: 0 0 auto;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hd-planetary-table { width: 100%; border-collapse: collapse; }

.hd-planetary-table td {
    padding: 8px 2px;
    border: none !important;
    font-size: 1.1rem;
    vertical-align: middle;
}

/* Planetary columns */
.design-col { color: #d32f2f; }
.design-col .symbol { font-size: 1.3rem; }
.design-col .gate-val { font-weight: bold; padding-left: 8px; text-align: left; }

.personality-col { color: #222; }
.personality-col .symbol { font-size: 1.3rem; text-align: right; }
.personality-col .gate-val { font-weight: bold; padding-right: 8px; text-align: right; }

.arrow-val { width: 12px; font-size: 0.9rem; font-weight: 900; color: #94a3b8; }

.col-title { font-size: 13px; text-align: center; margin-bottom: 5px; color: var(--hd-text-muted); font-weight: 700; }

/* =======================================
   ASTROLOGY STYLES
======================================= */
.astro-svg-section .astro-svg-wrap {
    max-width: 600px; margin: 0 auto;
    background: #fff9f1; border-radius: 12px;
    padding: 16px; box-shadow: 0 2px 12px rgba(0,0,0,.07); overflow: hidden;
}
.astro-svg-wrap svg { width: 100%; height: auto; display: block; }

.astro-desc-cell { font-size: 12px; color: #64748b; max-width: 320px; line-height: 1.5; }

.asp-badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.asp-conjunction { background: #e0f2fe; color: #0369a1; }
.asp-opposition  { background: #fee2e2; color: #dc2626; }
.asp-trine       { background: #dcfce7; color: #16a34a; }
.asp-square      { background: #fef9c3; color: #ca8a04; }
.asp-sextile     { background: #ede9fe; color: #7c3aed; }
.asp-quintile    { background: #fdf4ff; color: #a21caf; }
.asp-quincunx    { background: #fff7ed; color: #c2410c; }
.asp-other       { background: #f1f5f9; color: #475569; }

/* =======================================
   FORM WRAPPER & FIELDS
======================================= */
.hd-chart-form-wrapper {
    max-width: 650px;
    margin: 40px auto;
    background: #fff;
    padding: 40px;
    border-radius: var(--hd-radius);
    border: 1px solid var(--hd-border);
    box-shadow: var(--hd-shadow);
}

.hd-form { display: flex; flex-direction: column; gap: 20px; }

.hd-form label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--hd-text-main);
    margin-bottom: 8px;
}

.hd-form input[type="text"],
.hd-form input[type="email"],
.hd-form input[type="time"],
.hd-form input[type="datetime-local"] {
    width: 100%;
    padding: 14px 16px;
    font-size: 16px;
    border: 1px solid var(--hd-border);
    border-radius: var(--hd-radius-sm);
    background-color: #f8fafc;
    color: var(--hd-text-main);
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.hd-form input:focus {
    outline: none;
    border-color: var(--hd-primary);
    background-color: #fff;
    box-shadow: 0 0 0 4px rgba(34,95,117,.10);
}

/* DATE DROPDOWNS */
.hd-inline-fields {
    display: grid;
    grid-template-columns: 2fr 2fr 1fr;
    gap: 10px;
    margin-top: 6px;
}

.hd-form select {
    width: 100%;
    padding: 14px 16px;
    font-size: 16px;
    border: 1px solid var(--hd-border);
    border-radius: var(--hd-radius-sm);
    background-color: #f8fafc;
    color: var(--hd-text-main);
    transition: all 0.2s ease;
    box-sizing: border-box;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2364748b' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
    cursor: pointer;
}

.hd-form select:focus {
    outline: none;
    border-color: var(--hd-primary);
    background-color: #fff;
    box-shadow: 0 0 0 4px rgba(34,95,117,.10);
}

/* =======================================
   CHECKBOX & CONFIRMATION
======================================= */
.hd-confirm-label {
    background: #f1f5f9;
    padding: 12px 16px;
    border-radius: var(--hd-radius-sm);
    font-size: 13px !important;
    font-weight: 500 !important;
    color: var(--hd-text-muted) !important;
    display: flex !important;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.hd-confirm-label:hover { background: #e2e8f0; }

.hd-confirm-label input[type="checkbox"] {
    margin-top: 3px;
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--hd-primary);
}

/* =======================================
   LOCATION AUTOCOMPLETE
======================================= */
label:has(#hd_location) { position: relative; }

.hd-suggestions {
    position: absolute;
    top: 100%; left: 0; right: 0;
    background: #fff;
    border: 1px solid var(--hd-border);
    border-top: none;
    border-radius: 0 0 var(--hd-radius-sm) var(--hd-radius-sm);
    box-shadow: 0 10px 25px rgba(0,0,0,.10);
    max-height: 250px;
    overflow-y: auto;
    z-index: 999;
}

.hd-suggestion-item {
    padding: 12px 16px;
    font-size: 14px;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.2s;
}

.hd-suggestion-item:last-child { border-bottom: none; }
.hd-suggestion-item:hover { background: #f8fafc; color: var(--hd-primary); }

/* =======================================
   SUBMIT BUTTON
======================================= */
.hd-form button[type="submit"] {
    width: 100%;
    background-color: var(--hd-primary);
    color: #fff;
    padding: 16px;
    font-size: 18px;
    font-weight: 700;
    border: none;
    border-radius: var(--hd-radius-sm);
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
    box-shadow: rgba(34,95,117,.20) 0 4px 9px;
}

.hd-form button[type="submit"]:hover {
    background-color: var(--hd-primary-dark);
    transform: translateY(-2px);
    box-shadow: rgba(34,95,117,.30) 0 8px 15px;
}

.hd-form button[type="submit"]:active { transform: translateY(0); }

/* =======================================
   RESPONSIVE
======================================= */
@media (max-width: 1100px) {
    .hd-layout-container { display: flex; flex-direction: column; gap: 20px; }
}

@media (max-width: 768px) {
    .hd-dashboard { padding: 0 12px; margin: 20px auto; }
    .hd-results-content { padding: 20px 16px; }
    .hd-user-info { gap: 16px; padding: 16px; }
    .hd-tab-nav { width: 100%; overflow-x: auto; }
    .hd-buttons { grid-template-columns: 1fr 1fr; }

    .hd-full-grid { gap: 2px; }
    .hd-planetary-table td { font-size: 0.7rem; padding: 3px 1px; }
    .col-title { font-size: 11px; text-align: center; margin-bottom: 5px; }
    .bodygraph-svg-scaled { max-width: 200px; }
    .symbol { font-size: 0.9rem !important; }
    .gate-val { font-size: 0.7rem !important; }
    .arrow-val { font-size: 0.7rem !important; }
}

@media (max-width: 600px) {
    .hd-user-info { flex-direction: column; align-items: flex-start; }
    .hd-tab-nav { width: 100%; overflow-x: auto; }
    .hd-buttons { flex-direction: column; align-items: center; }
    .hd-buttons .hd-btn { width: 100%; max-width: 260px; }
}

@media (max-width: 480px) {
    .hd-chart-form-wrapper { padding: 25px 20px; margin: 20px; }
    .hd-form button[type="submit"] { font-size: 16px; }
    .hd-inline-fields { grid-template-columns: 1fr 1fr; }
    .hd-inline-fields select:last-child { grid-column: 1 / -1; }

    @media (max-width: 640px) { .astro-desc-col { display: none; } }
}