/* Base Styles */
:root {
    --primary-color: #6c5ce7;
    --primary-dark: #5849c2;
    --secondary-color: #fd79a8;
    --accent-color: #00cec9;
    --warning-color: #fdcb6e;
    --danger-color: #e17055;
    --success-color: #00b894;
    --bg-dark: #1a1a2e;
    --bg-card: #16213e;
    --bg-lighter: #0f3460;
    --text-primary: #ffffff;
    --text-secondary: #b2bec3;
    --border-color: rgba(255, 255, 255, 0.1);
    --gradient-1: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-2: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-3: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

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

body {
    font-family: 'Kanit', sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    text-align: center;
    padding: 40px 20px;
    background: var(--gradient-1);
    border-radius: 20px;
    margin-bottom: 30px;
    box-shadow: 0 10px 40px rgba(102, 126, 234, 0.3);
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* Zodiac Selector */
.zodiac-selector {
    margin-bottom: 40px;
}

.zodiac-selector h2 {
    text-align: center;
    margin-bottom: 30px;
    font-size: 1.8rem;
}

.zodiac-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    max-width: 1000px;
    margin: 0 auto;
}

.zodiac-item {
    background: var(--bg-card);
    border-radius: 15px;
    padding: 25px 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.zodiac-item:hover {
    transform: translateY(-5px);
    border-color: var(--primary-color);
    box-shadow: 0 10px 30px rgba(108, 92, 231, 0.3);
}

.zodiac-item .icon {
    font-size: 3rem;
    margin-bottom: 10px;
    display: block;
}

.zodiac-item .name {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 5px;
}

.zodiac-item .dates {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Dashboard */
.dashboard {
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.dashboard-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
    padding: 20px;
    background: var(--bg-card);
    border-radius: 15px;
}

.back-btn {
    background: var(--bg-lighter);
    border: none;
    color: var(--text-primary);
    padding: 12px 20px;
    border-radius: 10px;
    cursor: pointer;
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.back-btn:hover {
    background: var(--primary-color);
}

.zodiac-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.zodiac-info .zodiac-icon {
    font-size: 3rem;
}

.zodiac-info h2 {
    font-size: 1.8rem;
    margin-bottom: 5px;
}

.date-range {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.dashboard-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

@media (max-width: 1024px) {
    .dashboard-content {
        grid-template-columns: 1fr;
    }
}

/* Chart Section */
.chart-section {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 30px;
}

.chart-section h3 {
    margin-bottom: 10px;
    font-size: 1.3rem;
}

.chart-hint {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.chart-container {
    position: relative;
    height: 400px;
}

/* Detail Panel */
.detail-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.detail-card {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 25px;
    min-height: 200px;
}

.detail-card h3 {
    margin-bottom: 15px;
    color: var(--accent-color);
    font-size: 1.2rem;
}

.placeholder-text {
    color: var(--text-secondary);
    font-style: italic;
}

.prediction-item {
    background: var(--bg-lighter);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 15px;
}

.prediction-item:last-child {
    margin-bottom: 0;
}

.prediction-source {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.source-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--gradient-1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.source-info .name {
    font-weight: 500;
    font-size: 0.95rem;
}

.source-info .title {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.prediction-text {
    font-size: 0.95rem;
    line-height: 1.7;
}

.score-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--primary-color);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    margin-top: 10px;
}

/* Dimension Buttons */
.dimension-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.dim-btn {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    color: var(--text-primary);
    padding: 12px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dim-btn:hover {
    border-color: var(--primary-color);
    background: var(--bg-lighter);
}

.dim-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

/* Conflict Section */
.conflict-section {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 25px;
    border-left: 4px solid var(--warning-color);
}

.conflict-section h3 {
    color: var(--warning-color);
    margin-bottom: 15px;
}

.conflict-item {
    background: rgba(253, 203, 110, 0.1);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 15px;
}

.conflict-item:last-child {
    margin-bottom: 0;
}

.conflict-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    font-weight: 500;
    color: var(--warning-color);
}

.conflict-sources {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 10px;
}

.conflict-source {
    background: var(--bg-lighter);
    padding: 12px;
    border-radius: 8px;
    font-size: 0.9rem;
}

.conflict-source .source-name {
    font-weight: 500;
    color: var(--accent-color);
    margin-bottom: 5px;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.btn {
    padding: 15px 30px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-primary {
    background: var(--gradient-1);
    color: white;
}

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

.btn-secondary {
    background: var(--gradient-2);
    color: white;
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(245, 87, 108, 0.4);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow-y: auto;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border-radius: 20px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(50px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-large {
    max-width: 900px;
}

.modal-card {
    max-width: 500px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-size: 1.4rem;
}

.close-btn {
    background: var(--bg-lighter);
    border: none;
    color: var(--text-primary);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: var(--danger-color);
}

.modal-body {
    padding: 25px;
}

/* Full Reading Styles */
.full-reading-section {
    margin-bottom: 30px;
    padding-bottom: 25px;
    border-bottom: 1px solid var(--border-color);
}

.full-reading-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.full-reading-section h3 {
    color: var(--accent-color);
    margin-bottom: 15px;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.full-reading-text {
    background: var(--bg-lighter);
    padding: 20px;
    border-radius: 12px;
    line-height: 1.8;
    margin-bottom: 15px;
}

.reading-reference {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Zodiac Card (Infographic) */
.card-preview-container {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
    overflow: auto;
}

.zodiac-card {
    width: 360px;
    height: 640px;
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    border-radius: 20px;
    padding: 30px 25px;
    color: white;
    position: relative;
    overflow: hidden;
}

.zodiac-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(108, 92, 231, 0.1) 0%, transparent 50%);
    animation: rotate 20s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.card-header {
    text-align: center;
    position: relative;
    z-index: 1;
    margin-bottom: 20px;
}

.card-icon {
    font-size: 4rem;
    margin-bottom: 10px;
}

.card-zodiac-name {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.card-date-range {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.card-year {
    font-size: 1rem;
    color: var(--accent-color);
    margin-top: 5px;
}

/* Overall Score Circle */
.card-overall {
    position: relative;
    z-index: 1;
    text-align: center;
    margin-bottom: 20px;
}

.card-overall-score {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    font-size: 2rem;
    font-weight: 700;
    border: 3px solid rgba(255, 255, 255, 0.3);
}

.card-overall-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 5px;
}

.card-scores {
    position: relative;
    z-index: 1;
    margin-bottom: 20px;
}

.card-score-item {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    font-size: 0.9rem;
}

.card-score-label {
    width: 80px;
}

.card-score-bar {
    flex: 1;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin: 0 10px;
}

.card-score-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.card-score-value {
    width: 30px;
    text-align: right;
    font-weight: 500;
}

.card-highlight {
    background: rgba(108, 92, 231, 0.3);
    border-radius: 15px;
    padding: 15px;
    text-align: center;
    position: relative;
    z-index: 1;
    margin-bottom: 20px;
}

.card-highlight-title {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.card-highlight-text {
    font-size: 1rem;
    line-height: 1.5;
}

.card-footer {
    position: absolute;
    bottom: 25px;
    left: 25px;
    right: 25px;
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-secondary);
    z-index: 1;
}

.card-actions {
    text-align: center;
}

.share-hint {
    margin-top: 15px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Footer */
footer {
    text-align: center;
    padding: 30px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 50px;
}

/* Responsive */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.8rem;
    }

    .zodiac-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }

    .zodiac-item {
        padding: 15px 10px;
    }

    .zodiac-item .icon {
        font-size: 2rem;
    }

    .zodiac-item .name {
        font-size: 0.9rem;
    }

    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .chart-container {
        height: 300px;
    }

    .action-buttons {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .conflict-sources {
        grid-template-columns: 1fr;
    }

    .zodiac-card {
        width: 320px;
        height: 580px;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-lighter);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* Loading Animation */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
}

.loading::after {
    content: '';
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Accessibility - Screen Reader Only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus States for Accessibility */
.zodiac-item:focus,
.btn:focus,
.dim-btn:focus,
.close-btn:focus,
.back-btn:focus {
    outline: 3px solid var(--accent-color);
    outline-offset: 2px;
}

.zodiac-item:focus-visible,
.btn:focus-visible,
.dim-btn:focus-visible,
.close-btn:focus-visible,
.back-btn:focus-visible {
    outline: 3px solid var(--accent-color);
    outline-offset: 2px;
}

/* Remove outline for mouse users */
.zodiac-item:focus:not(:focus-visible),
.btn:focus:not(:focus-visible),
.dim-btn:focus:not(:focus-visible),
.close-btn:focus:not(:focus-visible),
.back-btn:focus:not(:focus-visible) {
    outline: none;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Button disabled state */
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* Score color classes */
.score-good {
    border-color: var(--success-color) !important;
}

.score-bad {
    border-color: var(--danger-color) !important;
}

.score-neutral {
    border-color: var(--warning-color) !important;
}

.dim-btn .dim-score {
    margin-left: 8px;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.1);
}

.dim-btn.score-good .dim-score {
    background: rgba(0, 184, 148, 0.3);
    color: #00b894;
}

.dim-btn.score-bad .dim-score {
    background: rgba(225, 112, 85, 0.3);
    color: #e17055;
}

.score-badge.score-good {
    background: var(--success-color);
}

.score-badge.score-bad {
    background: var(--danger-color);
}

/* Conflict text styling */
.conflict-text {
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--text-secondary);
}
