/* =====================================================
   Family Medical Information System - Main Stylesheet
   ===================================================== */

:root {
    --primary: #1a6fc4;
    --primary-dark: #155a9e;
    --secondary: #2ec4b6;
    --success: #28a745;
    --danger: #dc3545;
    --warning: #ffc107;
    --info: #17a2b8;
    --light: #f8f9fa;
    --dark: #343a40;
    --sidebar-width: 260px;
    --header-height: 65px;
    --card-radius: 12px;
    --shadow: 0 2px 15px rgba(0,0,0,0.08);
    --shadow-hover: 0 5px 25px rgba(0,0,0,0.15);
}

* { box-sizing: border-box; }

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f0f4f8;
    color: #333;
    margin: 0;
    font-size: 14px;
}

/* ---- LOGIN PAGE ---- */
.login-wrapper {
    min-height: 100vh;
    background: linear-gradient(135deg, #1a6fc4 0%, #2ec4b6 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    background: #fff;
    border-radius: 20px;
    padding: 45px 40px;
    width: 100%;
    max-width: 430px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.login-logo {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo .app-icon {
    width: 75px;
    height: 75px;
    background: linear-gradient(135deg, #1a6fc4, #2ec4b6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 15px;
    font-size: 32px;
    color: #fff;
}

.login-logo h2 {
    color: var(--primary);
    font-weight: 700;
    margin: 0;
    font-size: 22px;
}

.login-logo p {
    color: #888;
    margin: 5px 0 0;
    font-size: 13px;
}

/* ---- LAYOUT ---- */
.app-wrapper { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #1a2744 0%, #1a4a8a 100%);
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    transition: all 0.3s;
}

.sidebar-brand {
    padding: 20px 20px 15px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-brand .brand-icon {
    width: 40px; height: 40px;
    background: rgba(255,255,255,0.2);
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 18px;
    margin-right: 10px;
}

.sidebar-brand h5 {
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    margin: 0;
    display: inline-block;
    vertical-align: middle;
    line-height: 1.2;
}

.sidebar-brand small {
    color: rgba(255,255,255,0.5);
    font-size: 11px;
    display: block;
    margin-left: 50px;
}

.sidebar-user {
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-user .user-avatar {
    width: 42px; height: 42px;
    background: var(--secondary);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 16px;
    margin-right: 10px;
}

.sidebar-user .user-info { display: inline-block; vertical-align: middle; }
.sidebar-user .user-info .name { color: #fff; font-size: 13px; font-weight: 600; }
.sidebar-user .user-info .role { color: rgba(255,255,255,0.5); font-size: 11px; }

.sidebar-nav { padding: 15px 0; }

.nav-section {
    padding: 5px 20px 3px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: rgba(255,255,255,0.35);
    letter-spacing: 1px;
    margin-top: 10px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    font-size: 13.5px;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background: rgba(255,255,255,0.1);
    color: #fff;
    border-left-color: var(--secondary);
}

.sidebar-nav a i { width: 22px; font-size: 15px; margin-right: 10px; }

.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
}

.topbar {
    height: var(--header-height);
    background: #fff;
    border-bottom: 1px solid #e8ecf0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 25px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.topbar .page-title { font-size: 18px; font-weight: 700; color: var(--dark); margin: 0; }
.topbar .page-title small { font-size: 12px; color: #999; font-weight: 400; display: block; }

.topbar-actions { display: flex; align-items: center; gap: 12px; }

.topbar-actions .btn-logout {
    background: none;
    border: 1px solid #e0e0e0;
    padding: 6px 14px;
    border-radius: 8px;
    color: #666;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.topbar-actions .btn-logout:hover { background: #dc3545; border-color: #dc3545; color: #fff; }

.content-area { padding: 25px; flex: 1; }

/* ---- CARDS ---- */
.card {
    background: #fff;
    border-radius: var(--card-radius);
    box-shadow: var(--shadow);
    border: none;
    margin-bottom: 20px;
}

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

.card-header h5 { margin: 0; font-size: 15px; font-weight: 700; color: var(--dark); }
.card-header h5 i { color: var(--primary); margin-right: 8px; }
.card-body { padding: 22px; }

/* ---- STAT CARDS ---- */
.stat-card {
    background: #fff;
    border-radius: var(--card-radius);
    padding: 22px;
    display: flex;
    align-items: center;
    gap: 18px;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.stat-icon {
    width: 60px; height: 60px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.stat-icon.blue { background: rgba(26,111,196,0.12); color: var(--primary); }
.stat-icon.teal { background: rgba(46,196,182,0.12); color: var(--secondary); }
.stat-icon.green { background: rgba(40,167,69,0.12); color: var(--success); }
.stat-icon.orange { background: rgba(255,193,7,0.12); color: #e67e00; }
.stat-icon.red { background: rgba(220,53,69,0.12); color: var(--danger); }

.stat-info .number { font-size: 28px; font-weight: 800; color: var(--dark); line-height: 1; }
.stat-info .label { font-size: 13px; color: #888; margin-top: 3px; }

/* ---- MEMBER CARD ---- */
.member-card {
    background: #fff;
    border-radius: var(--card-radius);
    padding: 22px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: all 0.25s;
    cursor: pointer;
    border: 2px solid transparent;
    position: relative;
}

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

.member-photo {
    width: 90px; height: 90px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 12px;
    display: block;
    border: 3px solid #e8ecf0;
}

.member-photo-placeholder {
    width: 90px; height: 90px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1a6fc4, #2ec4b6);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
    font-size: 30px;
    color: #fff;
    font-weight: 700;
}

.member-card h6 { font-size: 15px; font-weight: 700; margin: 0 0 4px; }
.member-card .rel-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    background: rgba(26,111,196,0.1);
    color: var(--primary);
}

.member-card .blood-group {
    display: inline-block;
    width: 34px; height: 34px;
    border-radius: 50%;
    background: #dc3545;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 34px;
    text-align: center;
    position: absolute;
    top: 12px; right: 12px;
}

/* ---- FORMS ---- */
.form-control, .form-select {
    border: 1.5px solid #e0e6ed;
    border-radius: 8px;
    padding: 9px 14px;
    font-size: 13.5px;
    transition: border-color 0.2s, box-shadow 0.2s;
    width: 100%;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,111,196,0.12);
    outline: none;
}

.form-label { font-weight: 600; font-size: 13px; color: #555; margin-bottom: 5px; }
.form-group { margin-bottom: 18px; }

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

/* ---- BUTTONS ---- */
.btn {
    padding: 9px 20px;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    text-decoration: none;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #218838; color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #c82333; color: #fff; }
.btn-warning { background: var(--warning); color: #212529; }
.btn-secondary { background: #6c757d; color: #fff; }
.btn-outline-primary { background: transparent; border: 1.5px solid var(--primary); color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary); color: #fff; }
.btn-sm { padding: 5px 12px; font-size: 12px; }

/* ---- TABLE ---- */
.table-responsive { overflow-x: auto; }

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

.data-table th {
    background: #f8f9fa;
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    color: #888;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #e8ecf0;
    white-space: nowrap;
}

.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
    font-size: 13.5px;
}

.data-table tr:hover td { background: #f8fbff; }

/* ---- BADGES ---- */
.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    display: inline-block;
}

.badge-success { background: rgba(40,167,69,0.15); color: var(--success); }
.badge-danger { background: rgba(220,53,69,0.15); color: var(--danger); }
.badge-warning { background: rgba(255,193,7,0.15); color: #856404; }
.badge-info { background: rgba(23,162,184,0.15); color: var(--info); }
.badge-primary { background: rgba(26,111,196,0.15); color: var(--primary); }
.badge-secondary { background: rgba(108,117,125,0.15); color: #6c757d; }

/* ---- DOCUMENT UPLOAD ---- */
.upload-zone {
    border: 2px dashed #c8d6e5;
    border-radius: 10px;
    padding: 25px;
    text-align: center;
    background: #f8fbff;
    transition: all 0.2s;
    cursor: pointer;
}

.upload-zone:hover { border-color: var(--primary); background: #eef4fb; }
.upload-zone i { font-size: 36px; color: var(--primary); margin-bottom: 10px; }
.upload-zone p { color: #888; margin: 0; font-size: 13px; }

.doc-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 8px;
    border: 1px solid #e8ecf0;
}

.doc-item .doc-icon { font-size: 22px; flex-shrink: 0; }
.doc-item .doc-details { flex: 1; }
.doc-item .doc-heading { font-weight: 700; font-size: 13.5px; color: var(--dark); }
.doc-item .doc-meta { font-size: 11.5px; color: #999; margin-top: 2px; }

/* ---- PROFILE HEADER ---- */
.profile-header {
    background: linear-gradient(135deg, #1a2744, #1a6fc4);
    border-radius: var(--card-radius);
    padding: 30px;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 25px;
    margin-bottom: 20px;
}

.profile-avatar-wrap { position: relative; flex-shrink: 0; }

.profile-avatar {
    width: 110px; height: 110px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid rgba(255,255,255,0.3);
}

.profile-avatar-placeholder {
    width: 110px; height: 110px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    color: #fff;
    font-weight: 700;
    border: 4px solid rgba(255,255,255,0.3);
}

.profile-info h3 { margin: 0 0 5px; font-size: 24px; font-weight: 800; }
.profile-info .sub { color: rgba(255,255,255,0.75); font-size: 14px; }
.profile-info .tags { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 8px; }

.profile-tag {
    background: rgba(255,255,255,0.15);
    color: #fff;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

/* ---- SEVERITY TAGS ---- */
.severity-mild { background: rgba(40,167,69,0.15); color: var(--success); }
.severity-moderate { background: rgba(255,193,7,0.15); color: #856404; }
.severity-severe { background: rgba(220,53,69,0.15); color: var(--danger); }
.severity-critical { background: #dc3545; color: #fff; }

/* ---- ALERTS ---- */
.alert {
    padding: 12px 18px;
    border-radius: 8px;
    font-size: 13.5px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-success { background: rgba(40,167,69,0.12); color: #155724; border-left: 4px solid var(--success); }
.alert-danger { background: rgba(220,53,69,0.12); color: #721c24; border-left: 4px solid var(--danger); }
.alert-info { background: rgba(23,162,184,0.12); color: #0c5460; border-left: 4px solid var(--info); }
.alert-warning { background: rgba(255,193,7,0.12); color: #856404; border-left: 4px solid var(--warning); }

/* ---- TABS ---- */
.tab-nav {
    display: flex;
    border-bottom: 2px solid #e8ecf0;
    margin-bottom: 22px;
    gap: 5px;
}

.tab-btn {
    padding: 10px 20px;
    border: none;
    background: none;
    font-size: 13.5px;
    font-weight: 600;
    color: #888;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
    border-radius: 6px 6px 0 0;
}

.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); background: rgba(26,111,196,0.05); }
.tab-btn:hover { color: var(--primary); }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .profile-header { flex-direction: column; text-align: center; }
    .profile-info .tags { justify-content: center; }
}

/* ---- MISC ---- */
.section-divider {
    border: none;
    border-top: 1px solid #e8ecf0;
    margin: 25px 0;
}

.text-muted { color: #999 !important; font-size: 13px; }
.required { color: var(--danger); }
.mt-1 { margin-top: 5px; }
.mt-2 { margin-top: 10px; }
.mt-3 { margin-top: 15px; }
.mb-2 { margin-bottom: 10px; }
.mb-3 { margin-bottom: 15px; }
.d-flex { display: flex; }
.align-items-center { align-items: center; }
.justify-content-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.gap-2 { gap: 10px; }
.gap-3 { gap: 15px; }
.text-center { text-align: center; }
.w-100 { width: 100%; }
.row { display: flex; flex-wrap: wrap; margin: 0 -10px; }
.col-12 { width: 100%; padding: 0 10px; }
.col-6 { width: 50%; padding: 0 10px; }
.col-4 { width: 33.33%; padding: 0 10px; }
.col-3 { width: 25%; padding: 0 10px; }
.col-8 { width: 66.67%; padding: 0 10px; }
@media (max-width: 768px) {
    .col-6, .col-4, .col-3, .col-8 { width: 100%; }
}
