/* AgendaMed.cl Global Stylesheet */
/* Premium design system utilizing custom properties, Outfit/Inter typography, and smooth transitions */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
    /* Color Palette */
    --primary: hsl(172, 94%, 31%); /* Teal #0d9488 */
    --primary-hover: hsl(172, 94%, 25%);
    --primary-light: hsl(172, 94%, 95%);
    --secondary: hsl(215, 25%, 27%);
    --accent: hsl(243, 75%, 59%); /* Indigo/Stripe style */
    --accent-light: hsl(243, 75%, 96%);
    
    /* Semantic Colors */
    --success: hsl(142, 72%, 29%);
    --success-light: hsl(142, 72%, 95%);
    --warning: hsl(38, 92%, 50%);
    --warning-light: hsl(38, 92%, 95%);
    --danger: hsl(0, 72%, 51%);
    --danger-light: hsl(0, 72%, 95%);
    
    /* Neutral Colors */
    --bg-main: hsl(210, 40%, 98%);
    --bg-card: hsl(0, 0%, 100%);
    --text-dark: hsl(215, 28%, 17%);
    --text-muted: hsl(215, 15%, 47%);
    --text-light: hsl(215, 15%, 65%);
    --border-color: hsl(214, 32%, 91%);
    --border-hover: hsl(214, 32%, 80%);

    /* Fonts */
    --font-heading: 'Outfit', 'Inter', system-ui, -apple-system, sans-serif;
    --font-body: 'Inter', system-ui, -apple-system, sans-serif;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Borders */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
}

/* Global Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-main);
    color: var(--text-dark);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    color: var(--text-dark);
    line-height: 1.25;
}

a {
    color: inherit;
    text-decoration: none;
    transition: color var(--transition-fast);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
    background: var(--text-light);
    border-radius: var(--radius-sm);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Layout Containers */
.container {
    width: 100%;
    max-width: 1200px;
    margin-right: auto;
    margin-left: auto;
    padding-right: 1.5rem;
    padding-left: 1.5rem;
}

main {
    flex-grow: 1;
}

/* Header & Navigation */
.navbar {
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    height: 70px;
    display: flex;
    align-items: center;
}

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

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

.logo span {
    color: var(--secondary);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    list-style: none;
}

.nav-link {
    font-weight: 500;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.nav-link:hover, .nav-link.active {
    color: var(--primary);
}

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

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0.65rem 1.25rem;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.btn-primary {
    background-color: var(--primary);
    color: var(--bg-card);
}
.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn-secondary {
    background-color: var(--secondary);
    color: var(--bg-card);
}
.btn-secondary:hover {
    background-color: hsl(215, 25%, 20%);
    transform: translateY(-1px);
}

.btn-outline {
    background-color: transparent;
    border-color: var(--border-color);
    color: var(--text-dark);
}
.btn-outline:hover {
    background-color: var(--bg-main);
    border-color: var(--border-hover);
}

.btn-accent {
    background-color: var(--accent);
    color: var(--bg-card);
}
.btn-accent:hover {
    background-color: hsl(243, 75%, 50%);
    transform: translateY(-1px);
}

.btn-danger {
    background-color: var(--danger);
    color: var(--bg-card);
}
.btn-danger:hover {
    background-color: hsl(0, 72%, 40%);
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    border-radius: var(--radius-sm);
}

.btn-lg {
    padding: 0.9rem 1.75rem;
    font-size: 1.05rem;
}

.btn-block {
    display: flex;
    width: 100%;
}

/* Hero Section */
.hero {
    background: radial-gradient(circle at 80% 20%, var(--primary-light) 0%, var(--bg-main) 100%);
    padding: 4.5rem 0 3.5rem 0;
    text-align: center;
}

.hero h1 {
    font-size: 3rem;
    font-weight: 800;
    max-width: 800px;
    margin: 0 auto 1rem auto;
    letter-spacing: -0.02em;
}

.hero p {
    font-size: 1.25rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto 2.5rem auto;
}

/* Buscador & Filtros */
.search-container {
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 1.5rem;
    max-width: 950px;
    margin: 0 auto 2rem auto;
    border: 1px solid var(--border-color);
}

.search-form-grid {
    display: grid;
    grid-template-columns: 2fr 2fr 1fr;
    gap: 1rem;
    align-items: end;
}

.form-group {
    display: flex;
    flex-direction: column;
    text-align: left;
    gap: 0.4rem;
}

.form-group label {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-dark);
}

.form-control {
    width: 100%;
    font-family: var(--font-body);
    font-size: 0.95rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background-color: var(--bg-main);
    color: var(--text-dark);
    outline: none;
    transition: all var(--transition-fast);
}

.form-control:focus {
    border-color: var(--primary);
    background-color: var(--bg-card);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.search-filters-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary);
    cursor: pointer;
    margin-top: 1rem;
    user-select: none;
}

.advanced-filters {
    display: none;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    text-align: left;
}

.advanced-filters.show {
    display: grid;
}

/* Grid de Profesionales */
.section-title {
    margin-bottom: 2rem;
    font-size: 1.75rem;
    position: relative;
    padding-bottom: 0.5rem;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 50px;
    height: 4px;
    background-color: var(--primary);
    border-radius: var(--radius-sm);
}

.doctors-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3.5rem;
}

/* Doctor Card */
.doc-card {
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: all var(--transition-normal);
    display: flex;
    flex-direction: column;
}

.doc-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--border-hover);
}

.doc-card-body {
    padding: 1.5rem;
    display: flex;
    gap: 1rem;
}

.doc-img-wrapper {
    position: relative;
    flex-shrink: 0;
}

.doc-img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary-light);
}

.doc-approved-badge {
    position: absolute;
    bottom: 0;
    right: 0;
    background-color: var(--primary);
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-card);
    font-size: 0.7rem;
}

.doc-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.doc-name {
    font-size: 1.15rem;
    font-weight: 700;
}

.doc-specialty {
    font-weight: 600;
    color: var(--primary);
    font-size: 0.9rem;
}

.doc-ratings {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
}

.star-rating {
    color: var(--warning);
    font-weight: bold;
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.doc-location {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.doc-meta-details {
    padding: 0 1.5rem;
    font-size: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: auto;
}

.doc-meta-item {
    display: flex;
    justify-content: space-between;
    padding-bottom: 0.5rem;
    border-bottom: 1px dashed var(--border-color);
}

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

.doc-meta-label {
    color: var(--text-muted);
}

.doc-meta-value {
    font-weight: 600;
}

.doc-card-footer {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-main);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    text-transform: capitalize;
}

.badge-primary { background-color: var(--primary-light); color: var(--primary); }
.badge-success { background-color: var(--success-light); color: var(--success); }
.badge-warning { background-color: var(--warning-light); color: var(--warning); }
.badge-danger { background-color: var(--danger-light); color: var(--danger); }
.badge-secondary { background-color: var(--border-color); color: var(--text-dark); }

/* Footer */
.footer {
    background-color: var(--secondary);
    color: var(--bg-main);
    padding: 3rem 0;
    margin-top: 4rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-col {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.footer-col h4 {
    color: var(--bg-card);
    font-family: var(--font-heading);
    font-size: 1.1rem;
}

.footer-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.footer-links a {
    color: var(--text-light);
    font-size: 0.9rem;
}

.footer-links a:hover {
    color: var(--primary-light);
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-light);
}

/* Detail Profile View */
.profile-header-card {
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    padding: 2rem;
    margin-bottom: 2rem;
    display: flex;
    gap: 2rem;
    align-items: center;
}

.profile-img-large {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--primary-light);
}

.profile-main-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.profile-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    margin-bottom: 3.5rem;
}

.profile-details-column {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.profile-card {
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
}

.profile-card h3 {
    margin-bottom: 1rem;
    font-size: 1.25rem;
    border-bottom: 2px solid var(--bg-main);
    padding-bottom: 0.5rem;
}

.profile-services-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.profile-service-item {
    display: flex;
    justify-content: space-between;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--bg-main);
}

/* Calendar Scheduler Component */
.scheduler-header {
    margin-bottom: 1rem;
}

.location-selector {
    margin-bottom: 1rem;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.5rem;
    text-align: center;
    margin-bottom: 1rem;
}

.calendar-day-header {
    font-weight: bold;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.calendar-day {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.25rem;
    cursor: pointer;
    background-color: var(--bg-main);
    transition: all var(--transition-fast);
}

.calendar-day:hover {
    border-color: var(--primary);
    background-color: var(--primary-light);
}

.calendar-day.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background-color: var(--border-color);
}

.calendar-day.selected {
    background-color: var(--primary);
    color: white;
    border-color: var(--primary);
}

.time-slots-container {
    margin-top: 1.5rem;
    max-height: 250px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    background-color: var(--bg-main);
}

.slots-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 0.5rem;
}

.time-slot {
    border: 1px solid var(--primary);
    background-color: var(--bg-card);
    color: var(--primary);
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    text-align: center;
    transition: all var(--transition-fast);
}

.time-slot:hover {
    background-color: var(--primary);
    color: white;
}

.time-slot.selected {
    background-color: var(--primary);
    color: white;
    box-shadow: var(--shadow-sm);
}

/* Reviews and Comments */
.review-stats {
    display: flex;
    align-items: center;
    gap: 2rem;
    margin-bottom: 2rem;
}

.rating-avg-large {
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1;
    color: var(--primary);
}

.rating-avg-details {
    display: flex;
    flex-direction: column;
}

.review-item {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

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

.review-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.review-author {
    font-weight: bold;
}

.review-date {
    color: var(--text-light);
    font-size: 0.85rem;
}

.review-reply {
    background-color: var(--bg-main);
    padding: 1rem;
    border-left: 4px solid var(--primary);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    margin-top: 1rem;
    font-size: 0.9rem;
}

/* Private Dashboard Shell (Admin / Doc / Patient) */
.dashboard-layout {
    display: flex;
    min-height: calc(100vh - 70px);
}

.sidebar {
    width: 260px;
    background-color: var(--secondary);
    color: var(--bg-main);
    padding: 2rem 0;
    flex-shrink: 0;
}

.sidebar-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.sidebar-item a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: var(--text-light);
    font-weight: 500;
    font-size: 0.95rem;
    transition: all var(--transition-fast);
}

.sidebar-item.active a, .sidebar-item a:hover {
    color: white;
    background-color: rgba(255, 255, 255, 0.05);
    border-left: 4px solid var(--primary);
}

.dashboard-content {
    flex-grow: 1;
    padding: 2.5rem;
    background-color: var(--bg-main);
    overflow-x: hidden;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

/* Admin / Stats Widgets */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background-color: var(--bg-card);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.stat-title {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-dark);
}

/* Tables */
.table-wrapper {
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    overflow-x: auto;
    margin-bottom: 2rem;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
}

th {
    background-color: var(--bg-main);
    padding: 1rem;
    font-weight: 600;
    color: var(--text-dark);
    border-bottom: 1px solid var(--border-color);
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-muted);
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background-color: rgba(0, 0, 0, 0.01);
}

/* Auth Pages (Login / Register) */
.auth-wrapper {
    min-height: calc(100vh - 120px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 0;
}

.auth-card {
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    width: 100%;
    max-width: 480px;
    padding: 2.5rem;
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-header h2 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

.auth-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

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

.auth-footer a {
    color: var(--primary);
    font-weight: bold;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    font-weight: 500;
}

.alert-success {
    background-color: var(--success-light);
    color: var(--success);
    border: 1px solid hsl(142, 72%, 85%);
}

.alert-danger {
    background-color: var(--danger-light);
    color: var(--danger);
    border: 1px solid hsl(0, 72%, 85%);
}

.alert-warning {
    background-color: var(--warning-light);
    color: var(--warning);
    border: 1px solid hsl(38, 92%, 85%);
}

/* Modals & Dialogs */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.modal.show {
    display: flex;
}

.modal-content {
    background-color: var(--bg-card);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 500px;
    border: 1px solid var(--border-color);
    position: relative;
}

.modal-close {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    cursor: pointer;
    font-size: 1.5rem;
    line-weight: 1;
    color: var(--text-light);
}

/* Grid Layout helpers */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }

/* Responsive adjustments */
@media (max-width: 992px) {
    .hero h1 { font-size: 2.25rem; }
    .footer-grid { grid-template-columns: 1fr 1fr; }
    .profile-grid { grid-template-columns: 1fr; }
    .search-form-grid { grid-template-columns: 1fr; gap: 1rem; }
}

@media (max-width: 768px) {
    .dashboard-layout { flex-direction: column; }
    .sidebar { width: 100%; padding: 1rem; }
    .sidebar-menu { flex-direction: row; flex-wrap: wrap; justify-content: center; }
    .dashboard-content { padding: 1.5rem; }
    .profile-header-card { flex-direction: column; text-align: center; }
    .footer-grid { grid-template-columns: 1fr; }
    .footer-bottom { flex-direction: column; gap: 1rem; text-align: center; }
    .grid-2 { grid-template-columns: 1fr; }
}
