/* =============================================
   FonoApp - Estilos principales
   ============================================= */

:root {
    --primary: #2E86AB;
    --primary-dark: #1a5c7a;
    --primary-light: #5ba8c9;
    --secondary: #A8DADC;
    --accent: #F4A261;
    --success: #4CAF50;
    --danger: #E63946;
    --warning: #FFB703;
    --bg: #F0F4F8;
    --bg-card: #FFFFFF;
    --text: #1D3557;
    --text-muted: #6C757D;
    --border: #DEE2E6;
    --shadow: 0 4px 20px rgba(0,0,0,0.08);
    --shadow-hover: 0 8px 30px rgba(0,0,0,0.15);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    min-height: 100vh;
    font-size: 16px;
    line-height: 1.5;
}

/* ---- LOGIN PAGE ---- */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--secondary) 100%);
    padding: 1rem;
}

.login-container {
    width: 100%;
    max-width: 420px;
}

.login-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-hover);
    padding: 2.5rem 2rem;
    animation: fadeInUp 0.5s ease;
}

.login-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo .logo-icon {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    box-shadow: 0 4px 15px rgba(46,134,171,0.3);
}

.login-logo .logo-icon i {
    font-size: 2rem;
    color: white;
}

.login-logo h1 {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.25rem;
}

.login-logo p {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.input-wrapper {
    position: relative;
}

.input-wrapper i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.75rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    color: var(--text);
    background: #fff;
    transition: var(--transition);
    outline: none;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(46,134,171,0.15);
}

.btn-toggle-password {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0;
    font-size: 0.9rem;
}

.btn-primary {
    width: 100%;
    padding: 0.85rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark), #0f3d54);
    box-shadow: 0 4px 15px rgba(46,134,171,0.35);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.alert-danger {
    background: #fde8ea;
    color: var(--danger);
    border: 1px solid #f5c2c7;
}

.alert-success {
    background: #d1f0d4;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
}

.login-footer {
    text-align: center;
    margin-top: 1.5rem;
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* ---- NAVBAR ---- */
.navbar {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: white;
    padding: 0 1.5rem;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    font-size: 1.1rem;
    text-decoration: none;
    color: white;
}

.navbar-brand .brand-icon {
    width: 38px;
    height: 38px;
    background: rgba(255,255,255,0.2);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.navbar-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.navbar-user .avatar {
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,0.25);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
}

.btn-logout {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    padding: 0.4rem 0.9rem;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: var(--transition);
}

.btn-logout:hover {
    background: rgba(255,255,255,0.25);
    color: white;
}

/* ---- HOME / DASHBOARD ---- */
.main-content {
    padding: 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
}

.page-header {
    margin-bottom: 1.75rem;
}

.page-header h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
}

.page-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1.75rem;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: var(--transition);
}

.stat-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.stat-icon.blue   { background: #dbeeff; color: var(--primary); }
.stat-icon.green  { background: #d4f5d4; color: var(--success); }
.stat-icon.orange { background: #fdecd4; color: var(--accent); }
.stat-icon.purple { background: #ede4ff; color: #7c3aed; }

.stat-info h3 {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 0.2rem;
}

.stat-info p {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    margin-bottom: 1.75rem;
}

.action-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    text-decoration: none;
    color: var(--text);
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    transition: var(--transition);
    border: 2px solid transparent;
}

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

.action-card-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.action-card-icon.primary  { background: #dbeeff; color: var(--primary); }
.action-card-icon.success  { background: #d4f5d4; color: var(--success); }
.action-card-icon.accent   { background: #fdecd4; color: var(--accent); }
.action-card-icon.purple   { background: #ede4ff; color: #7c3aed; }

.action-card-body h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.action-card-body p {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.section-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 1rem;
}

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

.section-card-header h3 {
    font-size: 1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-card-header h3 i {
    color: var(--primary);
}

.btn-sm {
    padding: 0.35rem 0.85rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border: 2px solid var(--primary);
    color: var(--primary);
    background: transparent;
}

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

.appointment-list {
    padding: 0.5rem 0;
}

.appointment-item {
    padding: 0.85rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
}

.appointment-item:last-child {
    border-bottom: none;
}

.appointment-item:hover {
    background: var(--bg);
}

.appt-time {
    text-align: center;
    min-width: 60px;
    flex-shrink: 0;
}

.appt-time .time {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--primary);
    display: block;
}

.appt-time .date {
    font-size: 0.72rem;
    color: var(--text-muted);
}

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

.appt-info .patient-name {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.appt-info .service {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.badge {
    padding: 0.25rem 0.65rem;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    flex-shrink: 0;
}

.badge-pending    { background: #fff3cd; color: #856404; }
.badge-confirmed  { background: #d1f0d4; color: #2e7d32; }
.badge-cancelled  { background: #fde8ea; color: var(--danger); }

.empty-state {
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.empty-state i {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 0.5rem;
    opacity: 0.4;
}

/* ---- ANIMATIONS ---- */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeInUp 0.4s ease both;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 640px) {
    .navbar {
        padding: 0 1rem;
        height: 58px;
    }
    .navbar-brand span.brand-name {
        display: none;
    }
    .navbar-user .user-name {
        display: none;
    }
    .main-content {
        padding: 1rem;
    }
    .login-card {
        padding: 2rem 1.25rem;
    }
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .cards-grid {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 641px) and (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ---- PACIENTES ---- */
.btn-back {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
    text-decoration: none;
    transition: var(--transition);
    flex-shrink: 0;
}
.btn-back:hover { background: var(--primary); color: white; border-color: var(--primary); }

.btn-cancel {
    padding: 0.75rem 1.5rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    background: transparent;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: var(--transition);
}
.btn-cancel:hover { border-color: var(--danger); color: var(--danger); }

.btn-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: var(--bg);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.8rem;
    transition: var(--transition);
}
.btn-icon:hover { background: var(--primary); color: white; border-color: var(--primary); }

.form-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.form-section {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}
.form-section:last-of-type { border-bottom: none; }

.form-section-title {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--primary);
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-select {
    appearance: none;
    cursor: pointer;
}

.is-invalid { border-color: var(--danger) !important; }
.field-error { color: var(--danger); font-size: 0.78rem; margin-top: 0.3rem; }
.required { color: var(--danger); }

.edad-display {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 1rem 0.75rem 1rem;
    border: 2px dashed var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.9rem;
    min-height: 48px;
    transition: var(--transition);
}
.edad-display.edad-activa {
    border-style: solid;
    border-color: var(--primary-light);
    color: var(--primary-dark);
    font-weight: 600;
    background: #f0f8ff;
}
.edad-display i { color: var(--primary); font-size: 1rem; flex-shrink: 0; }

.form-actions {
    padding: 1.25rem 1.5rem;
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    border-top: 1px solid var(--border);
    background: var(--bg);
    flex-wrap: wrap;
}

/* Lista de pacientes */
.paciente-list { padding: 0.25rem 0; }

.paciente-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.9rem 1.25rem;
    text-decoration: none;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
    cursor: pointer;
}
.paciente-item:last-child { border-bottom: none; }
.paciente-item:hover { background: var(--bg); }

.paciente-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.paciente-avatar-lg {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.6rem;
    margin: 0 auto;
    box-shadow: 0 4px 15px rgba(46,134,171,0.3);
}

.paciente-info { flex: 1; min-width: 0; }
.paciente-nombre { font-weight: 600; font-size: 0.95rem; }
.paciente-meta {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 0.2rem;
    font-size: 0.78rem;
    color: var(--text-muted);
}
.paciente-meta span { display: flex; align-items: center; gap: 0.3rem; }

.paciente-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}
.text-muted { color: var(--text-muted); font-size: 0.8rem; }

/* Detalle */
.detalle-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    border-top: 1px solid var(--border);
}
.detalle-item {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    border-right: 1px solid var(--border);
}
.detalle-item:nth-child(even) { border-right: none; }
.detalle-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.detalle-label i { color: var(--primary); }
.detalle-valor { font-weight: 600; font-size: 0.95rem; }

@media (max-width: 640px) {
    .field-row { grid-template-columns: 1fr; }
    .detalle-grid { grid-template-columns: 1fr; }
    .detalle-item { border-right: none; }
    .paciente-meta { flex-direction: column; gap: 0.2rem; }
    .form-actions { justify-content: stretch; }
    .form-actions .btn-cancel,
    .form-actions .btn-primary { flex: 1; justify-content: center; }
}

/* ---- BOTONES ACCIONES CITAS (home) ---- */
.btn-accion {
    padding: .3rem .75rem;
    border-radius: 20px;
    border: none;
    font-size: .75rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    transition: var(--transition);
    white-space: nowrap;
}
.btn-confirmar {
    background: #d1f0d4;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
}
.btn-confirmar:hover { background: #4CAF50; color: white; }

.btn-cancelar {
    background: #fde8ea;
    color: var(--danger);
    border: 1px solid #f5c2c7;
}
.btn-cancelar:hover { background: var(--danger); color: white; }

.badge-confirmed { background: #d1f0d4; color: #2e7d32; border: 1px solid #a5d6a7; }
.badge-cancelled { background: #fde8ea; color: var(--danger); border: 1px solid #f5c2c7; }

@media (max-width: 640px) {
    .btn-accion span { display: none; }
    .appt-time .date { font-size: .65rem; }
}

/* ---- CUMPLEAÑOS ---- */
.cumple-hoy {
    background: linear-gradient(90deg, #fff8f0, #fff);
    border-left: 3px solid var(--accent);
}
.badge-hoy {
    background: linear-gradient(135deg, var(--accent), #e07a30);
    color: white;
    padding: .25rem .7rem;
    border-radius: 20px;
    font-size: .75rem;
    font-weight: 700;
    animation: pulse-hoy 1.5s ease-in-out infinite;
}
@keyframes pulse-hoy {
    0%, 100% { box-shadow: 0 0 0 0 rgba(244,162,97,.5); }
    50%       { box-shadow: 0 0 0 6px rgba(244,162,97,0); }
}
