/* assets/css/style.css */
:root {
    --primary: #2c3e50;
    --secondary: #3498db;
    --success: #27ae60;
    --danger: #e74c3c;
    --warning: #f39c12;
    --info: #1abc9c;
    --light: #ecf0f1;
    --dark: #2c3e50;
    --sidebar-width: 260px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f4f6f9;
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--primary);
    color: white;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1000;
    transition: all 0.3s ease;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.25) transparent;
    display: flex;
    flex-direction: column;
}

.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 10px; }
.sidebar::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.35); }

.sidebar-brand {
    padding: 22px 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}

.sidebar-brand h3 {
    font-weight: 300;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.sidebar-brand span {
    color: var(--secondary);
    font-weight: 600;
}

.sidebar-menu {
    padding: 14px 12px 24px;
    flex: 1;
}

.sidebar-menu .menu-label {
    padding: 16px 12px 8px;
    font-size: 11px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.4);
    letter-spacing: 1.5px;
    font-weight: 600;
}

.sidebar-menu .menu-label:first-child {
    padding-top: 4px;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    margin: 2px 0;
    color: rgba(255,255,255,0.65);
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease;
    border-left: 3px solid transparent;
    border-radius: 8px;
    gap: 12px;
    font-size: 14px;
}

.sidebar-menu a:hover {
    background: rgba(255,255,255,0.06);
    color: white;
}

.sidebar-menu a.active {
    background: rgba(52, 152, 219, 0.18);
    color: white;
    border-left-color: var(--secondary);
    font-weight: 600;
}

.sidebar-menu a .icon {
    font-size: 17px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
    opacity: 0.9;
}

.sidebar-menu a[href*="logout"] {
    margin-top: 10px;
    border-top: 1px solid rgba(255,255,255,0.08);
    padding-top: 14px;
    border-radius: 0;
    color: rgba(255,255,255,0.5);
}

.sidebar-menu a[href*="logout"]:hover {
    color: #ff8a80;
    background: transparent;
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 20px;
}

/* Top Bar */
.top-bar {
    background: white;
    padding: 15px 25px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.top-bar .page-title h2 {
    font-size: 22px;
    color: var(--dark);
}

.top-bar .page-title small {
    color: #7f8c8d;
    font-size: 14px;
}

.top-bar .user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.top-bar .user-info .avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--secondary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.top-bar .user-info a[href*="perfil"] {
    padding: 4px 8px 4px 12px;
    border-radius: 20px;
    transition: background 0.2s ease;
}

.top-bar .user-info a[href*="perfil"]:hover {
    background: #f1f3f5;
}

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

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.stat-card .number {
    font-size: 28px;
    font-weight: 700;
    color: var(--dark);
}

.stat-card .label {
    color: #7f8c8d;
    font-size: 14px;
}

.stat-card .icon {
    float: right;
    font-size: 32px;
    opacity: 0.3;
}

/* Tables */
.table-container {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    overflow-x: auto;
}

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

table th {
    background: #f8f9fa;
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    color: var(--dark);
    border-bottom: 2px solid #e9ecef;
}

table td {
    padding: 12px 15px;
    border-bottom: 1px solid #e9ecef;
}

table tr:hover {
    background: #f8f9fa;
}

/* Badges */
.badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success { background: #d4edda; color: #155724; }
.badge-danger { background: #f8d7da; color: #721c24; }
.badge-warning { background: #fff3cd; color: #856404; }
.badge-info { background: #d1ecf1; color: #0c5460; }
.badge-primary { background: #cce5ff; color: #004085; }

/* Buttons */
.btn {
    padding: 8px 18px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
}

.btn-primary { background: var(--secondary); color: white; }
.btn-primary:hover { background: #2980b9; }

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

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

.btn-warning { background: var(--warning); color: white; }
.btn-warning:hover { background: #e67e22; }

.btn-sm { padding: 5px 12px; font-size: 13px; }

/* Botones de acción tipo icono (grillas: pacientes, consultas, citas...) */
.actions-cell {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
}
.action-btn {
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    font-size: 15px;
    line-height: 1;
    transition: filter 0.15s ease, transform 0.15s ease;
}
.action-btn:hover { filter: brightness(0.93); transform: translateY(-1px); }
.action-btn.action-view    { background: #e8f4fd; color: #2e86c1; }
.action-btn.action-edit    { background: #3498db; color: #fff; }
.action-btn.action-delete  { background: #fdecea; color: #e74c3c; }
.action-btn.action-restore { background: #eafaf1; color: #27ae60; }

/* Paginación (grillas con muchos registros) */
.resultado-info { color:#7f8c8d; font-size:13px; margin-bottom:12px; }
.pagination-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 20px;
}
.pagination {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    justify-content: center;
    background: #fff;
    padding: 8px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}
.pagination a, .pagination span {
    min-width: 34px;
    height: 34px;
    padding: 0 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-size: 13px;
    text-decoration: none;
    color: #2c3e50;
    border: 1px solid transparent;
}
.pagination a:hover { background: #f1f3f5; }
.pagination .current { background: var(--secondary); color: #fff; font-weight: 600; }
.pagination .dots { color: #b2bec3; border: none; }
.pagination .nav-btn { color: var(--secondary); font-weight: 600; }
.pagination .nav-btn.disabled { color: #dcdfe3; pointer-events: none; }

/* Forms */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 5px;
    color: var(--dark);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--secondary);
}

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

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* Toggle sidebar button */
.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--dark);
}

@media (max-width: 768px) {
    .sidebar-toggle {
        display: block;
    }
}

/* Search bar */
.search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.search-bar input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

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

.modal {
    background: white;
    border-radius: 10px;
    padding: 30px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
}

/* Charts placeholder */
.chart-container {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin-bottom: 20px;
}

.chart-placeholder {
    height: 250px;
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    padding: 20px 10px;
}

.chart-bar {
    width: 30px;
    background: var(--secondary);
    border-radius: 5px 5px 0 0;
    transition: height 0.5s ease;
    position: relative;
}

.chart-bar .label {
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    color: #7f8c8d;
}