/* ===================================
   PLAYLIST PSYCHOLOGIST - STYLES
   =================================== */

/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #667eea;
    --primary-dark: #5568d3;
    --secondary: #764ba2;
    --accent: #f093fb;
    
    --success: #28a745;
    --warning: #ffc107;
    --danger: #dc3545;
    --info: #17a2b8;
    
    --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --text-dark: #2d3748;
    --text-medium: #4a5568;
    --text-light: #718096;
    
    --bg-white: #ffffff;
    --bg-light: #f7fafc;
    --bg-medium: #edf2f7;
    
    --border: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.15);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    
    --transition: all 0.3s ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    color: var(--text-dark);
    background: var(--bg-gradient);
    min-height: 100vh;
    line-height: 1.6;
}

/* ===== CONTAINER ===== */
.container {
    max-width: 900px;
    margin: 0 auto;
    background: var(--bg-white);
    min-height: 100vh;
    box-shadow: var(--shadow-lg);
}

/* ===== HEADER ===== */
header {
    background: var(--bg-gradient);
    color: white;
    padding: 48px 32px;
    text-align: center;
    position: relative;
}

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

.tagline {
    font-size: 1.15rem;
    opacity: 0.95;
    font-style: italic;
    margin-bottom: 20px;
}

.header-nav {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin-top: 24px;
}

.nav-link {
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    background: rgba(255,255,255,0.15);
    border-radius: var(--radius-sm);
    transition: var(--transition);
    font-weight: 500;
}

.nav-link:hover {
    background: rgba(255,255,255,0.25);
    transform: translateY(-2px);
}

/* ===== SCREENS ===== */
#loading-screen,
#input-screen,
#analyzing-screen,
#results-screen {
    display: none;
    padding: 48px 32px;
}

#loading-screen.active {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
}

.loading-content {
    text-align: center;
}

.loading-content h2 {
    color: var(--primary);
    margin: 24px 0 8px;
    font-size: 1.5rem;
}

.loading-subtext {
    color: var(--text-light);
    font-size: 0.95rem;
}

/* ===== SPINNER ===== */
.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--bg-medium);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

.spinner.large {
    width: 64px;
    height: 64px;
    border-width: 5px;
}

.spinner.small {
    width: 32px;
    height: 32px;
    border-width: 3px;
}

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

/* ===== WELCOME SECTION ===== */
.welcome-section {
    text-align: center;
    margin-bottom: 48px;
}

.welcome-section h2 {
    color: var(--primary);
    font-size: 2rem;
    margin-bottom: 16px;
}

.welcome-text {
    font-size: 1.1rem;
    color: var(--text-medium);
    max-width: 600px;
    margin: 0 auto 32px;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 24px;
    margin-top: 32px;
}

.feature {
    text-align: center;
    padding: 24px;
    background: var(--bg-light);
    border-radius: var(--radius-md);
}

.feature-icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 12px;
}

.feature h4 {
    color: var(--text-dark);
    margin-bottom: 8px;
}

.feature p {
    color: var(--text-light);
    font-size: 0.9rem;
}

/* ===== INPUT SECTION ===== */
.input-container {
    max-width: 700px;
    margin: 0 auto;
}

.input-section {
    margin-bottom: 32px;
    padding: 32px;
    background: var(--bg-light);
    border-radius: var(--radius-md);
    border: 2px solid var(--border);
}

.input-section h3 {
    color: var(--text-dark);
    margin-bottom: 12px;
    font-size: 1.3rem;
}

.input-help {
    color: var(--text-light);
    font-size: 0.95rem;
    margin-bottom: 20px;
}

.playlist-input,
.manual-input {
    width: 100%;
    padding: 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: inherit;
    transition: var(--transition);
}

.playlist-input {
    margin-bottom: 16px;
}

.manual-input {
    min-height: 150px;
    resize: vertical;
    margin-bottom: 16px;
}

.playlist-input:focus,
.manual-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.input-note {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-top: 12px;
}

.privacy-note {
    color: var(--success);
    font-weight: 500;
}

/* ===== BUTTONS ===== */
.cta-button,
.primary-button {
    width: 100%;
    padding: 16px 24px;
    background: var(--bg-gradient);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
}

.cta-button:hover,
.primary-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.cta-button:active,
.primary-button:active {
    transform: translateY(0);
}

.secondary-button {
    width: 100%;
    padding: 16px 24px;
    background: white;
    color: var(--primary);
    border: 2px solid var(--primary);
    border-radius: var(--radius-sm);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.secondary-button:hover {
    background: var(--bg-light);
}

/* ===== DIVIDER ===== */
.divider {
    text-align: center;
    margin: 32px 0;
    position: relative;
}

.divider::before,
.divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 40%;
    height: 1px;
    background: var(--border);
}

.divider::before { left: 0; }
.divider::after { right: 0; }

.divider span {
    background: white;
    padding: 0 16px;
    color: var(--text-light);
    font-weight: 600;
}

/* ===== EXAMPLE SECTION ===== */
.example-section {
    text-align: center;
    margin-top: 32px;
    padding: 20px;
    background: var(--bg-light);
    border-radius: var(--radius-md);
}

.example-text {
    color: var(--text-medium);
}

.example-link {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
}

.example-link:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* ===== ANALYZING SCREEN ===== */
.analyzing-content {
    text-align: center;
    padding: 64px 32px;
}

.analyzing-content h2 {
    color: var(--primary);
    margin: 24px 0 16px;
    font-size: 1.75rem;
}

.analyzing-status {
    color: var(--text-medium);
    font-size: 1.1rem;
    margin: 16px 0;
}

.progress-dots {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin: 24px 0;
}

.dot {
    width: 12px;
    height: 12px;
    background: var(--primary);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.dot:nth-child(1) { animation-delay: -0.32s; }
.dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

.analyzing-note {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-top: 16px;
}

/* ===== RESULTS SCREEN ===== */
.results-header {
    text-align: center;
    margin-bottom: 40px;
}

.results-title {
    color: var(--primary);
    font-size: 2rem;
    margin-bottom: 12px;
}

.results-intro {
    color: var(--text-medium);
    font-size: 1.1rem;
}

.result-card {
    margin-bottom: 32px;
    padding: 32px;
    background: var(--bg-light);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--primary);
    transition: var(--transition);
}

.result-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.result-card.highlight {
    background: linear-gradient(135deg, #f5f7ff 0%, #fff5f7 100%);
    border-left-color: var(--secondary);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.card-icon {
    font-size: 2rem;
}

.card-header h3 {
    color: var(--text-dark);
    font-size: 1.4rem;
}

.card-content {
    color: var(--text-medium);
    font-size: 1.05rem;
    line-height: 1.7;
}

.actions-content {
    line-height: 1.9;
}

/* ===== RATING SECTION ===== */
.rating-container {
    margin-top: 48px;
    padding: 40px;
    background: white;
    border-radius: var(--radius-md);
    border: 2px solid var(--border);
}

.rating-header {
    text-align: center;
    margin-bottom: 32px;
}

.rating-header h3 {
    color: var(--primary);
    font-size: 1.75rem;
    margin-bottom: 12px;
}

.rating-subtitle {
    color: var(--text-light);
    font-size: 0.95rem;
}

.rating-grid {
    display: grid;
    gap: 32px;
    margin-bottom: 32px;
}

.rating-dimension {
    padding: 24px;
    background: var(--bg-light);
    border-radius: var(--radius-md);
}

.dimension-header {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 20px;
}

.dimension-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.dimension-header h4 {
    color: var(--text-dark);
    font-size: 1.2rem;
    margin-bottom: 4px;
}

.dimension-desc {
    color: var(--text-light);
    font-size: 0.9rem;
}

.rating-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 12px;
}

.rating-btn {
    padding: 16px 12px;
    background: white;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.rating-btn .emoji {
    font-size: 1.75rem;
}

.rating-btn .label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-medium);
}

.rating-btn:hover {
    border-color: var(--primary);
    background: var(--bg-light);
    transform: translateY(-2px);
}

.rating-btn.selected {
    border-color: var(--primary);
    background: var(--primary);
    color: white;
    box-shadow: var(--shadow-md);
}

.rating-btn.selected .label {
    color: white;
}

/* ===== FEEDBACK SECTION ===== */
.feedback-section {
    margin-bottom: 24px;
}

.feedback-label {
    display: block;
    color: var(--text-dark);
    font-weight: 600;
    margin-bottom: 12px;
    font-size: 1.05rem;
}

.feedback-textarea {
    width: 100%;
    min-height: 100px;
    padding: 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 1rem;
    resize: vertical;
    transition: var(--transition);
}

.feedback-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* ===== ACTION BUTTONS ===== */
.action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.rating-footer {
    text-align: center;
    color: var(--text-light);
    font-size: 0.9rem;
}

.dashboard-link-inline {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.dashboard-link-inline:hover {
    text-decoration: underline;
}

/* ===== FOOTER ===== */
footer {
    padding: 32px;
    background: var(--bg-light);
    text-align: center;
    border-top: 1px solid var(--border);
}

.footer-text {
    color: var(--text-medium);
    margin-bottom: 12px;
}

.footer-links {
    color: var(--text-light);
    font-size: 0.9rem;
}

.footer-links a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

.footer-links a:hover {
    text-decoration: underline;
}

/* ===================================
   DASHBOARD STYLES
   =================================== */

.dashboard-body {
    background: var(--bg-medium);
}

.dashboard-container {
    max-width: 1200px;
    margin: 0 auto;
    background: var(--bg-white);
    min-height: 100vh;
}

.dashboard-header {
    background: var(--bg-gradient);
    color: white;
    padding: 48px 32px;
}

.header-content {
    max-width: 1000px;
    margin: 0 auto;
}

.dashboard-header h1 {
    font-size: 2.5rem;
    margin-bottom: 12px;
}

.header-subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 24px;
}

.header-actions {
    display: flex;
    gap: 16px;
}

.back-link,
.github-link {
    color: white;
    text-decoration: none;
    padding: 10px 20px;
    background: rgba(255,255,255,0.15);
    border-radius: var(--radius-sm);
    transition: var(--transition);
    font-weight: 500;
}

.back-link:hover,
.github-link:hover {
    background: rgba(255,255,255,0.25);
}

/* ===== DASHBOARD SECTIONS ===== */
.summary-section,
.analysis-section,
.findings-section,
.user-ratings-section,
.methodology-section {
    padding: 48px 32px;
    max-width: 1000px;
    margin: 0 auto;
}

.summary-section h2,
.analysis-section h2,
.findings-section h2,
.user-ratings-section h2,
.methodology-section h2 {
    color: var(--primary);
    font-size: 1.75rem;
    margin-bottom: 12px;
}

.section-subtitle {
    color: var(--text-light);
    margin-bottom: 32px;
}

/* ===== METRICS GRID ===== */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
    margin-top: 32px;
}

.metric-card {
    padding: 32px;
    background: var(--bg-light);
    border-radius: var(--radius-md);
    text-align: center;
    border: 2px solid var(--border);
    transition: var(--transition);
}

.metric-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.metric-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.metric-value {
    font-size: 3rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 8px;
}

.metric-label {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 12px;
}

.metric-desc {
    font-size: 0.9rem;
    color: var(--text-light);
    line-height: 1.5;
}

/* ===== PERFORMANCE TABLE ===== */
.table-container {
    overflow-x: auto;
    margin-top: 24px;
}

.performance-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: var(--radius-md);
    overflow: hidden;
}

.performance-table th,
.performance-table td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.performance-table th {
    background: var(--bg-light);
    font-weight: 600;
    color: var(--text-dark);
}

.performance-table tr:last-child td {
    border-bottom: none;
}

.difficulty-badge {
    padding: 4px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
}

.difficulty-badge.easy {
    background: #d4edda;
    color: #155724;
}

.difficulty-badge.medium {
    background: #fff3cd;
    color: #856404;
}

.difficulty-badge.hard {
    background: #f8d7da;
    color: #721c24;
}

.score {
    font-weight: 600;
}

.score.excellent {
    color: var(--success);
}

.score.good {
    color: var(--info);
}

/* ===== CATEGORY GRID ===== */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
    margin-top: 24px;
}

.category-card {
    padding: 24px;
    background: white;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.category-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}

.category-card h4 {
    color: var(--text-dark);
    margin-bottom: 16px;
    font-size: 1.1rem;
}

.category-stats {
    display: flex;
    gap: 20px;
    margin-bottom: 12px;
}

.stat {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-label {
    color: var(--text-light);
    font-size: 0.85rem;
}

.stat-value {
    color: var(--primary);
    font-size: 1.5rem;
    font-weight: 700;
}

.category-note {
    color: var(--text-light);
    font-size: 0.9rem;
    font-style: italic;
}

/* ===== FINDINGS ===== */
.findings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    margin-top: 24px;
}

.finding-card {
    padding: 32px;
    border-radius: var(--radius-md);
}

.finding-card.strengths {
    background: #d4edda;
    border-left: 4px solid var(--success);
}

.finding-card.improvements {
    background: #fff3cd;
    border-left: 4px solid var(--warning);
}

.finding-card h3 {
    margin-bottom: 16px;
    color: var(--text-dark);
}

.finding-card ul {
    list-style-position: inside;
    color: var(--text-medium);
    line-height: 1.8;
}

.improvement-note {
    margin-top: 16px;
    padding: 12px;
    background: white;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    color: var(--text-light);
    font-style: italic;
}

/* ===== USER RATINGS ===== */
.loading-ratings,
.no-ratings,
.error-message {
    text-align: center;
    padding: 48px;
    color: var(--text-light);
}

.user-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.user-stat-card {
    padding: 24px;
    background: var(--bg-gradient);
    color: white;
    border-radius: var(--radius-md);
    text-align: center;
}

.user-stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.user-stat-label {
    font-size: 0.95rem;
    opacity: 0.9;
}

.recent-ratings {
    margin-top: 32px;
    padding: 24px;
    background: var(--bg-light);
    border-radius: var(--radius-md);
}

.recent-ratings h3 {
    color: var(--text-dark);
    margin-bottom: 20px;
}

.feedback-item {
    padding: 16px;
    background: white;
    border-left: 3px solid var(--primary);
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
}

.feedback-date {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 8px;
}

.feedback-text {
    color: var(--text-medium);
    font-style: italic;
}

/* ===== METHODOLOGY ===== */
.methodology-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
    margin: 24px 0;
}

.method-card {
    padding: 24px;
    background: var(--bg-light);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--primary);
}

.method-card h4 {
    color: var(--text-dark);
    margin-bottom: 12px;
}

.method-card p {
    color: var(--text-medium);
    font-size: 0.95rem;
    line-height: 1.6;
}

.methodology-link {
    text-align: center;
    margin-top: 32px;
}

.read-more {
    display: inline-block;
    padding: 12px 32px;
    background: var(--primary);
    color: white;
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    transition: var(--transition);
}

.read-more:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

/* ===== DASHBOARD FOOTER ===== */
.dashboard-footer {
    padding: 32px;
    background: var(--bg-light);
    text-align: center;
    border-top: 1px solid var(--border);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.75rem;
    }
    
    .tagline {
        font-size: 1rem;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
    }
    
    .action-buttons,
    .findings-grid {
        grid-template-columns: 1fr;
    }
    
    .rating-buttons {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .metrics-grid,
    .category-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    #loading-screen,
    #input-screen,
    #analyzing-screen,
    #results-screen {
        padding: 24px 16px;
    }
    
    .result-card {
        padding: 20px;
    }
    
    .rating-container {
        padding: 24px;
    }
}
