:root {
    --primary-color: #a0756c;
    --primary-hover: #8c635b;
    --secondary-color: #e5d0bc;
    --text-color: #4a4b4e;
    --text-muted: #8b8986;
    --border-color: #d8d4d0;
    --bg-color: #ffffff;
    --bg-page: #f4f0ec;
    --danger: #c46b6b;
    --success: #6c8c6a;
    --radius: 8px;
    --shadow: 0 4px 6px rgba(0,0,0,0.05);
    --shadow-hover: 0 10px 15px rgba(0,0,0,0.1);
    --font-family: 'Inter', system-ui, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-family);
}

body {
    background-color: var(--bg-page);
    color: var(--text-color);
    line-height: 1.6;
}

.hidden {
    display: none !important;
}

/* Header & Nav */
header {
    background-color: var(--bg-color);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

nav {
    display: flex;
    gap: 1rem;
    align-items: center;
}

nav button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-color);
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    transition: all 0.3s ease;
}

nav button:hover {
    background-color: rgba(160, 117, 108, 0.05);
}

nav button.active {
    color: var(--primary-color);
    background-color: rgba(160, 117, 108, 0.1);
}

/* Buttons */
.btn-primary {
    background-color: var(--primary-color);
    color: white !important;
    border: none;
    border-radius: var(--radius);
    padding: 0.6rem 1.2rem;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.3s, transform 0.1s;
}

.btn-primary:active {
    transform: scale(0.98);
}

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

.btn-danger {
    background-color: white;
    color: var(--danger);
    border: 1px solid var(--danger);
    border-radius: var(--radius);
    padding: 0.4rem 1rem;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}
.btn-danger:hover {
    background-color: var(--danger);
    color: white;
}

.btn-outline {
    background-color: transparent;
    color: var(--primary-color) !important;
    border: 2px solid var(--primary-color);
    border-radius: var(--radius);
    padding: 0.6rem 1.2rem;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
    text-align: center;
    display: inline-block;
}
.btn-outline:hover {
    background-color: rgba(160, 117, 108, 0.1);
}

.btn-primary.large {
    font-size: 1.1rem;
    padding: 0.8rem 2rem;
}

.full-width {
    width: 100%;
}

/* Views */
.view {
    display: none;
    animation: fadeIn 0.4s ease-in-out;
}

.view.active {
    display: block;
}

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

main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 4rem 2rem;
    background: linear-gradient(135deg, rgba(160, 117, 108, 0.1) 0%, rgba(229, 208, 188, 0.1) 100%);
    border-radius: var(--radius);
    margin-bottom: 3rem;
}

.hero h1 {
    font-size: 3rem;
    color: var(--primary-hover);
    margin-bottom: 1rem;
}

.hero p {
    font-size: 1.2rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

/* Specialties Grid */
.specialties {
    text-align: center;
}

.specialties h2 {
    margin-bottom: 2rem;
    color: var(--primary-hover);
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.card {
    background: var(--bg-color);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: transform 0.3s, box-shadow 0.3s;
    text-align: center;
}

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

.card i {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.card h3 {
    margin-bottom: 0.5rem;
}

/* Form */
.form-container, .panel-container {
    background: var(--bg-color);
    padding: 2.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    max-width: 700px;
    margin: 0 auto;
}

.panel-container {
    max-width: 1000px;
}

h2 {
    margin-bottom: 1.5rem;
    color: var(--primary-hover);
}

.form-group {
    margin-bottom: 1.2rem;
    display: flex;
    flex-direction: column;
}

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

label {
    font-weight: 600;
    margin-bottom: 0.4rem;
    color: var(--text-color);
    font-size: 0.9rem;
}

input, select {
    padding: 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: border-color 0.3s, box-shadow 0.3s;
    background-color: var(--bg-color);
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(160, 117, 108, 0.2);
}

input:disabled, select:disabled {
    background-color: var(--bg-page);
    cursor: not-allowed;
    color: var(--text-muted);
}

.divider {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 2rem 0;
}

h3 {
    margin-bottom: 1rem;
    color: var(--primary-hover);
}

/* Panel & Table */
.panel-controls {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1rem;
}

.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    background-color: var(--secondary-color);
    font-weight: 600;
    color: var(--text-color);
}

tr:hover {
    background-color: rgba(160, 117, 108, 0.05);
}

.text-center { text-align: center; }
.padded { padding: 3rem 1rem; }
.text-muted { color: var(--text-muted); }
.large-icon { font-size: 4rem; margin-bottom: 1rem; }
.huge-icon { font-size: 5rem; margin-bottom: 1rem; }
.text-success { color: var(--success); }

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-weight: 500;
    animation: fadeIn 0.3s ease;
}
.alert-error {
    background-color: #fcebeb;
    color: #a34141;
    border: 1px solid #f2c7c7;
}

/* Modal */
.modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 3rem;
    border-radius: var(--radius);
    text-align: center;
    box-shadow: var(--shadow-hover);
    max-width: 400px;
    animation: zoomIn 0.3s ease;
    margin: 1rem;
}

@keyframes zoomIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.details-box {
    background: var(--bg-page);
    padding: 1rem;
    border-radius: var(--radius);
    margin: 1.5rem 0;
    text-align: left;
    font-size: 0.95rem;
    color: var(--text-color);
}

/* =========================================
   RESPONSIVE (Celulares y Tablets pequeñas) 
   ========================================= */
@media (max-width: 768px) {
    main {
        padding: 1rem; /* Menos espacio muerto en celulares */
    }

    .form-row {
        grid-template-columns: 1fr;
    }
    
    header {
        flex-direction: column;
        gap: 1rem;
        padding: 1.5rem 1rem;
        position: relative; /* Desactiva el menu flotante en celular que roba espacio */
        text-align: center;
    }
    
    .hero {
        padding: 2rem 1rem; /* Achicar el banner principal */
        margin-bottom: 2rem;
    }

    .hero h1 {
        font-size: 1.8rem;
    }
    
    .hero p {
        font-size: 1rem;
    }

    /* Mejora enorme de botonera en celular (Grilla tipo Dashboard) */
    nav {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }

    nav button {
        width: 100%;
        margin: 0 !important;
        padding: 0.6rem 0.2rem;
        font-size: 0.9rem;
    }

    /* Hacer el contenedor de Login y Form general más ajustado al celular */
    .form-container, .panel-container {
        padding: 1.5rem 1rem;
        border: 1px solid var(--border-color);
        box-shadow: none;
    }

    /* Tabla tipo Tarjetas en Celular */
    table, thead, tbody, th, td, tr { 
        display: block; 
    }
    thead tr { 
        position: absolute;
        top: -9999px;
        left: -9999px;
    }
    tr { 
        border: 1px solid var(--border-color); 
        margin-bottom: 1.5rem; 
        border-radius: var(--radius);
        background-color: var(--bg-color);
        box-shadow: var(--shadow);
    }
    tr:hover {
        background-color: var(--bg-color);
    }
    td { 
        border: none;
        border-bottom: 1px solid var(--border-color); 
        position: relative;
        padding: 0.8rem 1rem 0.8rem 45%; 
        min-height: 2.8rem;
        word-wrap: break-word;
    }
    td:last-child {
        border-bottom: none;
    }
    td:before { 
        position: absolute;
        top: 0.8rem;
        left: 1rem;
        width: 40%; 
        padding-right: 10px; 
        white-space: nowrap;
        font-weight: 600;
        color: var(--primary-hover);
        font-size: 0.9rem;
    }
    td:nth-of-type(1):before { content: "Turno:"; }
    td:nth-of-type(2):before { content: "Paciente:"; }
    td:nth-of-type(3):before { content: "Especialidad:"; }
    td:nth-of-type(4):before { content: "Profesional:"; }
    td:nth-of-type(5):before { content: "Contacto:"; }
}
