/* ========================================
   Diario de Bienestar - Styles
   ======================================== */

:root {
    --color-primary: #4a9d8f;
    --color-primary-dark: #3a7d72;
    --color-primary-light: #e8f5f2;
    --color-danger: #e74c3c;
    --color-danger-light: #fdeaea;
    --color-warning: #f39c12;
    --color-success: #27ae60;
    --color-neutral: #7f8c8d;
    --color-bg: #f0f4f3;
    --color-card: #ffffff;
    --color-text: #2c3e50;
    --color-text-light: #6b7b8d;
    --color-border: #e0e6e4;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 50%;
    --transition: all 0.3s ease;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Reset */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    min-height: 100vh;
}

/* App Container */
.app-container {
    max-width: 680px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.app-header {
    text-align: center;
    padding: 2rem 1rem 1.5rem;
}

.app-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-primary-dark);
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--color-text-light);
    font-size: 1rem;
    font-weight: 300;
}

/* Main Content */
.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* Card Component */
.card {
    background: var(--color-card);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card h2 {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--color-text);
}

.section-description {
    color: var(--color-text-light);
    font-size: 0.9rem;
    margin-bottom: 1.25rem;
}

/* Recording Controls */
.recording-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-family);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    outline: none;
}

.btn:focus-visible {
    outline: 3px solid var(--color-primary);
    outline-offset: 2px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.btn:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn:not(:disabled):active {
    transform: translateY(0);
}

.btn-icon {
    font-size: 1.2rem;
}

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

.btn-record:not(:disabled):hover {
    background: var(--color-primary-dark);
}

.btn-stop {
    background: var(--color-danger);
    color: white;
}

.btn-stop:not(:disabled):hover {
    background: #c0392b;
}

.btn-analyze {
    background: var(--color-primary);
    color: white;
    width: 100%;
    justify-content: center;
    margin-top: 1rem;
}

.btn-analyze:not(:disabled):hover {
    background: var(--color-primary-dark);
}

.btn-save {
    background: var(--color-success);
    color: white;
    width: 100%;
    justify-content: center;
    margin-top: 1rem;
}

.btn-save:not(:disabled):hover {
    background: #219a52;
}

/* Recording Status */
.recording-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 1rem;
    color: var(--color-danger);
    font-weight: 500;
    font-size: 0.9rem;
}

.pulse-dot {
    width: 12px;
    height: 12px;
    background: var(--color-danger);
    border-radius: var(--radius-full);
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(1.3);
    }
}

/* Timer */
.timer {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--color-text);
    margin-top: 0.75rem;
    font-variant-numeric: tabular-nums;
}

/* Transcription */
.transcription-text {
    background: var(--color-primary-light);
    border-radius: var(--radius-sm);
    padding: 1rem;
    min-height: 80px;
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--color-text);
    border: 1px solid var(--color-border);
}

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

/* Sentiment Result */
.sentiment-result {
    text-align: center;
    padding: 1.5rem;
}

.sentiment-emoji {
    font-size: 3.5rem;
    margin-bottom: 0.75rem;
    animation: bounceIn 0.5s ease;
}

@keyframes bounceIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.sentiment-label {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

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

.sentiment-positive .sentiment-label {
    color: var(--color-success);
}

.sentiment-negative .sentiment-label {
    color: var(--color-danger);
}

.sentiment-neutral .sentiment-label {
    color: var(--color-neutral);
}

/* Loading */
.loading-section {
    text-align: center;
    padding: 2rem;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: var(--radius-full);
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1rem;
}

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

.loading-section p {
    color: var(--color-text-light);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--color-border);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--color-primary);
    border-radius: 3px;
    width: 0%;
    transition: width 0.3s ease;
}

/* History */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 400px;
    overflow-y: auto;
}

.history-entry {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--color-bg);
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    transition: var(--transition);
}

.history-entry:hover {
    border-color: var(--color-primary);
    background: var(--color-primary-light);
}

.history-emoji {
    font-size: 1.5rem;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.history-content {
    flex: 1;
    min-width: 0;
}

.history-date {
    font-size: 0.75rem;
    color: var(--color-text-light);
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.history-text {
    font-size: 0.85rem;
    color: var(--color-text);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.history-sentiment {
    font-size: 0.75rem;
    font-weight: 500;
    margin-top: 0.35rem;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    display: inline-block;
}

.history-sentiment.positive {
    background: #d4edda;
    color: #155724;
}

.history-sentiment.negative {
    background: #f8d7da;
    color: #721c24;
}

.history-sentiment.neutral {
    background: #e2e3e5;
    color: #383d41;
}

.history-actions {
    flex-shrink: 0;
}

.btn-delete {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    opacity: 0.4;
    transition: var(--transition);
    padding: 0.25rem;
    border-radius: 4px;
}

.btn-delete:hover {
    opacity: 1;
    background: var(--color-danger-light);
}

/* Footer */
.app-footer {
    text-align: center;
    padding: 1.5rem 1rem;
    color: var(--color-text-light);
    font-size: 0.8rem;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Responsive Design */
@media (max-width: 480px) {
    .app-container {
        padding: 1rem 0.75rem;
    }

    .app-header h1 {
        font-size: 1.6rem;
    }

    .card {
        padding: 1.25rem;
        border-radius: var(--radius-md);
    }

    .btn {
        padding: 0.65rem 1.25rem;
        font-size: 0.9rem;
    }

    .sentiment-emoji {
        font-size: 2.5rem;
    }

    .recording-controls {
        flex-direction: column;
        align-items: center;
    }

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

@media (min-width: 768px) {
    .app-container {
        padding: 2rem 1.5rem;
    }

    .app-header {
        padding: 2.5rem 1rem 2rem;
    }

    .app-header h1 {
        font-size: 2.25rem;
    }
}

/* Scrollbar Styling */
.history-list::-webkit-scrollbar {
    width: 6px;
}

.history-list::-webkit-scrollbar-track {
    background: transparent;
}

.history-list::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 3px;
}

.history-list::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-light);
}

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

@media (prefers-color-scheme: dark) {
    :root {
        --color-bg: #1a2332;
        --color-card: #243447;
        --color-text: #e8edf2;
        --color-text-light: #9caab8;
        --color-border: #354a5f;
        --color-primary-light: #1e3a35;
    }

    .history-entry {
        background: #1e2d3d;
    }

    .transcription-text {
        background: #1e3a35;
    }

    .history-sentiment.positive {
        background: #1e3a25;
        color: #7ed9a0;
    }

    .history-sentiment.negative {
        background: #3a1e22;
        color: #f5a0a8;
    }

    .history-sentiment.neutral {
        background: #2d333b;
        color: #b0b8c4;
    }

    .movie-card {
        background: #1e2d3d;
        border-color: #354a5f;
    }

    .music-card {
        background: #1e2d3d;
        border-color: #354a5f;
    }
}

/* Recommendations */
.recommendations-section h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--color-text);
}

.recommendations-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.movies-list {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.movie-card {
    min-width: 160px;
    max-width: 160px;
    background: var(--color-bg);
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    overflow: hidden;
    transition: var(--transition);
    flex-shrink: 0;
}

.movie-card:hover {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.movie-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

.movie-card .movie-info {
    padding: 0.6rem;
}

.movie-card .movie-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 0.2rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.movie-card .movie-year {
    font-size: 0.7rem;
    color: var(--color-text-light);
    margin-bottom: 0.3rem;
}

.movie-card .movie-overview {
    font-size: 0.7rem;
    color: var(--color-text-light);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.music-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.music-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.85rem;
    background: var(--color-bg);
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    transition: var(--transition);
    text-decoration: none;
    color: inherit;
}

.music-card:hover {
    border-color: var(--color-primary);
    background: var(--color-primary-light);
}

.music-card .music-icon {
    font-size: 1.3rem;
    flex-shrink: 0;
}

.music-card .music-info {
    flex: 1;
    min-width: 0;
}

.music-card .music-title {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.music-card .music-artist {
    font-size: 0.75rem;
    color: var(--color-text-light);
}

.music-card .music-link {
    font-size: 0.7rem;
    color: var(--color-primary);
    font-weight: 500;
    flex-shrink: 0;
}

.recommendations-fallback {
    font-size: 0.85rem;
    color: var(--color-text-light);
    font-style: italic;
    padding: 0.5rem 0;
}

.movies-list::-webkit-scrollbar {
    height: 4px;
}

.movies-list::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 2px;
}

@media (max-width: 480px) {
    .movie-card {
        min-width: 140px;
        max-width: 140px;
    }

    .movie-card img {
        height: 170px;
    }
}


/* Charts */
.charts-section h2 {
    margin-bottom: 1rem;
}

.chart-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.chart-tab {
    padding: 0.4rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: 20px;
    background: var(--color-bg);
    color: var(--color-text-light);
    font-family: var(--font-family);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.chart-tab:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.chart-tab.active {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

.chart-container {
    position: relative;
    width: 100%;
    max-height: 280px;
}

.chart-container canvas {
    width: 100% !important;
    max-height: 280px;
}


/* Manual Input (offline) */
.manual-input {
    width: 100%;
    resize: vertical;
    font-family: var(--font-family);
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--color-text);
    outline: none;
}

.manual-input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(74, 157, 143, 0.15);
}


/* Auth */
.auth-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.auth-user {
    font-size: 0.8rem;
    color: var(--color-text-light);
}

.btn-auth-small {
    padding: 0.35rem 0.75rem;
    font-size: 0.75rem;
    background: var(--color-primary-light);
    color: var(--color-primary-dark);
    border: 1px solid var(--color-primary);
    border-radius: 20px;
    cursor: pointer;
    font-family: var(--font-family);
    font-weight: 500;
    transition: var(--transition);
}

.btn-auth-small:hover {
    background: var(--color-primary);
    color: white;
}

.btn-auth-small.btn-logout {
    background: var(--color-danger-light);
    color: var(--color-danger);
    border-color: var(--color-danger);
}

.btn-auth-small.btn-logout:hover {
    background: var(--color-danger);
    color: white;
}

.auth-section {
    text-align: center;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 320px;
    margin: 0 auto;
}

.auth-form input {
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: var(--font-family);
    font-size: 0.9rem;
    color: var(--color-text);
    background: var(--color-bg);
    transition: var(--transition);
}

.auth-form input:focus {
    border-color: var(--color-primary);
    outline: none;
    box-shadow: 0 0 0 2px rgba(74, 157, 143, 0.15);
}

.auth-buttons {
    display: flex;
    gap: 0.5rem;
}

.auth-buttons .btn {
    flex: 1;
    justify-content: center;
    padding: 0.6rem;
    font-size: 0.85rem;
}

.btn-cancel {
    background: none;
    border: none;
    color: var(--color-text-light);
    font-size: 0.8rem;
    cursor: pointer;
    font-family: var(--font-family);
    padding: 0.25rem;
}

.btn-cancel:hover {
    color: var(--color-text);
}

.auth-error {
    font-size: 0.8rem;
    color: #721c24;
    margin-top: 0.5rem;
    padding: 0.4rem 0.75rem;
    background: #f8d7da;
    border-radius: 4px;
}


/* Cloud Prompt */
.cloud-prompt {
    background: var(--color-primary-light);
    border: 1px solid var(--color-primary);
    border-radius: var(--radius-sm);
    padding: 0.6rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.8rem;
    color: var(--color-text);
}

.cloud-prompt a {
    color: var(--color-primary-dark);
    font-weight: 600;
    text-decoration: none;
}

.cloud-prompt a:hover {
    text-decoration: underline;
}

.cloud-prompt.hidden {
    display: none !important;
}


/* Reminders */
.reminder-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.reminder-time-input {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: var(--font-family);
    font-size: 1rem;
    color: var(--color-text);
    background: var(--color-bg);
    cursor: pointer;
}

.reminder-time-input:focus {
    border-color: var(--color-primary);
    outline: none;
    box-shadow: 0 0 0 2px rgba(74, 157, 143, 0.15);
}

.reminder-status {
    margin-top: 0.75rem;
    font-size: 0.85rem;
    color: var(--color-primary-dark);
    font-weight: 500;
}

.reminder-status.active {
    color: var(--color-success);
}
