/**
 * Chart CSS - Styles for birth chart display and AI analysis
 * Extracted from index.html
 */

/* Chart Summary Grid */
.chart-summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.ascendant-box,
.rashi-box {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 12px 15px;
    border-radius: 8px;
    color: white;
}

.ascendant-box h3,
.rashi-box h3 {
    font-size: 14px;
    margin: 0 0 6px 0;
    font-weight: 600;
}

.ascendant-box p,
.rashi-box p {
    font-size: 13px;
    margin: 0;
    line-height: 1.4;
}

.rashi-box {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

/* Mobile responsiveness for chart grid */
@media (max-width: 500px) {
    .chart-summary-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
}

/* AI Section */
.ai-section {
    margin-top: 40px;
    padding: 25px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 1px solid #e9ecef;
}

.ai-section h3 {
    margin-top: 0;
    color: #333;
    border-bottom: 2px solid #667eea;
    padding-bottom: 10px;
}

/* Tab Navigation */
.ai-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    border-bottom: 2px solid #e9ecef;
}

.ai-tab {
    padding: 12px 24px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #666;
    position: relative;
    transition: all 0.3s ease;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}

.ai-tab:hover {
    color: #667eea;
    background: rgba(102, 126, 234, 0.05);
}

.ai-tab.active {
    color: #667eea;
    border-bottom-color: #667eea;
    background: rgba(102, 126, 234, 0.08);
}

/* Tab Content */
.ai-tab-content {
    display: none;
    padding: 20px 0;
    animation: fadeIn 0.3s ease;
}

.ai-tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Export Section */
.export-section {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #ddd;
}

.ai-controls {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.ai-controls .form-group {
    margin-bottom: 0;
}

.ai-controls select,
.ai-controls input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

/* AI Buttons */
.ai-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.ai-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.ai-btn.primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.ai-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.ai-btn.secondary {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
}

.ai-btn.secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(17, 153, 142, 0.4);
}

.ai-btn.export {
    background: linear-gradient(135deg, #eb3349 0%, #f45c43 100%);
    color: white;
}

.ai-btn.export:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(235, 51, 73, 0.4);
}

.ai-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* AI Result */
.ai-result {
    background: white;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    margin-bottom: 20px;
}

.ai-result h4 {
    margin-top: 0;
    color: #667eea;
}

/* Analysis Content */
.analysis-content {
    line-height: 1.8;
    color: #333;
}

/* Analysis Headings */
.analysis-content .analysis-h2,
.analysis-content .analysis-h3,
.analysis-content .analysis-h4 {
    margin-top: 24px;
    margin-bottom: 12px;
    font-weight: 600;
}

.analysis-content .analysis-h2 {
    font-size: 1.3rem;
    color: #667eea;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 8px;
}

.analysis-content .analysis-h3 {
    font-size: 1.15rem;
    color: #764ba2;
    display: flex;
    align-items: center;
    gap: 8px;
}

.analysis-content .analysis-h4 {
    font-size: 1rem;
    color: #5a67d8;
}

/* Analysis Lists */
.analysis-content .analysis-ul {
    list-style: none;
    padding-left: 0;
    margin: 12px 0;
}

.analysis-content .analysis-li {
    position: relative;
    padding-left: 24px;
    margin-bottom: 8px;
    line-height: 1.6;
}

.analysis-content .analysis-li::before {
    content: "•";
    position: absolute;
    left: 8px;
    color: #667eea;
    font-weight: bold;
}

/* Analysis Paragraphs */
.analysis-content .analysis-p {
    margin: 12px 0;
    line-height: 1.75;
}

/* Analysis Horizontal Rule */
.analysis-content .analysis-hr {
    border: none;
    height: 1px;
    background: linear-gradient(90deg, transparent, #e9ecef, transparent);
    margin: 20px 0;
}

/* Bold and Emphasis */
.analysis-content strong {
    color: #764ba2;
    font-weight: 600;
}

.analysis-content em {
    color: #5a67d8;
    font-style: italic;
}

/* Question Section */
.question-section {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #ddd;
}

.question-section h4 {
    margin-top: 0;
    color: #333;
}

.question-input-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    resize: vertical;
    font-family: inherit;
    margin-bottom: 15px;
}

.question-input-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Location Search Autocomplete */
.location-search-container {
    position: relative;
    margin-bottom: 20px;
}

.location-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 5px 5px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.location-results.hidden {
    display: none;
}

.location-result-item {
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s;
}

.location-result-item:hover {
    background-color: #f8f9fa;
}

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

.location-result-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.location-result-details {
    font-size: 0.9em;
    color: #666;
}

.location-loading {
    padding: 12px 15px;
    text-align: center;
    color: #666;
}

#location_search {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

#location_search:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Responsive Design */
@media (max-width: 768px) {
    .chart-summary-grid {
        grid-template-columns: 1fr;
    }

    .ai-controls {
        flex-direction: column;
    }

    /* AI Section Mobile Optimization */
    .ai-section {
        margin-top: 20px;
        padding: 15px;
    }

    .ai-tabs {
        flex-wrap: wrap;
    }

    .ai-tab {
        padding: 10px 15px;
        font-size: 13px;
        flex: 1;
        text-align: center;
    }

    /* Analysis content mobile */
    .reading-content,
    .question-answer-result {
        font-size: 14px;
        line-height: 1.6;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    .reading-content p,
    .question-answer-result p {
        margin-bottom: 12px;
    }

    /* AI controls mobile */
    .ai-controls .form-group {
        width: 100%;
    }

    /* Container padding mobile */
    .container {
        padding: 10px 15px;
    }

    /* Grid on mobile */
    .grid {
        grid-template-columns: 1fr !important;
    }
}

/* Coordinates Toggle - Subtle styling */
.coords-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 0;
    cursor: pointer;
    color: #888;
    font-size: 12px;
    user-select: none;
    transition: color 0.2s;
}

.coords-toggle:hover {
    color: #667eea;
}

.toggle-icon {
    font-size: 10px;
    transition: transform 0.2s;
}

.toggle-icon.expanded {
    transform: rotate(90deg);
}

.coords-section {
    padding: 10px 0;
    border-left: 2px solid #e5e7eb;
    padding-left: 15px;
    margin-left: 5px;
}

.coords-section.hidden {
    display: none;
}

/* Disabled input styling */
input:disabled,
input[readonly] {
    background-color: #f3f4f6 !important;
    color: #6b7280;
    cursor: not-allowed;
}

/* Required field indicator */
.required {
    color: #e53e3e;
    font-weight: bold;
    margin-left: 2px;
}

/* Validation warning box */
.validation-warning {
    background: linear-gradient(135deg, #fff3cd 0%, #ffe0a3 100%);
    border: 1px solid #ffc107;
    border-left: 4px solid #e67700;
    border-radius: 6px;
    padding: 12px 16px;
    margin-bottom: 15px;
    color: #856404;
    font-size: 14px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.validation-warning::before {
    content: "⚠️";
    font-size: 16px;
    flex-shrink: 0;
}

.validation-warning.hidden {
    display: none;
}

/* Invalid input highlighting */
input.invalid,
select.invalid {
    border-color: #e53e3e !important;
    box-shadow: 0 0 0 3px rgba(229, 62, 62, 0.15) !important;
}

input.invalid:focus,
select.invalid:focus {
    border-color: #e53e3e !important;
    box-shadow: 0 0 0 3px rgba(229, 62, 62, 0.25) !important;
}

/* ===== Chart/Table Tab Navigation ===== */
.chart-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 15px;
    border-bottom: 2px solid #e9ecef;
}

.chart-tab {
    padding: 10px 20px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #666;
    position: relative;
    transition: all 0.3s ease;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}

.chart-tab:hover {
    color: #667eea;
    background: rgba(102, 126, 234, 0.05);
}

.chart-tab.active {
    color: #667eea;
    border-bottom-color: #667eea;
    background: rgba(102, 126, 234, 0.08);
}

/* Chart Tab Content */
.chart-tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.chart-tab-content.active {
    display: block;
}

.chart-tab-content.hidden {
    display: none;
}

/* ===== Kundli Chart Container ===== */
.kundli-container {
    display: flex;
    gap: 30px;
    justify-content: center;
    flex-wrap: wrap;
    padding: 20px 0;
}

.kundli-chart-wrapper {
    text-align: center;
    flex: 0 1 280px;
}

.kundli-chart-wrapper h4 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 14px;
    font-weight: 600;
}

.kundli-chart {
    width: 100%;
    max-width: 280px;
    margin: 0 auto;
}

/* ===== Kundli SVG Styling ===== */
.kundli-svg {
    width: 100%;
    height: auto;
    background: #fefefe;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.kundli-outer {
    fill: #fefefe;
    stroke: #333;
    stroke-width: 2;
}

.kundli-lines path {
    stroke: #888;
    stroke-width: 1;
}

.kundli-planet {
    font-family: 'Segoe UI', Tahoma, sans-serif;
    font-weight: 600;
    fill: #333;
}

.kundli-house-num {
    font-size: 8px;
    fill: #bbb;
}

.kundli-asc {
    font-size: 10px;
    fill: #667eea;
    font-weight: 600;
}

/* ===== Mobile Responsive ===== */
@media (max-width: 600px) {
    .kundli-container {
        flex-direction: column;
        align-items: center;
        gap: 20px;
    }

    .kundli-chart-wrapper {
        flex: 1 1 100%;
        max-width: 300px;
    }

    .chart-tab {
        padding: 8px 15px;
        font-size: 13px;
        flex: 1;
        text-align: center;
    }
}

/* ===== Field-level Error Messages ===== */
.field-error-message {
    color: #e53e3e;
    font-size: 12px;
    margin-top: 4px;
    display: none;
}

.field-error-message.visible {
    display: block;
}

/* ===== Developer Helper Button ===== */
.dev-helper-btn {
    position: fixed;
    bottom: 15px;
    right: 15px;
    background: #6b7280;
    color: white;
    padding: 6px 12px;
    font-size: 11px;
    border-radius: 4px;
    cursor: pointer;
    z-index: 1000;
    opacity: 0.6;
    border: none;
    transition: opacity 0.2s, background 0.2s;
}

.dev-helper-btn:hover {
    opacity: 1;
    background: #4b5563;
    transform: none;
}

/* Download Chart Button */
.download-chart-btn {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    border: none;
    transition: transform 0.2s, box-shadow 0.2s;
    margin-left: auto;
}

.download-chart-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

/* Make chart-tabs flex container for download button alignment */
.chart-tabs {
    display: flex;
    align-items: center;
}

@media (max-width: 600px) {
    .download-chart-btn {
        padding: 6px 10px;
        font-size: 11px;
    }
}