/**
 * Estilos del Sistema de Historia Clínica Podológica
 * Centro Podológico Preventivo Pies Sanos
 */

/* ===========================
   Variables CSS
   =========================== */
:root {
    --primary-color: #2c5f7c;
    --primary-dark: #1f4456;
    --primary-light: #3d7a9c;
    --secondary-color: #f68b1f;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --info-color: #17a2b8;
    --light-bg: #f8f9fa;
    --white: #ffffff;
    --border-color: #e0e0e0;
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-muted: #999999;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.15);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.2);
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --sidebar-width: 260px;
    --transition: all 0.3s ease;
}

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

body.hcp-system-body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--light-bg);
    min-height: 100vh;
}

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

a:hover {
    color: var(--primary-dark);
}

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

/* ===========================
   Login
   =========================== */
.hcp-login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    padding: 20px;
}

.hcp-login-container {
    background: var(--white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    padding: 40px;
    width: 100%;
    max-width: 420px;
    text-align: center;
}

.hcp-login-logo {
    margin-bottom: 20px;
}

.hcp-login-logo img {
    max-height: 100px;
    width: auto;
}

.hcp-login-title {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-bottom: 30px;
    font-weight: 600;
}

.hcp-login-error {
    background: #f8d7da;
    color: #721c24;
    padding: 12px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    font-size: 14px;
}

.hcp-login-form .hcp-form-group {
    margin-bottom: 20px;
    text-align: left;
}

.hcp-login-form label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.hcp-login-form input[type="text"],
.hcp-login-form input[type="password"] {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 15px;
    transition: var(--transition);
}

.hcp-login-form input[type="text"]:focus,
.hcp-login-form input[type="password"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(44, 95, 124, 0.1);
}

.hcp-login-form .hcp-remember {
    display: flex;
    align-items: center;
}

.hcp-login-form .hcp-remember label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    margin-bottom: 0;
}

.hcp-login-form .hcp-remember input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* ===========================
   App Wrapper
   =========================== */
.hcp-app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ===========================
   Sidebar
   =========================== */
.hcp-sidebar {
    width: var(--sidebar-width);
    background: var(--white);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
}

.hcp-sidebar-header {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.hcp-sidebar-logo {
    max-height: 60px;
    width: auto;
}

.hcp-sidebar-user {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
}

.hcp-user-avatar {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 20px;
    font-weight: 600;
}

.hcp-user-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.hcp-user-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
}

.hcp-user-role {
    font-size: 11px;
    color: var(--white);
    padding: 2px 8px;
    border-radius: 10px;
    display: inline-block;
}

.hcp-sidebar-nav {
    flex: 1;
    padding: 15px 0;
    overflow-y: auto;
}

.hcp-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    color: var(--text-secondary);
    font-weight: 500;
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.hcp-nav-item:hover {
    background: var(--light-bg);
    color: var(--primary-color);
}

.hcp-nav-item.active {
    background: var(--primary-color);
    color: var(--white);
    border-left-color: var(--secondary-color);
}

.hcp-nav-icon {
    font-size: 18px;
}

.hcp-sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
}

.hcp-btn-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px;
    background: var(--light-bg);
    color: var(--danger-color);
    border-radius: var(--radius-md);
    font-weight: 500;
    transition: var(--transition);
}

.hcp-btn-logout:hover {
    background: var(--danger-color);
    color: var(--white);
}

/* ===========================
   Main Content
   =========================== */
.hcp-main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 30px;
    min-height: 100vh;
}

/* ===========================
   Page Header
   =========================== */
.hcp-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

.hcp-page-header h1 {
    font-size: 1.75rem;
    color: var(--text-primary);
    font-weight: 600;
}

.hcp-page-subtitle {
    color: var(--text-secondary);
    margin-top: 5px;
}

.hcp-back-link {
    display: inline-block;
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.hcp-back-link:hover {
    color: var(--primary-color);
}

/* ===========================
   Stats Cards
   =========================== */
.hcp-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.hcp-stat-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

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

.hcp-stat-icon {
    font-size: 36px;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
}

.hcp-stat-blue .hcp-stat-icon {
    background: rgba(44, 95, 124, 0.1);
}

.hcp-stat-green .hcp-stat-icon {
    background: rgba(40, 167, 69, 0.1);
}

.hcp-stat-orange .hcp-stat-icon {
    background: rgba(246, 139, 31, 0.1);
}

.hcp-stat-purple .hcp-stat-icon {
    background: rgba(111, 66, 193, 0.1);
}

.hcp-stat-content {
    display: flex;
    flex-direction: column;
}

.hcp-stat-number {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

.hcp-stat-label {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ===========================
   Cards
   =========================== */
.hcp-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: 20px;
}

.hcp-card-header {
    padding: 16px 20px;
    background: var(--light-bg);
    border-bottom: 1px solid var(--border-color);
}

.hcp-card-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.hcp-card-body {
    padding: 20px;
}

/* ===========================
   Section
   =========================== */
.hcp-section {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    margin-bottom: 24px;
}

.hcp-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.hcp-section-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

/* ===========================
   Tables
   =========================== */
.hcp-table-responsive {
    overflow-x: auto;
}

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

.hcp-table th,
.hcp-table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.hcp-table th {
    background: var(--light-bg);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.hcp-table tbody tr:hover {
    background: #f9fbfc;
}

.hcp-table td a {
    font-weight: 500;
}

.hcp-link-primary {
    color: var(--primary-color);
    font-weight: 500;
}

.hcp-link-primary:hover {
    text-decoration: underline;
}

/* ===========================
   Badges
   =========================== */
.hcp-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    text-transform: capitalize;
}

.hcp-badge-pendiente {
    background: #fff3cd;
    color: #856404;
}

.hcp-badge-confirmada {
    background: #d4edda;
    color: #155724;
}

.hcp-badge-atendida {
    background: #d1ecf1;
    color: #0c5460;
}

.hcp-badge-cancelada {
    background: #f8d7da;
    color: #721c24;
}

.hcp-badge-primera_vez {
    background: #e7f1ff;
    color: #004085;
}

.hcp-badge-seguimiento {
    background: #d4edda;
    color: #155724;
}

.hcp-badge-urgencia {
    background: #f8d7da;
    color: #721c24;
}

.hcp-badge-revision {
    background: #fff3cd;
    color: #856404;
}

/* ===========================
   Buttons
   =========================== */
.hcp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.hcp-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

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

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

.hcp-btn-secondary {
    background: var(--light-bg);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.hcp-btn-secondary:hover {
    background: #e9ecef;
    color: var(--text-primary);
}

.hcp-btn-success {
    background: var(--success-color);
    color: var(--white);
}

.hcp-btn-success:hover {
    background: #218838;
    color: var(--white);
}

.hcp-btn-danger {
    background: var(--danger-color);
    color: var(--white);
}

.hcp-btn-danger:hover {
    background: #c82333;
    color: var(--white);
}

.hcp-btn-info {
    background: var(--info-color);
    color: var(--white);
}

.hcp-btn-info:hover {
    background: #138496;
    color: var(--white);
}

.hcp-btn-outline {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

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

.hcp-btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.hcp-btn-block {
    width: 100%;
}

/* ===========================
   Forms
   =========================== */
.hcp-form-group {
    margin-bottom: 20px;
}

.hcp-form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.hcp-form-group input[type="text"],
.hcp-form-group input[type="email"],
.hcp-form-group input[type="tel"],
.hcp-form-group input[type="date"],
.hcp-form-group input[type="time"],
.hcp-form-group input[type="number"],
.hcp-form-group select,
.hcp-form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 14px;
    transition: var(--transition);
    font-family: inherit;
}

.hcp-form-group input:focus,
.hcp-form-group select:focus,
.hcp-form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(44, 95, 124, 0.1);
}

.hcp-form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.hcp-form-full {
    grid-column: 1 / -1;
}

.hcp-select-sm {
    padding: 6px 10px;
    font-size: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--white);
}

/* ===========================
   Search Bar
   =========================== */
.hcp-search-bar {
    margin-bottom: 20px;
}

.hcp-search-bar input {
    width: 100%;
    max-width: 400px;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 14px;
}

.hcp-search-bar input:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* ===========================
   Detail Grid
   =========================== */
.hcp-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.hcp-info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.hcp-info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.hcp-info-item label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.hcp-info-item span {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
}

.hcp-info-full {
    grid-column: 1 / -1;
}

/* ===========================
   Documents Buttons
   =========================== */
.hcp-doc-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.hcp-doc-buttons .hcp-btn {
    justify-content: flex-start;
}

/* ===========================
   Timeline
   =========================== */
.hcp-timeline {
    position: relative;
    padding-left: 30px;
}

.hcp-timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-color);
}

.hcp-timeline-item {
    position: relative;
    margin-bottom: 24px;
}

.hcp-timeline-marker {
    position: absolute;
    left: -26px;
    top: 4px;
    width: 14px;
    height: 14px;
    background: var(--primary-color);
    border-radius: 50%;
    border: 3px solid var(--white);
    box-shadow: 0 0 0 2px var(--primary-color);
}

.hcp-timeline-content {
    background: var(--light-bg);
    border-radius: var(--radius-md);
    padding: 16px;
}

.hcp-timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.hcp-timeline-date {
    font-weight: 600;
    color: var(--text-primary);
}

.hcp-timeline-body p {
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--text-secondary);
}

.hcp-timeline-body p:last-child {
    margin-bottom: 0;
}

.hcp-timeline-body strong {
    color: var(--text-primary);
}

/* ===========================
   Calendar
   =========================== */
.hcp-calendar {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.hcp-calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--primary-color);
    color: var(--white);
}

.hcp-calendar-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.hcp-calendar-nav {
    color: var(--white);
    opacity: 0.8;
    font-size: 14px;
}

.hcp-calendar-nav:hover {
    opacity: 1;
    color: var(--white);
}

.hcp-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: var(--border-color);
}

.hcp-calendar-day-header {
    background: var(--light-bg);
    padding: 12px;
    text-align: center;
    font-weight: 600;
    font-size: 12px;
    color: var(--text-secondary);
}

.hcp-calendar-day {
    background: var(--white);
    padding: 10px;
    min-height: 80px;
    position: relative;
}

.hcp-calendar-empty {
    background: #fafafa;
}

.hcp-calendar-day-number {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.hcp-calendar-today {
    background: #e7f1ff;
}

.hcp-calendar-today .hcp-calendar-day-number {
    background: var(--primary-color);
    color: var(--white);
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.hcp-calendar-has-citas::after {
    content: '';
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 6px;
    height: 6px;
    background: var(--secondary-color);
    border-radius: 50%;
}

.hcp-calendar-citas-count {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--secondary-color);
    color: var(--white);
    font-size: 10px;
    font-weight: 600;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

/* ===========================
   Profile
   =========================== */
.hcp-profile-header {
    display: flex;
    align-items: center;
    gap: 20px;
}

.hcp-profile-avatar {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 32px;
    font-weight: 600;
}

.hcp-profile-info h2 {
    font-size: 24px;
    margin-bottom: 8px;
}

/* Contenedor de perfil */
.hcp-profile-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    max-width: 600px;
}

/* Card header para secciones */
.hcp-card-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--light-bg);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.hcp-card-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

/* Acciones del formulario */
.hcp-form-actions {
    margin-top: 20px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Texto de ayuda del formulario */
.hcp-form-help {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 5px;
}

/* Campo de contraseña con botón de toggle */
.hcp-password-field {
    position: relative;
    display: flex;
    align-items: center;
}

.hcp-password-field input {
    flex: 1;
    padding-right: 45px !important;
}

.hcp-password-toggle {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    padding: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.hcp-password-toggle:hover {
    background: var(--light-bg);
}

.hcp-password-toggle .eye-icon {
    font-size: 18px;
    line-height: 1;
}

.hcp-password-toggle.active .eye-icon {
    opacity: 0.6;
}

/* Responsive para perfil */
@media (max-width: 768px) {
    .hcp-profile-container {
        max-width: 100%;
    }
    
    .hcp-profile-header {
        flex-direction: column;
        text-align: center;
    }
    
    .hcp-profile-info h2 {
        font-size: 20px;
    }
}

/* ===========================
   Modals
   =========================== */
.hcp-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: flex-start;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    overflow-y: auto;
}

.hcp-modal.active {
    display: flex;
}

.hcp-modal-content {
    background: var(--white);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    margin: auto;
}

.hcp-modal-lg {
    max-width: 700px;
}

.hcp-modal-xl {
    max-width: 900px;
}

/* ===========================
   Autocomplete
   =========================== */
.hcp-autocomplete-container {
    position: relative;
}

.hcp-autocomplete-wrapper {
    position: relative;
}

.hcp-autocomplete-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    max-height: 200px;
    overflow-y: auto;
    z-index: 1001;
    display: none;
    box-shadow: var(--shadow-md);
}

.hcp-autocomplete-results.active {
    display: block;
}

.hcp-autocomplete-item {
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 1px solid var(--light-bg);
    transition: var(--transition);
}

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

.hcp-autocomplete-item:hover {
    background: var(--light-bg);
}

.hcp-autocomplete-item.selected {
    background: var(--primary-color);
    color: var(--white);
}

.hcp-autocomplete-item .paciente-nombre {
    font-weight: 600;
    display: block;
}

.hcp-autocomplete-item .paciente-info {
    font-size: 12px;
    color: var(--text-muted);
}

.hcp-autocomplete-item.selected .paciente-info {
    color: rgba(255,255,255,0.8);
}

.hcp-autocomplete-no-results {
    padding: 15px;
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
}

/* ===========================
   Form Sections (Historia Clínica)
   =========================== */
.hcp-form-section {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.hcp-form-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.hcp-form-section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 12px;
    padding-bottom: 5px;
    border-bottom: 2px solid var(--primary-color);
    display: inline-block;
}

/* Grid de 3 columnas */
.hcp-form-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.hcp-form-span-2 {
    grid-column: span 2;
}

.hcp-form-full,
.hcp-form-grid-3 .hcp-form-full {
    grid-column: 1 / -1;
}

/* Checkbox Grid */
.hcp-checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 8px;
}

.hcp-checkbox-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.hcp-checkbox-item:hover {
    background: var(--light-bg);
}

.hcp-checkbox-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

/* Responsive para formulario de 3 columnas */
@media (max-width: 768px) {
    .hcp-form-grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .hcp-form-span-2 {
        grid-column: span 2;
    }
    
    .hcp-modal-xl {
        max-width: 100%;
    }
    
    .hcp-checkbox-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .hcp-form-grid-3 {
        grid-template-columns: 1fr;
    }
    
    .hcp-form-span-2 {
        grid-column: span 1;
    }
    
    .hcp-checkbox-grid {
        grid-template-columns: 1fr;
    }
}

.hcp-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: var(--white);
}

.hcp-modal-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.hcp-modal-close {
    background: none;
    border: none;
    color: var(--white);
    font-size: 28px;
    cursor: pointer;
    opacity: 0.8;
    line-height: 1;
}

.hcp-modal-close:hover {
    opacity: 1;
}

.hcp-modal-body {
    padding: 24px;
}

.hcp-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    background: var(--light-bg);
    border-top: 1px solid var(--border-color);
}

/* ===========================
   Signature
   =========================== */
.hcp-signature-wrapper {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 15px;
    background: #fafafa;
}

#hcp-signature-canvas {
    display: block;
    width: 100%;
    cursor: crosshair;
}

/* ===========================
   Empty State
   =========================== */
.hcp-empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.hcp-empty-state p {
    margin-bottom: 15px;
}

/* ===========================
   Error
   =========================== */
.hcp-error {
    background: #f8d7da;
    color: #721c24;
    padding: 20px;
    border-radius: var(--radius-md);
    text-align: center;
}

/* ===========================
   Loading
   =========================== */
.hcp-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.hcp-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ===========================
   Toast Notifications
   =========================== */
.hcp-toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.hcp-toast {
    background: var(--white);
    padding: 16px 20px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    animation: slideIn 0.3s ease;
}

.hcp-toast-success {
    border-left: 4px solid var(--success-color);
}

.hcp-toast-error {
    border-left: 4px solid var(--danger-color);
}

.hcp-toast-warning {
    border-left: 4px solid var(--warning-color);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ===========================
   Responsive Design
   =========================== */
@media (max-width: 992px) {
    .hcp-detail-grid {
        grid-template-columns: 1fr;
    }
    
    .hcp-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .hcp-sidebar {
        transform: translateX(-100%);
        transition: var(--transition);
    }
    
    .hcp-sidebar.open {
        transform: translateX(0);
    }
    
    .hcp-main-content {
        margin-left: 0;
        padding: 20px 15px;
    }
    
    .hcp-page-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .hcp-form-grid {
        grid-template-columns: 1fr;
    }
    
    .hcp-info-grid {
        grid-template-columns: 1fr;
    }
    
    .hcp-stats-grid {
        grid-template-columns: 1fr;
    }
    
    .hcp-modal-content {
        margin: 10px;
        max-height: calc(100vh - 20px);
    }
    
    .hcp-calendar-day {
        min-height: 50px;
        padding: 5px;
    }
    
    .hcp-calendar-day-number {
        font-size: 12px;
    }
    
    .hcp-table th,
    .hcp-table td {
        padding: 10px 8px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .hcp-login-container {
        padding: 30px 20px;
    }
    
    .hcp-stat-card {
        padding: 16px;
    }
    
    .hcp-stat-icon {
        font-size: 28px;
        width: 50px;
        height: 50px;
    }
    
    .hcp-stat-number {
        font-size: 22px;
    }
}

/* ===========================
   Mobile Menu Toggle
   =========================== */
.hcp-menu-toggle {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 101;
    background: var(--primary-color);
    color: var(--white);
    border: none;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 20px;
}

@media (max-width: 768px) {
    .hcp-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* ===========================
   Print Styles
   =========================== */
@media print {
    .hcp-sidebar,
    .hcp-menu-toggle,
    .hcp-btn,
    .hcp-modal {
        display: none !important;
    }
    
    .hcp-main-content {
        margin-left: 0;
        padding: 0;
    }
    
    .hcp-card,
    .hcp-section {
        box-shadow: none;
        break-inside: avoid;
    }
}

/* ===========================
   Antecedentes Tags
   =========================== */
.hcp-tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.hcp-tag {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 500;
}

.hcp-tag-blue {
    background-color: rgba(44, 95, 124, 0.15);
    color: #2c5f7c;
}

.hcp-tag-orange {
    background-color: rgba(246, 139, 31, 0.15);
    color: #d97706;
}

.hcp-tag-green {
    background-color: rgba(40, 167, 69, 0.15);
    color: #28a745;
}

.hcp-antecedentes-section {
    margin-bottom: 0;
}


/* ===========================
   PWA Install Button
   =========================== */
.hcp-btn-install {
    display: block;
    width: 100%;
    padding: 12px 15px;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #f68b1f 0%, #e67e0e 100%);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.hcp-btn-install:hover {
    background: linear-gradient(135deg, #e67e0e 0%, #d46f05 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(246, 139, 31, 0.3);
}

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

/* iOS Install Banner */
.hcp-ios-install-banner {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    padding: 15px 20px;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
    z-index: 9999;
    text-align: center;
    border-top: 3px solid #2c5f7c;
}

.hcp-ios-install-banner p {
    margin: 0 0 5px 0;
    font-size: 14px;
    color: #333;
}

.hcp-ios-install-banner small {
    color: #666;
    font-size: 12px;
}

.hcp-ios-install-banner .close-banner {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #999;
}


/* ===========================
   Historia Clínica Preview
   =========================== */
.hcp-modal-fullscreen .hcp-modal-content {
    width: 95%;
    max-width: 900px;
    height: 95vh;
    max-height: 95vh;
    margin: 2.5vh auto;
    display: flex;
    flex-direction: column;
}

.hcp-modal-preview {
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.hcp-preview-body {
    flex: 1;
    overflow-y: auto;
    padding: 0 !important;
    background: #f5f5f5;
}

.hcp-document-preview {
    background: white;
    max-width: 800px;
    margin: 20px auto;
    padding: 30px 40px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    border-radius: var(--radius-md);
}

/* Encabezado del Documento */
.hcp-doc-header {
    display: flex;
    align-items: center;
    gap: 20px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--primary-color);
    margin-bottom: 25px;
}

.hcp-doc-logo {
    width: 80px;
    height: auto;
}

.hcp-doc-title h2 {
    margin: 0;
    font-size: 22px;
    color: var(--primary-color);
}

.hcp-doc-title p {
    margin: 5px 0 0 0;
    font-size: 14px;
    color: #666;
}

/* Secciones del Documento */
.hcp-doc-section {
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.hcp-doc-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.hcp-doc-section h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary-color);
    margin: 0 0 12px 0;
    padding-bottom: 5px;
    border-bottom: 1px solid var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Grid de Campos */
.hcp-doc-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px 20px;
}

.hcp-doc-field {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.hcp-doc-field label {
    font-size: 11px;
    color: #888;
    font-weight: 500;
    text-transform: uppercase;
}

.hcp-doc-field span {
    font-size: 14px;
    color: #333;
    padding: 5px 0;
    border-bottom: 1px dotted #ccc;
    min-height: 24px;
}

.hcp-doc-field-full {
    grid-column: span 2;
}

/* Texto de Documento */
.hcp-doc-text {
    font-size: 14px;
    line-height: 1.6;
    color: #333;
    background: #f9f9f9;
    padding: 10px 15px;
    border-radius: var(--radius-sm);
    margin: 0;
    min-height: 40px;
}

/* Checkboxes de Antecedentes */
.hcp-doc-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.hcp-doc-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    padding: 4px 10px;
    background: #f0f0f0;
    border-radius: 15px;
}

.hcp-doc-checkbox.checked {
    background: rgba(44, 95, 124, 0.15);
    color: var(--primary-color);
    font-weight: 500;
}

.hcp-doc-checkbox .check-icon {
    font-size: 10px;
}

/* Textarea en documento */
.hcp-doc-textarea {
    width: 100%;
    border: 1px solid #ddd;
    border-radius: var(--radius-sm);
    padding: 10px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    min-height: 60px;
}

/* Sección de Firmas */
.hcp-signatures-section {
    background: #fafafa;
    margin: 15px -40px -30px -40px;
    padding: 15px 40px 20px 40px;
    border-top: 2px solid var(--primary-color);
}

.hcp-signature-instruction {
    font-size: 13px;
    color: #555;
    margin-bottom: 10px;
    text-align: center;
}

.hcp-signature-container {
    text-align: center;
    margin-bottom: 10px;
}

.hcp-signature-canvas {
    border: 2px dashed #ccc;
    border-radius: var(--radius-md);
    background: white;
    cursor: crosshair;
    touch-action: none;
    max-width: 100%;
    display: block;
    margin: 0 auto;
}

.hcp-signature-canvas:hover {
    border-color: var(--primary-color);
}

.hcp-signature-canvas.signing {
    border-color: var(--primary-color);
    border-style: solid;
    box-shadow: 0 0 10px rgba(44, 95, 124, 0.3);
}

.hcp-signature-actions {
    margin-top: 10px;
}

.hcp-signature-label {
    font-size: 12px;
    color: #888;
    margin-top: 8px;
    text-align: center;
}

/* Footer del documento */
.hcp-doc-footer-info {
    text-align: right;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #ddd;
}

.hcp-doc-footer-info p {
    margin: 2px 0;
    font-size: 11px;
    color: #555;
}

/* Footer del Modal Preview */
.hcp-preview-footer {
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
    padding: 15px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.hcp-btn-lg {
    padding: 12px 30px;
    font-size: 16px;
}

/* Responsive para tablet/móvil */
@media (max-width: 768px) {
    .hcp-modal-fullscreen .hcp-modal-content {
        width: 100%;
        height: 100vh;
        max-height: 100vh;
        margin: 0;
        border-radius: 0;
    }
    
    .hcp-document-preview {
        margin: 10px;
        padding: 20px;
    }
    
    .hcp-doc-grid {
        grid-template-columns: 1fr;
    }
    
    .hcp-doc-field-full {
        grid-column: span 1;
    }
    
    .hcp-doc-header {
        flex-direction: column;
        text-align: center;
    }
    
    .hcp-signatures-section {
        margin: 20px -20px -20px -20px;
        padding: 20px;
    }
    
    .hcp-signature-canvas {
        width: 100%;
        height: 150px;
    }
    
    .hcp-preview-footer {
        flex-direction: column;
        gap: 10px;
    }
    
    .hcp-preview-footer .hcp-btn {
        width: 100%;
    }
}

/* ===========================
   Campos Condicionales
   =========================== */
.hcp-conditional-field {
    margin-top: 12px;
    padding: 12px 15px;
    background: #f8f9fa;
    border-left: 3px solid var(--primary-color);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    animation: slideDown 0.3s ease;
}

.hcp-conditional-field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 6px;
}

.hcp-conditional-field input[type="text"] {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: var(--radius-sm);
    font-size: 14px;
}

.hcp-conditional-field input[type="text"]:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(44, 95, 124, 0.1);
}

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

/* ===========================
   Estilos para Documentos Guardados
   =========================== */
.hcp-docs-section {
    padding: 10px 0;
}

.hcp-docs-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.hcp-doc-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    background: #f8f9fa;
    border-radius: var(--radius-sm);
    border: 1px solid #e0e0e0;
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.hcp-doc-item:hover {
    background: #e9ecef;
    border-color: var(--primary-color);
    transform: translateX(3px);
}

.hcp-doc-date {
    font-size: 12px;
    color: var(--primary-color);
    font-weight: 600;
    min-width: 110px;
}

.hcp-doc-info {
    flex: 1;
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hcp-doc-icon {
    font-size: 18px;
}

/* ===========================
   Estilos para Radio Buttons
   =========================== */
.hcp-radio-group {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    padding: 10px 0;
}

.hcp-radio-item {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
}

.hcp-radio-item input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

/* ===========================
   Estilos para Formularios Pequeños
   =========================== */
.hcp-form-group-sm {
    flex: 1;
    min-width: 100px;
}

.hcp-form-group-sm label {
    font-size: 12px;
}

.hcp-form-group-sm input {
    padding: 8px 10px;
    font-size: 13px;
}

/* ===========================
   Estilos para Documento Preview
   =========================== */
.hcp-doc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.hcp-doc-field {
    display: flex;
    flex-direction: column;
}

.hcp-doc-field label {
    font-size: 11px;
    color: #666;
    margin-bottom: 3px;
    font-weight: 600;
}

.hcp-doc-field span {
    font-size: 14px;
    color: #333;
    padding: 5px 0;
    border-bottom: 1px solid #ddd;
}

.hcp-doc-note {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: var(--radius-sm);
    padding: 12px 15px;
    margin: 15px 0;
    font-size: 13px;
}

.hcp-consent-text p {
    margin: 10px 0;
    text-align: justify;
    line-height: 1.6;
    font-size: 13px;
}

.required {
    color: #dc3545;
}

/* ===========================
   Responsive para Modales de Documentos
   =========================== */
@media (max-width: 768px) {
    .hcp-form-row {
        flex-direction: column;
    }
    
    .hcp-form-group-sm {
        min-width: 100%;
    }
    
    .hcp-radio-group {
        flex-direction: column;
        gap: 10px;
    }
    
    .hcp-doc-grid {
        grid-template-columns: 1fr;
    }
}

/* ===========================
   Estilos para Firmas en Fila (Modal)
   =========================== */
.hcp-signatures-row {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    margin-top: 15px;
}

.hcp-signature-box {
    flex: 1;
    min-width: 200px;
    max-width: 48%;
    text-align: center;
}

.hcp-signature-box .hcp-signature-canvas {
    width: 100%;
    max-width: 280px;
    height: 100px;
}

.hcp-signature-static {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hcp-signature-placeholder {
    width: 100%;
    max-width: 280px;
    height: 100px;
    border: 2px dashed #ccc;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    color: #999;
    font-size: 12px;
}

.hcp-signature-info {
    font-size: 11px;
    color: var(--primary-color);
    text-align: center;
    margin-top: 5px;
    line-height: 1.3;
}

/* Responsive para firmas */
@media (max-width: 600px) {
    .hcp-signatures-row {
        flex-direction: column;
    }
    
    .hcp-signature-box {
        max-width: 100%;
    }
}
