/* Baby Name Numerology Calculator - Styles */

:root {
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --bg-primary: #f8fafc;
    --bg-card: #ffffff;
    --bg-input: #ffffff;
    --bg-header: #ffffff;
    --bg-footer: #f9fafb;
    --bg-table-header: #f8fafc;
    --bg-highlight: #f1f5f9;

    --text-primary: #111827;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --text-label: #374151;

    --border-color: #e2e8f0;
    --border-input: #d1d5db;
    --border-focus: #000000;

    --btn-primary-bg: #0f172a;
    --btn-primary-text: #ffffff;
    --btn-primary-hover: #1e293b;
    --btn-small-bg: #f1f5f9;
    --btn-small-text: #374151;

    --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-card-hover: 0 4px 12px rgba(0, 0, 0, 0.08);

    --sig-color: #059669;
    --warn-color: #d97706;
    --error-color: #dc2626;
    --accent-purple: #7c3aed;

    --radius: 8px;
    --radius-sm: 6px;
    --radius-xl: 12px;
}

html.dark {
    --bg-primary: #000000;
    --bg-card: #0a0a0a;
    --bg-input: #1a1a1a;
    --bg-header: #000000;
    --bg-footer: #000000;
    --bg-table-header: #111111;
    --bg-highlight: #1a1a1a;

    --text-primary: #f0f0f0;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --text-label: #d4d4d8;

    --border-color: #262626;
    --border-input: #404040;
    --border-focus: #f0f0f0;

    --btn-primary-bg: #f0f0f0;
    --btn-primary-text: #000000;
    --btn-primary-hover: #d4d4d4;
    --btn-small-bg: #1a1a1a;
    --btn-small-text: #d4d4d8;

    --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.2);
    --shadow-card-hover: 0 4px 12px rgba(0, 0, 0, 0.3);

    --sig-color: #10b981;
    --warn-color: #fbbf24;
    --error-color: #ef4444;
    --accent-purple: #a78bfa;
}

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

body {
    font-family: var(--font-family);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-size: 14px;
    line-height: 1.5;
}

/* Header */
.header {
    position: sticky;
    top: 0;
    z-index: 50;
    width: 100%;
    background: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    height: 56px;
    padding: 0 16px;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-container img { height: 28px; width: auto; }
.logo-light { display: block; }
.logo-dark { display: none; }
html.dark .logo-light { display: none; }
html.dark .logo-dark { display: block; }

.header-divider {
    width: 1px;
    height: 24px;
    background: var(--border-color);
}

.header-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.header-subtitle {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-left: -4px;
}

.header-spacer { flex: 1; }

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.status-ok { color: var(--sig-color); font-size: 0.78rem; }
.status-error { color: var(--error-color); font-size: 0.78rem; }

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.icon-btn:hover {
    background: var(--bg-highlight);
    color: var(--text-primary);
}

.icon-btn svg { width: 18px; height: 18px; }
.sun-icon { display: block; }
.moon-icon { display: none; }
html.dark .sun-icon { display: none; }
html.dark .moon-icon { display: block; }

/* Main */
.app-main {
    flex: 1;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 24px 16px;
}

/* Input Section */
.input-section { margin-bottom: 24px; }

.input-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 16px 20px;
    box-shadow: var(--shadow-card);
}

.input-field {
    height: 40px;
    padding: 8px 12px;
    border: 1px solid var(--border-input);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-family: var(--font-family);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-field:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.08);
}

html.dark .input-field:focus {
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1);
}

/* Form Layout */
.form-row {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-field label {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-field-location {
    flex: 1;
    min-width: 200px;
}

/* Location Search */
.location-search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.location-pin-icon {
    position: absolute;
    left: 10px;
    color: var(--text-muted);
    z-index: 1;
    pointer-events: none;
}

.location-input {
    padding-left: 32px !important;
    width: 100%;
}

.location-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-input);
    border-top: none;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    max-height: 220px;
    overflow-y: auto;
    z-index: 50;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.location-dropdown.active { display: block; }

.loc-item {
    padding: 8px 12px;
    font-size: 0.8rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    transition: background 0.15s;
    line-height: 1.4;
}

.loc-item:last-child { border-bottom: none; }
.loc-item:hover { background: var(--bg-highlight); }
.loc-empty { color: var(--text-muted); cursor: default; font-style: italic; }
.loc-empty:hover { background: none; }

/* Buttons */
.btn-primary {
    height: 40px;
    padding: 0 24px;
    background: var(--btn-primary-bg);
    color: var(--btn-primary-text);
    border: 1px solid var(--btn-primary-bg);
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font-family);
    white-space: nowrap;
    flex-shrink: 0;
}

.btn-primary:hover:not(:disabled) {
    background: var(--btn-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

/* Results Section */
.results-section {
    display: none;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
}

.results-section.visible {
    display: flex;
}

.result-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 16px 20px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-card);
}

.card-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Two column grid */
.two-col-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Nakshatra Info Card */
.nakshatra-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 16px;
}

.nakshatra-detail {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
}

.nakshatra-detail .detail-label {
    color: var(--text-secondary);
    font-weight: 500;
    min-width: 60px;
}

.nakshatra-detail .detail-value {
    font-weight: 600;
    color: var(--text-primary);
}

/* Syllable Pills */
.syllable-section {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.syllable-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.syllable-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.syllable-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 600;
    border: 1px solid var(--border-color);
    background: var(--bg-highlight);
    color: var(--text-primary);
    transition: all 0.2s;
}

.syllable-pill.active {
    background: var(--accent-purple);
    color: #ffffff;
    border-color: var(--accent-purple);
}

html.dark .syllable-pill.active {
    background: var(--accent-purple);
    color: #ffffff;
    border-color: var(--accent-purple);
}

/* Numerology Numbers */
.numerology-numbers {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.num-card {
    flex: 1;
    min-width: 140px;
    text-align: center;
    padding: 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    background: var(--bg-highlight);
}

.num-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--accent-purple);
    line-height: 1;
    margin-bottom: 4px;
}

.num-label {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 2px;
}

.num-meaning {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Lucky Numbers */
.lucky-numbers {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    align-items: center;
}

.lucky-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.lucky-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 0.82rem;
    font-weight: 700;
    background: var(--sig-color);
    color: #ffffff;
}

/* Name Checker Section */
.checker-section {
    display: none;
    margin-bottom: 24px;
}

.checker-section.visible { display: block; }

.checker-input-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    margin-bottom: 16px;
}

.checker-input-row .form-field {
    flex: 1;
}

.checker-input-row .input-field {
    height: 44px;
    font-size: 1rem;
}

/* Name Result Card */
.name-result {
    display: none;
    margin-top: 16px;
    margin-bottom: 16px;
}

.name-result.visible { display: block; }

.name-result-inner {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 20px;
    box-shadow: var(--shadow-card);
}

.name-result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.name-result-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.name-result-score {
    display: flex;
    align-items: center;
    gap: 8px;
}

.score-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 0.88rem;
    font-weight: 700;
}

.score-excellent {
    background: rgba(5, 150, 105, 0.12);
    color: var(--sig-color);
    border: 1px solid var(--sig-color);
}

.score-good {
    background: rgba(124, 58, 237, 0.1);
    color: var(--accent-purple);
    border: 1px solid var(--accent-purple);
}

.score-average {
    background: rgba(217, 119, 6, 0.1);
    color: var(--warn-color);
    border: 1px solid var(--warn-color);
}

.score-poor {
    background: rgba(220, 38, 38, 0.08);
    color: var(--error-color);
    border: 1px solid var(--error-color);
}

/* Check items grid */
.check-items {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.check-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 12px;
    border-radius: var(--radius);
    background: var(--bg-highlight);
    border: 1px solid var(--border-color);
}

.check-icon {
    font-size: 1rem;
    flex-shrink: 0;
    line-height: 1.4;
}

.check-content {
    flex: 1;
}

.check-label {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-secondary);
    display: block;
}

.check-value {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* History Table */
.history-section {
    display: none;
    margin-top: 16px;
}

.history-section.visible { display: block; }

.history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.history-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-primary);
}

.btn-clear {
    padding: 4px 12px;
    font-size: 0.72rem;
    font-weight: 500;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font-family);
}

.btn-clear:hover {
    background: var(--bg-highlight);
    color: var(--text-primary);
}

.history-table-wrapper {
    overflow-x: auto;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    overflow: hidden;
}

.history-table thead {
    background: var(--bg-table-header);
}

.history-table th {
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 0.72rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
}

.history-table th:hover {
    color: var(--text-primary);
}

.history-table th.sort-active {
    color: var(--accent-purple);
}

.history-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
    color: var(--text-primary);
}

.history-table tbody tr:hover {
    background: var(--bg-highlight);
}

.history-table tbody tr:last-child td {
    border-bottom: none;
}

.match-yes {
    color: var(--sig-color);
    font-weight: 600;
}

.match-partial {
    color: var(--warn-color);
    font-weight: 600;
}

.match-no {
    color: var(--text-muted);
}

/* Score Stars */
.score-stars {
    display: inline-flex;
    gap: 2px;
    color: var(--warn-color);
    font-size: 0.85rem;
}

.star-empty {
    color: var(--border-color);
}

/* Footer */
.app-footer {
    background: var(--bg-footer);
    color: var(--text-muted);
    text-align: center;
    padding: 12px;
    font-size: 0.7rem;
    border-top: 1px solid var(--border-color);
}

/* Responsive */
@media (max-width: 768px) {
    .header-inner {
        height: 48px;
        padding: 0 12px;
    }

    .header-subtitle { display: none; }

    .app-main { padding: 12px 10px; }
    .input-card { padding: 12px; }

    .form-row {
        flex-direction: column;
        gap: 8px;
    }

    .form-field-location { min-width: 100%; }

    .btn-primary {
        width: 100%;
        height: 42px;
    }

    .two-col-grid { grid-template-columns: 1fr; }

    .nakshatra-info { grid-template-columns: 1fr; }

    .numerology-numbers { flex-direction: column; }
    .num-card { min-width: 100%; }

    .check-items { grid-template-columns: 1fr; }

    .checker-input-row {
        flex-direction: column;
        gap: 8px;
    }

    .checker-input-row .btn-primary { width: 100%; }

    .result-card { padding: 12px 14px; }
}

@media (max-width: 480px) {
    .app-main { padding: 8px; }
    .input-card { padding: 10px; }

    .result-card { padding: 12px; border-radius: 10px; }

    .card-title { font-size: 0.78rem; }

    .name-result-inner { padding: 14px; }

    .history-table { font-size: 0.75rem; }
    .history-table th, .history-table td { padding: 8px 10px; }

    .app-footer { font-size: 0.6rem; padding: 8px; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
