/* Variables y Tema de Color */
:root {
    --bg-primary: #0b0f19;
    --bg-secondary: #100e23;
    --bg-card: #171430; /* Definida en base a la estética para contraste con bg-secondary */
    --border-color: #c45656;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    
    --primary: #c45656;
    --primary-hover: #b04646;
    --primary-light: rgba(196, 86, 86, 0.15);
    
    --accent: #f65ca3;
    --danger: #ef4444;
    --danger-light: rgba(239, 68, 68, 0.12);
    --success: #10b981;
    --success-light: rgba(16, 185, 129, 0.12);
    --warning: #f59e0b;
    --warning-light: rgba(245, 158, 11, 0.12);
    
    --shadow-main: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Plus Jakarta Sans', sans-serif;
}

/* Reset y Estilos Generales */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-primary); /* Ajustado a bg-primary para mantener el tema oscuro premium */
    color: var(--text-main);
    font-family: var(--font-body);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
}

/* Contenedor Principal */
.app-container {
    width: 100%;
    max-width: 1400px;
    height: 95vh;
    margin: 2vh auto;
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-main);
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    font-size: 28px;
    animation: float 3s ease-in-out infinite;
}

.logo-section h1 {
    font-family: var(--font-heading);
    font-size: 22px;
    font-weight: 700;
    background: linear-gradient(135deg, #fff 0%, var(--text-muted) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-section h1 span {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--primary);
    -webkit-text-fill-color: var(--primary);
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* Banner de API Key */
.api-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    background-color: var(--danger-light);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-sm);
    color: #fca5a5;
    font-size: 14px;
    transition: all 0.3s ease;
}

.api-banner.hidden {
    display: none;
}

.text-button {
    background: none;
    border: none;
    color: var(--text-main);
    text-decoration: underline;
    font-weight: 600;
    cursor: pointer;
}

.text-button:hover {
    color: var(--primary);
}

/* Layout Principal */
.main-content {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 20px;
    min-height: 0; /* Permite scroll interno */
}

@media (max-width: 992px) {
    .main-content {
        grid-template-columns: 1fr;
        height: auto;
        overflow: visible;
    }
    .app-container {
        height: auto;
        margin: 20px auto;
    }
}

/* Tarjetas base */
.card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--shadow-main);
}

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

.card-header h2 {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 600;
}

/* Panel Conversacional Izquierdo */
.chat-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.status-indicator {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 500;
}

.status-indicator.online {
    background-color: var(--success-light);
    color: #34d399;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: radial-gradient(circle at 10% 20%, rgba(196, 86, 86, 0.03) 0%, transparent 90%);
}

.message {
    max-width: 80%;
    display: flex;
    flex-direction: column;
    gap: 4px;
    animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.message.assistant {
    align-self: flex-start;
}

.message.user {
    align-self: flex-end;
}

.message-content {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    font-size: 15px;
    line-height: 1.5;
}

.message.assistant .message-content {
    background-color: var(--bg-card);
    border-bottom-left-radius: 4px;
    border: 2px solid #fab6b62e;
}

.message.user .message-content {
    background: linear-gradient(135deg, #7e3783 0%, var(--accent) 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.message-time {
    font-size: 10px;
    color: var(--text-muted);
    padding: 0 4px;
}

.message.user .message-time {
    align-self: flex-end;
}

/* Controles de Voz */
.voice-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 24px;
    border-top: 1px solid var(--border-color);
    background-color: rgba(16, 14, 35, 0.5);
}

.record-button {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f56c6c 0%, var(--accent) 100%);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 0 20px rgba(196, 86, 86, 0.3);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.record-button:hover {
    transform: scale(1.08);
    box-shadow: 0 0 30px rgba(246, 92, 163, 0.5);
}

.record-button:active {
    transform: scale(0.95);
}

.record-button.recording {
    background: var(--danger);
    box-shadow: 0 0 30px rgba(239, 68, 68, 0.7);
    animation: pulse 1.5s infinite;
}

.record-status {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
    letter-spacing: 0.5px;
}

/* Ondas de Audio Animadas */
.audio-waves {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 30px;
    margin-bottom: 8px;
}

.audio-waves.hidden {
    display: none;
}

.wave {
    width: 3px;
    height: 8px;
    background-color: var(--danger);
    border-radius: 3px;
    animation: waveBounce 0.8s ease-in-out infinite;
}

.wave:nth-child(2) { animation-delay: 0.15s; }
.wave:nth-child(3) { animation-delay: 0.3s; }
.wave:nth-child(4) { animation-delay: 0.45s; }
.wave:nth-child(5) { animation-delay: 0.6s; }

/* Panel de Tareas Derecho */
.tasks-panel {
    flex: 1.2;
    display: flex;
    flex-direction: column;
}

.filter-select {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 13px;
    cursor: pointer;
    outline: none;
    transition: border 0.3s;
}

.filter-select:focus {
    border-color: var(--primary);
}

.tasks-container {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.tasks-section h3 {
    font-family: var(--font-heading);
    font-size: 15px;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 12px;
    letter-spacing: 0.5px;
}

.tasks-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.empty-state {
    padding: 24px;
    text-align: center;
    color: var(--text-muted);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
    font-size: 14px;
    background-color: rgba(255, 255, 255, 0.01);
}

/* Tarjeta de Tarea Individual */
.task-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background-color: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.02);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.task-item:hover {
    transform: translateY(-2px);
    border-color: var(--border-color);
    box-shadow: 0 8px 16px -4px rgba(0, 0, 0, 0.3);
}

/* Checkbox Personalizado */
.checkbox-container {
    position: relative;
    width: 22px;
    height: 22px;
    cursor: pointer;
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    top: 0;
    left: 0;
    height: 22px;
    width: 22px;
    border-radius: 50%;
    border: 2px solid var(--text-muted);
    transition: all 0.3s;
}

.checkbox-container:hover input ~ .checkmark {
    border-color: var(--primary);
}

.checkbox-container input:checked ~ .checkmark {
    background-color: var(--success);
    border-color: var(--success);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
    left: 7px;
    top: 3px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-container input:checked ~ .checkmark:after {
    display: block;
}

/* Detalles de la Tarea */
.task-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.task-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-main);
    transition: all 0.3s;
}

.task-item.completed .task-title {
    text-decoration: line-through;
    color: var(--text-muted);
}

.task-desc {
    font-size: 13px;
    color: var(--text-muted);
}

.task-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.task-due {
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--warning);
}

.task-due.overdue {
    color: var(--danger);
    font-weight: bold;
}

/* Badges */
.badge {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

.badge.alta { background-color: var(--danger-light); color: #fca5a5; }
.badge.media { background-color: var(--warning-light); color: #fde047; }
.badge.baja { background-color: var(--primary-light); color: #c7d2fe; }

/* Botones de acción */
.icon-button {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    width: 38px;
    height: 38px;
    transition: all 0.2s;
}

.icon-button:hover {
    color: var(--text-main);
    background-color: var(--bg-card);
}

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

/* Modales */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 1;
    transition: all 0.3s;
}

.modal.hidden {
    display: none;
    opacity: 0;
}

.modal-content {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    box-shadow: var(--shadow-main);
    overflow: hidden;
    animation: modalSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.modal-header h3 {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 600;
}

.close-button {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
}

.close-button:hover {
    color: var(--text-main);
}

.modal-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.modal-body p {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.5;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
}

.form-group input {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    outline: none;
    font-family: var(--font-body);
    font-size: 14px;
    transition: border 0.3s;
}

.form-group input:focus {
    border-color: var(--primary);
}

.help-text {
    font-size: 12px;
    color: var(--text-muted);
}

.help-text a {
    color: var(--primary);
    text-decoration: none;
}

.help-text a:hover {
    text-decoration: underline;
}

.modal-footer {
    padding: 16px 24px;
    background-color: rgba(16, 14, 35, 0.4);
    display: flex;
    justify-content: flex-end;
    border-top: 1px solid var(--border-color);
}

.btn {
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

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

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

/* Animaciones */
@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-4px); }
    100% { transform: translateY(0px); }
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(196, 86, 86, 0.5); }
    70% { box-shadow: 0 0 0 15px rgba(196, 86, 86, 0); }
    100% { box-shadow: 0 0 0 0 rgba(196, 86, 86, 0); }
}

@keyframes waveBounce {
    0%, 100% { transform: scaleY(0.4); }
    50% { transform: scaleY(1.5); }
}

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

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

/* Badges de Categoría */
.badge.category-badge {
    background-color: rgba(246, 92, 163, 0.1);
    color: #f65ca3;
    border: 1px solid rgba(246, 92, 163, 0.3);
    text-transform: capitalize;
}
