/* =================================================================
   BIZZARK DESIGN SYSTEM — Medical Pro
   Paleta, layout, sidebar, cards, tables, forms, login
   Basado en BizzArk by Frontted + Bootstrap 4.5.3
   ================================================================= */

/* =============================================================
   CSS CUSTOM PROPERTIES
   ============================================================= */
:root {
    --primary:       #4b98cf;
    --primary-dark:  #346384;
    --primary-light: #6db3e0;
    --secondary:     #6c757d;
    --success:       #4eb4a5;
    --success-light: #6fd4c5;
    --info:          #4b98cf;
    --warning:       #e3aa75;
    --warning-light: #f0c89e;
    --danger:        #dc3545;
    --danger-light:  #f08080;
    --light:         #f8f9fa;
    --dark:          #1a3142;
    --dark-light:    #254558;
    --purple:        #5163c5;
    --teal:          #16ba71;
    --dark-gray:     #939fad;
    --light-gray:    #eceef0;
    --muted-light:   #dbdfe4;

    --body-bg:       #f6fafc;
    --body-color:    #112b4a;
    --card-border:   #dce0e2;
    --sidebar-w:     250px;
    --navbar-h:      64px;
    --font-family:   'Lato', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-heading:  'Montserrat', sans-serif;
    --radius:        5px;
    --radius-lg:     8px;
    --radius-pill:   100px;
    --shadow-sm:     0 1px 3px rgba(0,0,0,.08);
    --shadow:        0 3px 10px -1px #d4dce2;
    --shadow-lg:     0 10px 30px rgba(0,0,0,.12);
}

/* =============================================================
   RESET & BASE
   ============================================================= */
* { box-sizing: border-box; }

body {
    font-family: var(--font-family);
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: var(--body-color);
    background: var(--body-bg);
    margin: 0;
    -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    color: var(--body-color);
}

/* =============================================================
   PRELOADER
   ============================================================= */
.preloader {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: var(--body-bg);
    z-index: 9999;
    display: flex; align-items: center; justify-content: center;
}
.preloader::after {
    content: '';
    width: 36px; height: 36px;
    border: 3px solid var(--muted-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* =============================================================
   NAVBAR
   ============================================================= */
.navbar-medical {
    background: var(--dark);
    height: var(--navbar-h);
    display: flex;
    align-items: center;
    padding: 0 1rem;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1030;
    box-shadow: 0 2px 8px rgba(0,0,0,.15);
}

.navbar-medical .navbar-brand {
    display: flex;
    align-items: center;
    color: #fff;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.25rem;
    margin-right: 1.5rem;
    min-width: 180px;
}
.navbar-medical .navbar-brand img {
    height: 28px;
    margin-right: 8px;
}
.navbar-medical .navbar-brand span { color: var(--primary); }

.navbar-medical .navbar-toggler {
    background: rgba(255,255,255,.12);
    border: 1px solid rgba(255,255,255,.2);
    border-radius: var(--radius);
    color: #fff;
    padding: .25rem .6rem;
    font-size: 1.25rem;
    line-height: 1;
    display: none;
}

.navbar-medical .nav-icons {
    display: flex;
    align-items: center;
    margin-left: auto;
    gap: .25rem;
}

.navbar-medical .nav-icon-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,.7);
    font-size: 1.35rem;
    padding: .5rem;
    border-radius: var(--radius);
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: center;
}
.navbar-medical .nav-icon-btn:hover { color: #fff; background: rgba(255,255,255,.1); }

.navbar-medical .badge-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
}

.navbar-medical .user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .85rem;
    cursor: pointer;
    margin-left: .5rem;
}

/* =============================================================
   LAYOUT — Sidebar + Content
   ============================================================= */
.layout-wrapper {
    display: flex;
    padding-top: var(--navbar-h);
    min-height: 100vh;
}

/* --- SIDEBAR --- */
.sidebar {
    width: var(--sidebar-w);
    background: #fff;
    border-right: 1px solid var(--card-border);
    position: fixed;
    top: var(--navbar-h);
    bottom: 0;
    left: 0;
    overflow-y: auto;
    z-index: 1020;
    transition: transform .25s ease;
    padding-bottom: 2rem;
}

.sidebar-header {
    padding: 1.25rem 1.25rem .5rem;
    font-size: .6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .92px;
    color: var(--dark-gray);
    margin-top: .5rem;
}

.sidebar-menu {
    list-style: none;
    margin: 0;
    padding: 0 .5rem;
}

.sidebar-menu-item {
    margin-bottom: 2px;
}

.sidebar-menu-link {
    display: flex;
    align-items: center;
    padding: .6rem 1rem;
    border-radius: var(--radius);
    color: var(--dark-gray);
    font-weight: 500;
    font-size: .925rem;
    transition: all .15s ease;
    text-decoration: none;
}

.sidebar-menu-link:hover {
    background: rgba(75,152,207,.08);
    color: var(--body-color);
}

.sidebar-menu-link.active {
    background: rgba(75,152,207,.12);
    color: var(--primary);
    font-weight: 700;
}

.sidebar-menu-link .material-icons {
    font-size: 1.35rem;
    margin-right: .75rem;
    width: 24px;
    text-align: center;
    color: inherit;
}

.sidebar-menu-link .sidebar-badge {
    margin-left: auto;
    background: var(--primary);
    color: #fff;
    font-size: .7rem;
    padding: .15rem .5rem;
    border-radius: var(--radius-pill);
    font-weight: 600;
}

/* Submenu */
.sidebar-submenu {
    list-style: none;
    margin: 0;
    padding: 0 0 0 2.75rem;
}

.sidebar-submenu .sidebar-menu-link {
    font-size: .85rem;
    padding: .4rem .75rem;
}

/* --- MAIN CONTENT --- */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-w);
    padding: 0;
    min-width: 0;
}

/* =============================================================
   PAGE HEADING
   ============================================================= */
.page-heading {
    padding: 1.5rem 1.875rem;
    border-bottom: 1px solid var(--card-border);
    background: #fff;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-heading h1 {
    margin: 0;
    font-size: 1.5rem;
    line-height: 1.2;
    color: var(--body-color);
}

.page-heading .breadcrumb {
    margin: 0 0 .25rem;
    padding: 0;
    background: none;
    font-size: .825rem;
}
.page-heading .breadcrumb a { color: var(--dark-gray); }
.page-heading .breadcrumb .active { color: var(--body-color); font-weight: 600; }

.page-container {
    padding: 1.875rem;
    max-width: 1300px;
}

/* =============================================================
   CARDS
   ============================================================= */
.card {
    background: #fff;
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    margin-bottom: 1.25rem;
    overflow: hidden;
}

.card-shadow {
    box-shadow: var(--shadow);
    border: none;
}

.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--card-border);
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header-title {
    font-weight: 700;
    font-size: 1rem;
    margin: 0;
    color: var(--body-color);
}

.card-body {
    padding: 1.25rem;
}

.card-body.p-0 { padding: 0; }

/* Card stats */
.card-stat {
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.card-stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #fff;
    flex-shrink: 0;
}

.card-stat-info h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.1;
}

.card-stat-info p {
    margin: 0;
    color: var(--dark-gray);
    font-size: .825rem;
}

/* =============================================================
   TABLES
   ============================================================= */
.table-medical {
    width: 100%;
    margin-bottom: 0;
    color: var(--body-color);
    border-collapse: collapse;
}

.table-medical th {
    padding: .6rem 1rem;
    border-bottom: 2px solid var(--card-border);
    font-weight: 700;
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--dark-gray);
    text-align: left;
    white-space: nowrap;
}

.table-medical td {
    padding: .6rem 1rem;
    border-bottom: 1px solid var(--light-gray);
    vertical-align: middle;
    font-size: .9rem;
}

.table-medical tr:hover td {
    background: rgba(75,152,207,.03);
}

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

/* =============================================================
   BADGES
   ============================================================= */
.badge {
    display: inline-block;
    padding: .2em .6em;
    font-size: .75rem;
    font-weight: 600;
    border-radius: var(--radius-pill);
    line-height: 1.4;
}

.badge-primary   { background: var(--primary); color: #fff; }
.badge-success   { background: var(--success); color: #fff; }
.badge-warning   { background: var(--warning); color: #1a1a1a; }
.badge-danger    { background: var(--danger); color: #fff; }
.badge-info      { background: var(--info); color: #fff; }
.badge-dark      { background: var(--dark); color: #fff; }
.badge-secondary { background: var(--secondary); color: #fff; }
.badge-purple    { background: var(--purple); color: #fff; }
.badge-teal      { background: var(--teal); color: #fff; }

/* =============================================================
   BUTTONS
   ============================================================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    padding: .5rem 1rem;
    font-size: .875rem;
    font-weight: 600;
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all .15s ease;
    line-height: 1.5;
    text-decoration: none;
}

.btn-sm { padding: .3rem .7rem; font-size: .8rem; }
.btn-lg { padding: .65rem 1.5rem; font-size: 1rem; }

.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }

.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover { background: #3a8f83; }

.btn-warning { background: var(--warning); color: #1a1a1a; border-color: var(--warning); }
.btn-warning:hover { background: #d4945a; }

.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #b52a36; }

.btn-light { background: var(--light); color: var(--body-color); border-color: var(--card-border); }
.btn-light:hover { background: #e2e6ea; }

.btn-outline-primary { background: none; color: var(--primary); border-color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary); color: #fff; }

.btn-outline-secondary { background: none; color: var(--secondary); border-color: var(--secondary); }
.btn-outline-secondary:hover { background: var(--secondary); color: #fff; }

.btn .material-icons { font-size: 1.1rem; }

/* =============================================================
   FORMS
   ============================================================= */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    font-weight: 600;
    font-size: .825rem;
    color: var(--body-color);
    margin-bottom: .3rem;
}

.form-control {
    display: block;
    width: 100%;
    padding: .55rem .8rem;
    font-size: .9rem;
    font-family: var(--font-family);
    color: var(--body-color);
    background: #fff;
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    transition: border-color .15s, box-shadow .15s;
    outline: none;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(75,152,207,.15);
}

.form-control::placeholder {
    color: var(--dark-gray);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23939fad' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .75rem center;
    padding-right: 2rem;
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

/* =============================================================
   AVATARS
   ============================================================= */
.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    overflow: hidden;
}

.avatar-sm { width: 35px; height: 35px; font-size: .8rem; }
.avatar-md { width: 48px; height: 48px; font-size: 1.1rem; }
.avatar-lg { width: 64px; height: 64px; font-size: 1.5rem; }

.avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-title {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #fff;
}

/* =============================================================
   UTILITIES
   ============================================================= */
.bg-primary    { background: var(--primary) !important; }
.bg-success    { background: var(--success) !important; }
.bg-warning    { background: var(--warning) !important; }
.bg-danger     { background: var(--danger) !important; }
.bg-info       { background: var(--info) !important; }
.bg-dark       { background: var(--dark) !important; }
.bg-purple     { background: var(--purple) !important; }
.bg-teal       { background: var(--teal) !important; }
.bg-white      { background: #fff !important; }
.bg-light      { background: var(--light) !important; }

.text-primary  { color: var(--primary) !important; }
.text-success  { color: var(--success) !important; }
.text-warning  { color: var(--warning) !important; }
.text-danger   { color: var(--danger) !important; }
.text-muted    { color: var(--dark-gray) !important; }
.text-white    { color: #fff !important; }
.text-dark     { color: var(--body-color) !important; }

.d-flex        { display: flex !important; }
.align-items-center { align-items: center !important; }
.justify-content-between { justify-content: space-between !important; }
.flex-wrap     { flex-wrap: wrap !important; }
.gap-1         { gap: .5rem !important; }
.gap-2         { gap: 1rem !important; }
.gap-3         { gap: 1.5rem !important; }

.ms-auto       { margin-left: auto !important; }
.me-auto       { margin-right: auto !important; }
.mt-0 { margin-top: 0 !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: .5rem !important; }
.mb-2 { margin-bottom: 1rem !important; }
.mb-3 { margin-bottom: 1.5rem !important; }
.mb-4 { margin-bottom: 2rem !important; }
.mt-2 { margin-top: 1rem !important; }
.mt-3 { margin-top: 1.5rem !important; }
.mt-4 { margin-top: 2rem !important; }
.mr-1 { margin-right: .5rem !important; }
.mr-2 { margin-right: 1rem !important; }
.ml-2 { margin-left: 1rem !important; }
.p-2 { padding: .75rem !important; }
.p-3 { padding: 1.25rem !important; }
.p-4 { padding: 1.875rem !important; }
.px-3 { padding-left: 1.25rem !important; padding-right: 1.25rem !important; }
.py-2 { padding-top: .75rem !important; padding-bottom: .75rem !important; }

/* Grid system */
.row { display: flex; flex-wrap: wrap; margin: 0 -10px; }
.col { flex: 1; padding: 0 10px; min-width: 0; }
.col-3 { flex: 0 0 25%; max-width: 25%; padding: 0 10px; }
.col-4 { flex: 0 0 33.333%; max-width: 33.333%; padding: 0 10px; }
.col-6 { flex: 0 0 50%; max-width: 50%; padding: 0 10px; }
.col-8 { flex: 0 0 66.666%; max-width: 66.666%; padding: 0 10px; }
.col-12 { flex: 0 0 100%; max-width: 100%; padding: 0 10px; }

@media (max-width: 768px) {
    .col-md-6 { flex: 0 0 50%; max-width: 50%; }
    .col-md-12 { flex: 0 0 100%; max-width: 100%; }
}
@media (min-width: 769px) {
    .col-md-3 { flex: 0 0 25%; max-width: 25%; }
    .col-md-4 { flex: 0 0 33.333%; max-width: 33.333%; }
    .col-md-6 { flex: 0 0 50%; max-width: 50%; }
    .col-md-8 { flex: 0 0 66.666%; max-width: 66.666%; }
}

.text-center { text-align: center !important; }
.text-right { text-align: right !important; }
.text-nowrap { white-space: nowrap !important; }
.fw-bold { font-weight: 700 !important; }
.fw-normal { font-weight: 400 !important; }
.small { font-size: .825rem !important; }

.rounded { border-radius: var(--radius) !important; }
.rounded-circle { border-radius: 50% !important; }

/* =============================================================
   LOGIN PAGE
   ============================================================= */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--dark) 0%, #1a2d4a 50%, #0e1e36 100%);
    padding: 1rem;
}

.login-card {
    background: #fff;
    border-radius: var(--radius-lg);
    width: 420px;
    max-width: 100%;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.login-header {
    background: var(--dark);
    padding: 2rem;
    text-align: center;
    color: #fff;
}

.login-header .material-icons {
    font-size: 2.5rem;
    color: var(--primary);
}

.login-header h2 {
    font-family: var(--font-heading);
    font-weight: 700;
    margin: .5rem 0 0;
    color: #fff;
    font-size: 1.5rem;
}

.login-header h2 span { color: var(--primary); }
.login-header p { margin: .25rem 0 0; opacity: .7; font-size: .85rem; }

.login-body {
    padding: 2rem;
}

.login-body .form-group { margin-bottom: 1.25rem; }

.login-body .btn-login {
    width: 100%;
    padding: .7rem;
    font-size: 1rem;
    font-weight: 700;
    background: var(--dark);
    border: none;
    color: #fff;
    border-radius: var(--radius);
    cursor: pointer;
    letter-spacing: .5px;
}

.login-body .btn-login:hover { background: var(--dark-light); }

.login-hint {
    font-size: .8rem;
    color: var(--dark-gray);
    text-align: center;
    margin-top: 1.25rem;
}

/* =============================================================
   ALERTS
   ============================================================= */
.alert {
    padding: .75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: .875rem;
    border: 1px solid;
}

.alert-danger { background: #f8d7da; border-color: #f5c6cb; color: #721c24; }
.alert-success { background: #d4edda; border-color: #c3e6cb; color: #155724; }
.alert-info { background: #d1ecf1; border-color: #bee5eb; color: #0c5460; }
.alert-warning { background: #fff3cd; border-color: #ffeeba; color: #856404; }

/* =============================================================
   DROPDOWN MENUS
   ============================================================= */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    position: absolute;
    right: 0;
    top: 100%;
    z-index: 1050;
    min-width: 200px;
    background: #fff;
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: .5rem 0;
    display: none;
    margin-top: .25rem;
}

.dropdown.show .dropdown-menu { display: block; }

.dropdown-item {
    display: block;
    padding: .5rem 1.25rem;
    color: var(--body-color);
    font-size: .875rem;
    text-decoration: none;
}

.dropdown-item:hover { background: rgba(75,152,207,.08); }
.dropdown-item.active { color: var(--primary); font-weight: 700; }
.dropdown-divider { border-top: 1px solid var(--light-gray); margin: .4rem 0; }
.dropdown-item-text { padding: .5rem 1.25rem; font-size: .8rem; color: var(--dark-gray); }

/* =============================================================
   RESPONSIVE
   ============================================================= */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
    .navbar-medical .navbar-toggler {
        display: block;
    }
    .page-container {
        padding: 1rem;
    }
    .page-heading {
        padding: 1rem;
    }
}

/* =============================================================
   OVERLAY (mobile sidebar)
   ============================================================= */
.sidebar-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,.4);
    z-index: 1019;
    display: none;
}
.sidebar-overlay.show { display: block; }
