/* ==============================================
   PLANEADOR DOCENTE — Design System
   ============================================== */

:root {
    --color-primary: #2563eb;
    --color-primary-dark: #1d4ed8;
    --color-primary-light: #3b82f6;
    --color-primary-soft: rgba(37, 99, 235, 0.08);
    --color-primary-glow: rgba(37, 99, 235, 0.25);

    --color-success: #059669;
    --color-success-soft: rgba(5, 150, 105, 0.08);
    --color-success-glow: rgba(5, 150, 105, 0.25);

    --color-error: #dc2626;
    --color-error-soft: rgba(220, 38, 38, 0.08);

    --color-warning: #d97706;
    --color-warning-soft: rgba(217, 119, 6, 0.08);

    --color-record: #ef4444;
    --color-record-glow: rgba(239, 68, 68, 0.35);

    --bg-body: #0f172a;
    --bg-card: #1e293b;
    --bg-card-hover: #263450;
    --bg-input: #0f172a;
    --bg-header: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --border-color: #334155;
    --border-radius: 16px;
    --border-radius-sm: 10px;
    --border-radius-xs: 6px;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.25);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 20px var(--color-primary-glow);

    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==============================================
   Reset & Base
   ============================================== */

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

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

body {
    font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ==============================================
   Layout
   ============================================== */

.app-container {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 1rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ==============================================
   Header
   ============================================== */

.header {
    padding: 2.5rem 0 1.5rem;
    text-align: center;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.logo-icon {
    font-size: 2.2rem;
    filter: drop-shadow(0 0 8px var(--color-primary-glow));
}

.header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    background: linear-gradient(135deg, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.02em;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 400;
    max-width: 480px;
    margin: 0 auto;
}

/* ==============================================
   Status Bar
   ============================================== */

.status-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    margin-bottom: 1.5rem;
    font-size: 0.82rem;
    transition: var(--transition);
}

.status-bar.ok {
    border-color: var(--color-success);
    background: var(--color-success-soft);
}

.status-bar.error {
    border-color: var(--color-error);
    background: var(--color-error-soft);
}

.status-bar.warning {
    border-color: var(--color-warning);
    background: var(--color-warning-soft);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    flex-shrink: 0;
}

.status-bar.ok .status-dot {
    background: var(--color-success);
    box-shadow: 0 0 6px var(--color-success-glow);
    animation: pulse-dot 2s ease-in-out infinite;
}

.status-bar.error .status-dot {
    background: var(--color-error);
}

.status-bar.warning .status-dot {
    background: var(--color-warning);
}

@keyframes pulse-dot {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.status-text {
    color: var(--text-secondary);
}

/* ==============================================
   Cards
   ============================================== */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.75rem;
    margin-bottom: 1.25rem;
    transition: var(--transition);
}

.card:hover {
    border-color: rgba(96, 165, 250, 0.2);
}

.step-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.step-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--color-primary);
    color: white;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
    box-shadow: 0 0 12px var(--color-primary-glow);
}

.step-header h2 {
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.step-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    line-height: 1.65;
}

/* ==============================================
   Buttons
   ============================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--border-radius-sm);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    outline: none;
    position: relative;
    overflow: hidden;
}

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

.btn:not(:disabled):active {
    transform: scale(0.97);
}

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

/* Record button */
.btn-record {
    background: linear-gradient(135deg, #1e293b 0%, #263450 100%);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
    padding: 1.25rem 2rem;
    font-size: 1.05rem;
    border-radius: 9999px;
    width: 100%;
    max-width: 320px;
}

.btn-record:not(:disabled):hover {
    border-color: var(--color-primary-light);
    box-shadow: var(--shadow-glow);
    transform: translateY(-1px);
}

.btn-record.recording {
    background: linear-gradient(135deg, #450a0a 0%, #7f1d1d 100%);
    border-color: var(--color-record);
    box-shadow: 0 0 25px var(--color-record-glow);
    animation: pulse-record 1.5s ease-in-out infinite;
}

@keyframes pulse-record {

    0%,
    100% {
        box-shadow: 0 0 20px var(--color-record-glow);
    }

    50% {
        box-shadow: 0 0 35px var(--color-record-glow);
    }
}

/* Primary button */
.btn-primary {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: white;
    box-shadow: 0 2px 8px var(--color-primary-glow);
}

.btn-primary:not(:disabled):hover {
    box-shadow: 0 4px 16px var(--color-primary-glow);
    transform: translateY(-1px);
}

/* Secondary button */
.btn-secondary {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border-color: var(--text-muted);
}

/* Success button */
.btn-success {
    background: linear-gradient(135deg, var(--color-success) 0%, #047857 100%);
    color: white;
    box-shadow: 0 2px 8px var(--color-success-glow);
}

.btn-success:not(:disabled):hover {
    box-shadow: 0 4px 16px var(--color-success-glow);
    transform: translateY(-1px);
}

/* Upload button */
.btn-upload {
    background: var(--bg-input);
    color: var(--text-secondary);
    border: 2px dashed var(--border-color);
    padding: 1rem 1.5rem;
    width: 100%;
    max-width: 320px;
    border-radius: var(--border-radius-sm);
}

.btn-upload:hover {
    border-color: var(--color-primary-light);
    color: var(--text-primary);
    background: var(--color-primary-soft);
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
}

.btn-process {
    width: 100%;
    padding: 1rem;
    font-size: 1rem;
    margin-top: 1.5rem;
}

/* ==============================================
   Chat Input Section
   ============================================== */

.chat-input-area {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.chat-textarea {
    width: 100%;
    padding: 1rem;
    background: var(--bg-input);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    line-height: 1.7;
    resize: vertical;
    min-height: 150px;
    transition: var(--transition);
}

.chat-textarea:focus {
    outline: none;
    border-color: var(--color-primary-light);
    box-shadow: 0 0 0 3px var(--color-primary-soft);
}

.chat-textarea::placeholder {
    color: var(--text-muted);
    font-size: 0.88rem;
}

.chat-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.char-count {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* ==============================================
   Original Text Section
   ============================================== */

.original-text-section {
    margin-bottom: 1.5rem;
}

.original-text-section h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
}

.original-text {
    padding: 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-size: 0.88rem;
    line-height: 1.7;
    color: var(--text-secondary);
    max-height: 150px;
    overflow-y: auto;
    white-space: pre-wrap;
}

/* ==============================================
   Progress Card
   ============================================== */

.progress-card {
    border-color: var(--color-primary);
    box-shadow: 0 0 20px var(--color-primary-glow);
}

.progress-steps {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.progress-step {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    border-radius: var(--border-radius-xs);
    font-size: 0.88rem;
    color: var(--text-muted);
    transition: var(--transition);
}

.progress-step.active {
    color: var(--text-primary);
    background: var(--color-primary-soft);
}

.progress-step.done {
    color: var(--color-success);
}

.progress-step.done .progress-status::after {
    content: "✓";
}

.progress-step.active .progress-status::after {
    content: "";
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid var(--color-primary-light);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spinner 0.7s linear infinite;
}

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

.progress-icon {
    font-size: 1.1rem;
}

.progress-bar-container {
    height: 4px;
    background: var(--bg-input);
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--color-primary), #a78bfa);
    border-radius: 2px;
    transition: width 0.5s ease;
}

/* ==============================================
   Transcription
   ============================================== */

.transcription-section {
    margin-bottom: 1.5rem;
}

.transcription-section h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
}

.transcription-text {
    padding: 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-size: 0.88rem;
    line-height: 1.7;
    color: var(--text-secondary);
    max-height: 150px;
    overflow-y: auto;
}

/* ==============================================
   Planning Fields
   ============================================== */

.planning-fields {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.field-section {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 1rem;
    background: rgba(15, 23, 42, 0.4);
}

.field-section-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.85rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--color-primary);
    background: linear-gradient(135deg, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.field-section-fields {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.field-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-primary-light);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.field-group input,
.field-group textarea {
    width: 100%;
    padding: 0.65rem 0.85rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-xs);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.88rem;
    line-height: 1.5;
    transition: var(--transition);
    resize: vertical;
}

.field-group input:focus,
.field-group textarea:focus {
    outline: none;
    border-color: var(--color-primary-light);
    box-shadow: 0 0 0 3px var(--color-primary-soft);
}

.field-group textarea {
    min-height: 70px;
}

.field-group.large textarea {
    min-height: 100px;
}

/* ==============================================
   Actions
   ============================================== */

.actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.actions .btn {
    flex: 1;
    min-width: 180px;
}

/* ==============================================
   Success Card
   ============================================== */

.success-card {
    border-color: var(--color-success);
    box-shadow: 0 0 20px var(--color-success-glow);
}

.success-content {
    text-align: center;
    padding: 1rem 0;
}

.success-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 0.75rem;
}

.success-content h2 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #34d399, #059669);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.success-content p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.success-content .btn {
    margin: 0.35rem;
}

/* ==============================================
   Error Toast
   ============================================== */

.error-toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.85rem 1.25rem;
    background: #450a0a;
    border: 1px solid var(--color-error);
    border-radius: var(--border-radius-sm);
    color: #fca5a5;
    font-size: 0.88rem;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    max-width: calc(100% - 2rem);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateX(-50%) translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

.error-close {
    background: none;
    border: none;
    color: #fca5a5;
    cursor: pointer;
    padding: 0.25rem;
    font-size: 1rem;
    margin-left: 0.5rem;
}

/* ==============================================
   Footer
   ============================================== */

.footer {
    margin-top: auto;
    padding: 1.5rem 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.78rem;
}

/* ==============================================
   Responsive
   ============================================== */

@media (max-width: 600px) {
    .header h1 {
        font-size: 1.4rem;
    }

    .subtitle {
        font-size: 0.85rem;
    }

    .card {
        padding: 1.25rem;
    }

    .btn-record {
        max-width: 100%;
    }

    .btn-upload {
        max-width: 100%;
    }

    .actions {
        flex-direction: column;
    }

    .actions .btn {
        min-width: unset;
    }
}

/* ==============================================
   Scrollbar (Dark)
   ============================================== */

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

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

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}