/**
 * Components Styles
 * Estilos específicos de componentes reutilizáveis
 * Note: @apply removed — project uses Tailwind CDN without build step
 */

/* ── Sidebar Component ── */
.sidebar {
    width: 256px;
    transition: transform 0.3s ease;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #f1f5f9;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0.75rem;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid #f1f5f9;
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    z-index: 30;
}

/* ── Header Component ── */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid #f1f5f9;
    position: sticky;
    top: 0;
    z-index: 30;
}

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

@media (min-width: 1024px) {
    .header-content { padding: 0.625rem 1.5rem; }
}

.search-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4375rem 0.875rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    width: 18rem;
    transition: all 0.15s ease;
}

.search-bar:focus-within {
    border-color: #0d9488;
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.08);
    background: #ffffff;
}

.search-bar input {
    background: transparent;
    border: none;
    outline: none;
    font-size: 0.875rem;
    color: #334155;
    width: 100%;
}

.search-bar input::placeholder { color: #94a3b8; }

/* ── Dropdown Menu ── */
.dropdown-menu {
    position: absolute;
    right: 0;
    margin-top: 0.5rem;
    min-width: 11rem;
    background: #ffffff;
    border-radius: 0.75rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 4px 10px -5px rgba(0, 0, 0, 0.04);
    border: 1px solid #f1f5f9;
    padding: 0.375rem;
    z-index: 50;
    animation: slideIn 0.15s ease-out;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
    color: #334155;
    cursor: pointer;
    transition: background 0.1s ease, color 0.1s ease;
    border-radius: 0.5rem;
    text-decoration: none;
}

.dropdown-item:hover { background: #f8fafc; color: #0f172a; }
.dropdown-item.danger { color: #dc2626; }
.dropdown-item.danger:hover { background: #fef2f2; }

.dropdown-divider { margin: 0.25rem 0; border-top: 1px solid #f1f5f9; }

/* ── Modal Overlay (modern) ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 900;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: overlay-in 0.2s ease;
}

@keyframes overlay-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ── Modal Component (legacy + modern combined) ── */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 900;
    padding: 1rem;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease-out;
}

.modal-content {
    background: #ffffff;
    border-radius: 1rem;
    max-height: 90vh;
    width: 100%;
    max-width: 540px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    animation: modal-in 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid #f1f5f9;
}

@keyframes modal-in {
    from { opacity: 0; transform: scale(0.95) translateY(8px); }
    to   { opacity: 1; transform: scale(1)    translateY(0); }
}

.modal-content.modal-lg { max-width: 720px; }
.modal-content.modal-xl { max-width: 900px; }

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.modal-header h3 { font-size: 1rem; font-weight: 600; color: #0f172a; }

.modal-title {
    font-size: 1rem;
    font-weight: 600;
    color: #0f172a;
}

/* Unified close button (supports both .modal-close and .modal-close-btn) */
.modal-close,
.modal-close-btn {
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.375rem;
    color: #94a3b8;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.modal-close:hover,
.modal-close-btn:hover {
    background: #f1f5f9;
    color: #475569;
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #f1f5f9;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
    background: #f8fafc;
    border-radius: 0 0 1rem 1rem;
}

/* ── Form Components ── */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #334155;
    margin-bottom: 0.375rem;
    letter-spacing: -0.01em;
}

.form-label .required { color: #ef4444; margin-left: 2px; }

.form-input {
    width: 100%;
    padding: 0.5625rem 0.875rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    color: #1e293b;
    background: #ffffff;
    transition: border-color 0.15s, box-shadow 0.15s;
    outline: none;
    line-height: 1.5;
}

.form-input:hover { border-color: #cbd5e1; }
.form-input:focus {
    border-color: #0d9488;
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.12);
}
.form-input::placeholder { color: #94a3b8; }
.form-input:disabled { background: #f8fafc; color: #94a3b8; cursor: not-allowed; }

.form-select {
    width: 100%;
    padding: 0.5625rem 2.25rem 0.5625rem 0.875rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    color: #1e293b;
    background: #ffffff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") no-repeat right 0.625rem center;
    appearance: none;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    cursor: pointer;
}

.form-select:focus {
    border-color: #0d9488;
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.12);
}

/* Modal input */
.modal-input {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    color: #1e293b;
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
    outline: none;
}
.modal-input:focus {
    border-color: #0d9488;
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.12);
}
.modal-input::placeholder { color: #94a3b8; }

.modal-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #475569;
    margin-bottom: 0.375rem;
}
.modal-label .required { color: #ef4444; margin-left: 2px; }

/* Form validation */
.input-error {
    border-color: #ef4444;
    box-shadow: 0 0 0 1px #ef4444;
}

.field-error {
    color: #ef4444;
    font-size: 0.75rem;
    margin-top: 0.25rem;
    min-height: 1rem;
}

.form-input-error {
    border-color: #ef4444;
}
.form-input-error:focus {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.form-error {
    font-size: 0.875rem;
    color: #dc2626;
    margin-top: 0.25rem;
}

.form-help {
    font-size: 0.875rem;
    color: #64748b;
    margin-top: 0.25rem;
}

/* ── Tabs Component ── */
.tabs {
    border-bottom: 1px solid #e2e8f0;
}

.tabs-list {
    display: flex;
    gap: 0.5rem;
}

.tab {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #64748b;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    white-space: nowrap;
}
.tab:hover { color: #0f172a; border-bottom-color: #d1d5db; }
.tab.active { color: #0d9488; border-bottom-color: #0d9488; }
.tab-active  { color: #0d9488; border-bottom: 2px solid #0d9488; }

.tab-content { padding: 1rem 0; }

/* ── Card Component ── */
.card {
    background: #ffffff;
    border-radius: 0.75rem;
    border: 1px solid #f1f5f9;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.03);
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.card-header {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: #0f172a;
    letter-spacing: -0.01em;
}

.card-description { font-size: 0.875rem; color: #64748b; margin-top: 0.25rem; }

.card-body { padding: 1rem; }

.card-footer {
    padding: 1rem;
    border-top: 1px solid #f1f5f9;
}

/* ── Avatar Component ── */
.avatar {
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.avatar-sm  { width: 2rem;   height: 2rem;   font-size: 0.75rem; }
.avatar-md  { width: 2.5rem; height: 2.5rem; font-size: 0.875rem; }
.avatar-lg  { width: 3rem;   height: 3rem;   font-size: 1rem; }
.avatar-xl  { width: 4rem;   height: 4rem;   font-size: 1.125rem; }
.avatar-2xl { width: 5rem;   height: 5rem;   font-size: 1.5rem; }

.avatar-fallback {
    background: #ccfbf1;
    color: #0f766e;
    font-weight: 600;
}

/* ── Alert Component ── */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.alert-info    { background: #f0fdfa; border: 1px solid #99f6e4; color: #134e4a; }
.alert-success { background: #f0fdf4; border: 1px solid #86efac; color: #166534; }
.alert-warning { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.alert-error   { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }

/* ── Tooltip ── */
.tooltip {
    position: absolute;
    z-index: 50;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    color: #ffffff;
    background: #1e293b;
    border-radius: 0.25rem;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    animation: fadeIn 0.2s ease-out;
    white-space: nowrap;
    pointer-events: none;
}

/* ── Loading Spinner ── */
.spinner {
    display: inline-block;
    border-radius: 50%;
    border: 2px solid transparent;
    border-top-color: currentColor;
    animation: spin 0.6s linear infinite;
    flex-shrink: 0;
}
.spinner-sm { width: 1rem;   height: 1rem; }
.spinner-md { width: 1.5rem; height: 1.5rem; }
.spinner-lg { width: 2rem;   height: 2rem; }

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

/* ── Table Container & Data Table ── */
.table-container {
    border-radius: 0.75rem;
    border: 1px solid #f1f5f9;
    overflow: hidden;
    overflow-x: auto;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.875rem;
}

.data-table thead th {
    background: #f8fafc;
    color: #64748b;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e2e8f0;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 1;
    text-align: left;
}

.data-table tbody td {
    padding: 0.875rem 1rem;
    color: #374151;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: #f8fafc; }

.data-table .row-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    justify-content: flex-end;
    opacity: 0;
    transition: opacity 0.15s ease;
}
.data-table tbody tr:hover .row-actions { opacity: 1; }

/* Legacy data table helpers */
.data-table-header { background: #f8fafc; border-bottom: 1px solid #e2e8f0; }
.data-table-row    { border-bottom: 1px solid #f1f5f9; transition: background 0.15s ease; }
.data-table-row:hover { background: #f8fafc; }
.data-table-cell   { padding: 0.75rem 1rem; font-size: 0.875rem; color: #64748b; }
.data-table-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* ── Pagination ── */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.pagination-button {
    padding: 0.25rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    background: #ffffff;
    color: #374151;
}
.pagination-button:hover { background: #f8fafc; }
.pagination-button:disabled { opacity: 0.5; cursor: not-allowed; }
.pagination-button.active {
    background: #0d9488;
    color: #ffffff;
    border-color: #0d9488;
}

/* ── Stats Card (legacy) ── */
.stat-card {
    background: #ffffff;
    border-radius: 0.75rem;
    padding: 1.25rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    border: 1px solid #f1f5f9;
    transition: all 0.2s ease;
}
.stat-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); transform: translateY(-1px); }

.stat-icon {
    padding: 0.625rem;
    border-radius: 0.75rem;
    margin-bottom: 0.75rem;
    display: inline-flex;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.25;
}

.stat-label { font-size: 0.875rem; color: #64748b; margin-top: 0.125rem; }

.stat-trend { display: flex; align-items: center; gap: 0.25rem; font-size: 0.75rem; font-weight: 500; }
.stat-trend.positive { color: #059669; }
.stat-trend.negative { color: #dc2626; }

/* ── Timeline ── */
.timeline {
    position: relative;
    padding-left: 2rem;
}

.timeline::before {
    content: "";
    position: absolute;
    left: 0.5rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #e2e8f0;
}

.timeline-item { position: relative; margin-bottom: 1.5rem; }

.timeline-dot {
    position: absolute;
    left: -1.75rem;
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    background: #0d9488;
    border: 4px solid #ffffff;
    box-shadow: 0 0 0 1px #e2e8f0;
}

.timeline-content {
    background: #ffffff;
    border-radius: 0.5rem;
    padding: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    border: 1px solid #f1f5f9;
}

/* ── File Upload ── */
.file-upload {
    border: 2px dashed #d1d5db;
    border-radius: 0.5rem;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #64748b;
}

.file-upload:hover { border-color: #0d9488; background: #f0fdfa; color: #0d9488; }
.file-upload.dragover { border-color: #0d9488; background: #f0fdfa; }

/* ── Switch/Toggle ── */
.switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    height: 1.5rem;
    width: 2.75rem;
    border-radius: 9999px;
    transition: background 0.2s ease;
    cursor: pointer;
}

.switch.checked   { background: #0d9488; }
.switch.unchecked { background: #d1d5db; }

.switch-thumb {
    display: inline-block;
    height: 1rem;
    width: 1rem;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
    transform: translateX(0.25rem);
    transition: transform 0.2s ease;
}

.switch.checked .switch-thumb { transform: translateX(1.5rem); }

/* ── Breadcrumb ── */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #64748b;
}

.breadcrumb-item { display: flex; align-items: center; gap: 0.5rem; }
.breadcrumb-separator { color: #94a3b8; }
.breadcrumb-item.active { color: #0f172a; font-weight: 500; }

/* ── Data Field ── */
.data-field { margin-bottom: 0.875rem; }
.data-field:last-child { margin-bottom: 0; }

.data-field-label {
    font-size: 0.6875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #94a3b8;
    margin-bottom: 0.2rem;
}

.data-field-value {
    font-size: 0.875rem;
    font-weight: 500;
    color: #1e293b;
    line-height: 1.4;
}

.data-field-value.empty { color: #94a3b8; font-style: italic; font-weight: 400; }

/* ── Notification Toast ── */
.notification-toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.125rem;
    border-radius: 0.75rem;
    box-shadow: 0 10px 25px -5px rgba(0,0,0,0.15), 0 4px 10px -5px rgba(0,0,0,0.08);
    max-width: 22rem;
    font-size: 0.875rem;
    font-weight: 500;
    animation: toast-slide-in 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid transparent;
}

@keyframes toast-slide-in {
    from { opacity: 0; transform: translateX(2rem); }
    to   { opacity: 1; transform: translateX(0); }
}

.notification-toast.success { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.notification-toast.error   { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.notification-toast.warning { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.notification-toast.info    { background: #f0fdfa; color: #134e4a; border-color: #99f6e4; }

.notification-toast-icon { flex-shrink: 0; width: 1.25rem; height: 1.25rem; }

.notification-toast-close {
    margin-left: auto;
    flex-shrink: 0;
    width: 1.25rem;
    height: 1.25rem;
    opacity: 0.6;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.notification-toast-close:hover { opacity: 1; }

/* ── Card accent colors ── */
.card-accent-teal    { border-left: 3px solid #0d9488; }
.card-accent-emerald { border-left: 3px solid #059669; }
.card-accent-amber   { border-left: 3px solid #d97706; }
.card-accent-red     { border-left: 3px solid #dc2626; }
.card-accent-purple  { border-left: 3px solid #7c3aed; }
.card-accent-blue    { border-left: 3px solid #3b82f6; }
.card-accent-slate   { border-left: 3px solid #64748b; }

/* ── Stepper ── */
.stepper {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.stepper-step {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stepper-circle {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.stepper-step.active    .stepper-circle { background: #0d9488; color: #ffffff; }
.stepper-step.completed .stepper-circle { background: #059669; color: #ffffff; }
.stepper-step.pending   .stepper-circle { background: #e2e8f0; color: #64748b; }

.stepper-line { flex: 1; height: 2px; background: #e2e8f0; margin: 0 1rem; }
.stepper-step.completed + .stepper-step .stepper-line { background: #059669; }

/* ── Vital Sign Cards ── */
.vital-sign-card {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 2px solid #e2e8f0;
    border-radius: 0.75rem;
    padding: 1rem;
    text-align: center;
    transition: all 0.2s;
}
.vital-sign-card:hover { border-color: #0d9488; transform: translateY(-2px); }

/* ── Section title ── */
.section-title {
    font-size: 1rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.section-title.mb-0 { margin-bottom: 0; }
