/* Variables */
:root {
    --bg: #0f0f12;
    --surface: #1a1a20;
    --surface-hover: #22222a;
    --text: #e8e8ed;
    --text-muted: #8888a0;
    --accent: #6366f1;
    --accent-hover: #818cf8;
    --mic-active: #ef4444;
    --success: #22c55e;
    --radius: 14px;
    --radius-sm: 8px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
    --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
}

.app {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    padding: 0 16px 24px;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    padding: 20px 0 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
}

.nav {
    display: flex;
    gap: 8px;
}

.nav-btn {
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text-muted);
    font: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.nav-btn:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.nav-btn.active {
    background: var(--accent);
    color: white;
}

/* Main views */
.main {
    flex: 1;
    padding-top: 24px;
}

.view {
    display: none;
}

.view.active {
    display: block;
}

.today-label {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 24px;
}

/* Record zone */
.record-zone {
    text-align: center;
    margin-bottom: 32px;
}

.mic-btn {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 4px solid var(--surface);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform 0.15s, background 0.15s, border-color 0.15s, box-shadow 0.15s;
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
}

.mic-btn:hover {
    background: var(--surface-hover);
    border-color: var(--accent);
}

.mic-btn:active,
.mic-btn.recording {
    background: rgba(239, 68, 68, 0.2);
    border-color: var(--mic-active);
    transform: scale(1.05);
    box-shadow: 0 0 0 8px rgba(239, 68, 68, 0.15);
}

.mic-icon {
    width: 48px;
    height: 48px;
    background: currentColor;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M12 1a3 3 0 0 1 3 3v8a3 3 0 0 1-6 0V4a3 3 0 0 1 3-3z'/%3E%3Cpath d='M19 10v2a7 7 0 0 1-14 0v-2'/%3E%3Cline x1='12' y1='19' x2='12' y2='23'/%3E%3Cline x1='8' y1='23' x2='16' y2='23'/%3E%3C/svg%3E") center/contain no-repeat;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M12 1a3 3 0 0 1 3 3v8a3 3 0 0 1-6 0V4a3 3 0 0 1 3-3z'/%3E%3Cpath d='M19 10v2a7 7 0 0 1-14 0v-2'/%3E%3Cline x1='12' y1='19' x2='12' y2='23'/%3E%3Cline x1='8' y1='23' x2='16' y2='23'/%3E%3C/svg%3E") center/contain no-repeat;
}

.mic-btn.recording .mic-icon {
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
    50% { opacity: 0.6; }
}

.mic-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    max-width: 90px;
}

.record-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 12px;
}

/* Day audios list */
.day-audios {
    margin-bottom: 24px;
}

.day-audios h2 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-muted);
}

.audios-list {
    list-style: none;
}

.audios-list li {
    background: var(--surface);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    margin-bottom: 8px;
    font-size: 0.9rem;
    border-left: 3px solid var(--accent);
}

.audios-list li time {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: block;
    margin-bottom: 4px;
}

.empty-msg {
    color: var(--text-muted);
    font-size: 0.9rem;
    padding: 16px 0;
}

.empty-msg.hidden,
.hidden {
    display: none !important;
}

/* Summary actions */
.summary-actions {
    margin-bottom: 20px;
}

.btn-summary {
    width: 100%;
    padding: 14px 20px;
    border: none;
    border-radius: var(--radius);
    background: var(--accent);
    color: white;
    font: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-summary:hover:not(:disabled) {
    background: var(--accent-hover);
}

.btn-summary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Daily summary box */
.daily-summary-box {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 24px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.daily-summary-box h3 {
    font-size: 1rem;
    margin-bottom: 12px;
    color: var(--text-muted);
}

.summary-text {
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 16px;
    white-space: pre-wrap;
}

.btn-save-summary {
    padding: 10px 18px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--success);
    color: white;
    font: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-save-summary:hover {
    filter: brightness(1.1);
}

/* History view */
.view-history h2 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-muted);
}

.history-list {
    list-style: none;
}

.history-list li {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.history-list li h4 {
    font-size: 0.95rem;
    margin-bottom: 8px;
    color: var(--text);
}

.history-list li time {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: block;
    margin-bottom: 8px;
}

.history-list li p {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.5;
    white-space: pre-wrap;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(80px);
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-size: 0.9rem;
    box-shadow: var(--shadow);
    opacity: 0;
    transition: transform 0.3s, opacity 0.3s;
    z-index: 1000;
    max-width: calc(100% - 32px);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Tablet y desktop: más espacio */
@media (min-width: 600px) {
    .app {
        max-width: 560px;
        padding: 0 24px 32px;
    }

    .mic-btn {
        width: 140px;
        height: 140px;
    }

    .mic-icon {
        width: 56px;
        height: 56px;
    }
}

/* Evitar zoom en inputs en móvil */
@media (max-width: 480px) {
    html {
        font-size: 16px;
    }
}
