/* css/style.css */

:root {
    /* Variables Glassmorphism */
    --glass-bg: rgba(255, 255, 255, 0.07);
    --glass-bg-hover: rgba(255, 255, 255, 0.12);
    --glass-border: rgba(255, 255, 255, 0.15);
    --glass-border-light: rgba(255, 255, 255, 0.3);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    --glass-blur: blur(16px);
    
    /* Colores UI Médica */
    --bg-dark: #0f172a;
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.5);
    --accent-teal: #14b8a6;
    --accent-teal-glass: rgba(20, 184, 166, 0.2);
    --accent-purple: #a855f7;
    --accent-purple-glass: rgba(168, 85, 247, 0.2);
    --danger: #ef4444;
    --danger-glass: rgba(239, 68, 68, 0.2);
    --success: #22c55e;
    --warning: #f59e0b;
}

/* --- RESET Y TIPOGRAFÍA --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "San Francisco", "Roboto", "Segoe UI", "Helvetica Neue", sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    line-height: 1.5;
}

/* --- FONDO ANIMADO --- */
.animated-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
}

.blob {
    position: absolute;
    filter: blur(80px);
    opacity: 0.5;
    animation: float 12s infinite alternate ease-in-out;
    border-radius: 50%;
}

.blob-1 { width: 350px; height: 350px; background: #0d9488; top: -10%; left: -10%; animation-delay: 0s; }
.blob-2 { width: 450px; height: 450px; background: #4c1d95; bottom: -20%; right: -10%; animation-delay: -3s; }
.blob-3 { width: 300px; height: 300px; background: #0369a1; top: 30%; left: 30%; animation-delay: -6s; }

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(40px, -60px) scale(1.15); }
}

/* --- ESTRUCTURA PRINCIPAL --- */
.app-wrapper {
    height: 100%;
    width: 100%;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    scrollbar-width: none; /* Firefox */
}

.app-wrapper::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

.container {
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
    padding: 24px 20px 120px 20px; /* Espacio inferior para la barra de navegación */
    animation: fadeIn 0.4s ease-out;
}

/* --- COMPONENTES GLASSMORPHISM --- */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    box-shadow: var(--glass-shadow);
    padding: 20px;
    margin-bottom: 16px;
    transition: transform 0.2s ease, background 0.2s ease;
}

.glass-panel:active {
    transform: scale(0.98);
}

.glass-header {
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-bottom: 1px solid var(--glass-border);
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 30;
}

.glass-nav {
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-top: 1px solid var(--glass-border);
    padding: 12px 24px calc(12px + env(safe-area-inset-bottom));
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: fixed;
    bottom: 0;
    width: 100%;
    z-index: 20;
}

/* --- FORMULARIOS --- */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    margin-left: 4px;
    font-weight: 500;
}

.glass-input, .glass-select {
    width: 100%;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 14px 16px;
    border-radius: 16px;
    outline: none;
    font-size: 16px;
    transition: all 0.3s ease;
}

.glass-input:focus, .glass-select:focus {
    border-color: var(--accent-teal);
    background: rgba(0, 0, 0, 0.4);
    box-shadow: 0 0 0 4px var(--accent-teal-glass);
}

.glass-input::placeholder {
    color: var(--text-muted);
}

.glass-select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23FFFFFF%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 16px top 50%;
    background-size: 12px auto;
}

.glass-select option {
    background: var(--bg-dark);
    color: var(--text-primary);
}

/* --- BOTONES --- */
.btn {
    padding: 14px 20px;
    border-radius: 16px;
    border: none;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
    user-select: none;
}

.btn:active {
    transform: scale(0.96);
}

.btn-primary {
    background: var(--accent-teal);
    color: #ffffff;
    box-shadow: 0 4px 20px rgba(20, 184, 166, 0.4);
}

.btn-primary:hover { background: #0f9d8e; }

.btn-danger {
    background: var(--danger);
    color: #ffffff;
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.4);
}

.btn-ghost {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
}

.btn-ghost:hover {
    background: var(--glass-bg-hover);
    border-color: var(--glass-border-light);
}

.btn-icon {
    padding: 10px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    background: var(--glass-bg-hover);
    color: var(--text-primary);
}

.fab {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--accent-teal);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    border: none;
    box-shadow: 0 8px 32px rgba(20, 184, 166, 0.5);
    cursor: pointer;
    position: absolute;
    left: 50%;
    transform: translateX(-50%) translateY(-30px);
    transition: transform 0.2s ease, background 0.2s ease;
    z-index: 25;
}

.fab:active {
    transform: translateX(-50%) translateY(-30px) scale(0.92);
}

/* --- UTILIDADES --- */
.w-full { width: 100%; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-col { display: flex; flex-direction: column; gap: 16px; }
.flex-row { display: flex; align-items: center; gap: 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.text-center { text-align: center; }
.text-sm { font-size: 0.875rem; color: var(--text-secondary); }
.text-lg { font-size: 1.125rem; font-weight: 600; }
.text-xl { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.5px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }

.badge {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.badge-warning { background: rgba(245, 158, 11, 0.2); border-color: rgba(245, 158, 11, 0.3); color: #fcd34d; }
.badge-success { background: rgba(34, 197, 94, 0.2); border-color: rgba(34, 197, 94, 0.3); color: #86efac; }
.badge-danger { background: rgba(239, 68, 68, 0.2); border-color: rgba(239, 68, 68, 0.3); color: #fca5a5; }

.icon-box {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.icon-box-teal { background: var(--accent-teal-glass); color: var(--accent-teal); }
.icon-box-purple { background: var(--accent-purple-glass); color: var(--accent-purple); }

/* --- PROGRESS BARS --- */
.progress-bg {
    width: 100%;
    height: 8px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 8px;
}
.progress-fill {
    height: 100%;
    background: var(--accent-teal);
    border-radius: 4px;
    transition: width 0.5s ease;
}
.progress-fill.warning { background: var(--warning); }
.progress-fill.danger { background: var(--danger); }

/* --- MODALES --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    width: 100%;
    max-width: 450px;
    background: rgba(30, 41, 59, 0.85);
    border: 1px solid var(--glass-border-light);
    border-radius: 32px;
    padding: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s ease;
    max-height: 90vh;
    overflow-y: auto;
    scrollbar-width: none;
}
.modal-content::-webkit-scrollbar { display: none; }

/* --- ANIMACIONES --- */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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