:root {
    --primary-color: #0D8ABC;
    --primary-light: #48B0DF;
    --primary-dark: #075E82;
    --secondary-color: #F39C12;
    --success-color: #2ECC71;
    --bg-color: #F0F4F8;
    --text-main: #2C3E50;
    --text-muted: #7F8C8D;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.4);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1);
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 8px;
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
    position: relative;
    /* Animated subtle background gradient */
    background: linear-gradient(-45deg, #e0f2fe, #f0f9ff, #e6f7ff, #f3f4f6);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Glassmorphism Utilities */
.glass-panel, .glass-card, .glass-header, .glass-nav {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
}

/* Base Layout Container */
#app {
    width: 100%;
    height: 100%;
    position: relative;
    max-width: 600px; /* Constrain for web view of mobile app */
    margin: 0 auto;
    background: transparent;
    overflow: hidden;
}

.view {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transition: opacity 0.4s ease, transform 0.4s ease;
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
}

.view.active {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0);
}

/* ===== Login View ===== */
#login-view {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    z-index: 100;
}

.login-card {
    width: 100%;
    max-width: 400px;
    padding: 40px 30px;
    border-radius: var(--radius-lg);
    text-align: center;
    position: relative;
    z-index: 2;
}

.logo-container {
    margin-bottom: 10px;
}

.logo-icon {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 15px;
    filter: drop-shadow(0 4px 6px rgba(13, 138, 188, 0.3));
}

.login-card h1 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-main);
}

.subtitle {
    color: var(--text-muted);
    margin-bottom: 30px;
    font-size: 0.95rem;
}

.input-group {
    position: relative;
    margin-bottom: 20px;
}

.input-group i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.input-group input {
    width: 100%;
    padding: 15px 15px 15px 45px;
    border: none;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.6);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
    font-size: 1rem;
    color: var(--text-main);
    transition: var(--transition);
}

.input-group input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 0 2px var(--primary-light);
}

.btn-primary {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(13, 138, 188, 0.3);
    transition: var(--transition);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(13, 138, 188, 0.4);
}

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

/* Background Shapes for Login */
.background-shapes {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 1;
}

.shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(40px);
    opacity: 0.5;
}

.shape-1 {
    width: 300px;
    height: 300px;
    background: var(--primary-light);
    top: -100px;
    right: -100px;
    animation: float 8s ease-in-out infinite;
}

.shape-2 {
    width: 250px;
    height: 250px;
    background: var(--secondary-color);
    bottom: -50px;
    left: -100px;
    animation: float 10s ease-in-out infinite reverse;
}

@keyframes float {
    0% { transform: translate(0, 0); }
    50% { transform: translate(20px, 30px); }
    100% { transform: translate(0, 0); }
}

/* ===== Main App Layout ===== */
#main-layout {
    display: flex;
    flex-direction: column;
}

/* Header */
.glass-header {
    padding: 20px;
    padding-top: max(20px, env(safe-area-inset-top)); /* For notch */
    border-bottom-left-radius: var(--radius-lg);
    border-bottom-right-radius: var(--radius-lg);
    z-index: 10;
}

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

.header-content h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-dark);
}

.avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    cursor: pointer;
}

/* Content Area */
.content-area {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    padding-bottom: 100px; /* Space for bottom nav */
    position: relative;
}

/* Hide scrollbar for clean look */
.content-area::-webkit-scrollbar {
    display: none;
}
.content-area {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.sub-view {
    display: none;
    animation: fadeIn 0.3s ease;
}

.sub-view.active {
    display: block;
}

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

/* Agenda View */
.date-selector {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.icon-btn {
    background: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    cursor: pointer;
    transition: var(--transition);
}

.icon-btn:active {
    transform: scale(0.9);
}

.current-date {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-main);
}

.date-input {
    background: transparent;
    border: none;
    text-align: center;
    cursor: pointer;
    font-family: inherit;
    outline: none;
}
/* Ocultar el ícono de calendario por defecto en Chrome/Safari */
.date-input::-webkit-calendar-picker-indicator {
    background: transparent;
    bottom: 0;
    color: transparent;
    cursor: pointer;
    height: auto;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
    width: auto;
}

.stats-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 25px;
}

.stat-card {
    padding: 15px;
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 5px;
    font-weight: 500;
}

.section-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--text-main);
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.spin {
    animation: spin 1s linear infinite;
}

/* Appointment List */
.appointment-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.appointment-card {
    background: white;
    border-radius: var(--radius-md);
    padding: 15px;
    display: flex;
    align-items: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
    transition: var(--transition);
    border-left: 4px solid var(--primary-color);
    cursor: pointer;
}

.appointment-card:active {
    transform: scale(0.98);
}

.appointment-card.completed {
    border-left-color: var(--success-color);
    opacity: 0.7;
}

.time-slot {
    min-width: 65px;
    text-align: center;
    padding-right: 15px;
    border-right: 1px solid #eee;
}

.time-slot .time {
    font-weight: 700;
    color: var(--text-main);
    display: block;
}

.time-slot .duration {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.patient-info {
    flex: 1;
    padding-left: 15px;
}

.patient-name {
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 4px;
}

.treatment-type {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.status-icon {
    color: var(--text-muted);
    font-size: 1.2rem;
}

.completed .status-icon {
    color: var(--success-color);
}

/* Patient Detail View */
.back-btn {
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.patient-header {
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 20px;
}

.patient-info-main h2 {
    font-size: 1.5rem;
    margin-bottom: 5px;
}

.badge {
    display: inline-block;
    padding: 4px 8px;
    background: rgba(13, 138, 188, 0.1);
    color: var(--primary-color);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
}

.action-buttons {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.btn-secondary, .btn-success {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
}

.btn-secondary {
    background: white;
    color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.btn-success {
    background: var(--success-color);
    color: white;
    box-shadow: 0 4px 15px rgba(46, 204, 113, 0.3);
}

.btn-secondary:active, .btn-success:active {
    transform: scale(0.96);
}

.patient-history {
    border-radius: var(--radius-lg);
    padding: 20px;
}

.patient-history h3 {
    font-size: 1.1rem;
    margin-bottom: 15px;
    color: var(--text-main);
}

.history-list {
    list-style: none;
}

.history-item {
    padding: 15px 0;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.history-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.history-date {
    font-size: 0.85rem;
    color: var(--primary-color);
    font-weight: 600;
    margin-bottom: 5px;
}

.history-note {
    font-size: 0.95rem;
    color: var(--text-main);
    line-height: 1.4;
}

.history-therapist {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 5px;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Bottom Navigation */
.bottom-nav {
    position: absolute;
    bottom: 20px;
    left: 20px;
    right: 20px;
    height: 70px;
    border-radius: 35px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-muted);
    transition: var(--transition);
    position: relative;
    width: 60px;
}

.nav-item i {
    font-size: 1.2rem;
    margin-bottom: 4px;
    transition: var(--transition);
}

.nav-item span {
    font-size: 0.7rem;
    font-weight: 500;
    transition: var(--transition);
}

.nav-item.active {
    color: var(--primary-color);
}

.nav-item.active i {
    transform: translateY(-5px);
    font-size: 1.4rem;
}

.nav-item.active span {
    opacity: 1;
    transform: translateY(-2px);
}

.nav-item::after {
    content: '';
    position: absolute;
    bottom: -10px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--primary-color);
    opacity: 0;
    transition: var(--transition);
}

.nav-item.active::after {
    opacity: 1;
    bottom: -5px;
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    z-index: 200;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-content {
    width: 100%;
    max-width: 500px;
    padding: 25px;
}

.modal-content h3 {
    margin-bottom: 20px;
    color: var(--primary-dark);
}
