/*
 * GENERAL STYLES & VARIABLES
 */
:root {
    --primary-color: #007bff;
    /* A nice blue for primary actions */
    --secondary-color: #6c757d;
    /* Grey for borders and secondary elements */
    --background-color: #f8f9fa;
    --card-background: #ffffff;
    --text-color: #212529;
    --heading-color: #343a40;
    --success-color: #28a745;
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --sidebar-width: 250px;
    --header-height: 60px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: var(--primary-color);
}

h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--heading-color);
    margin-bottom: 0.5rem;
}

/*
 * LAYOUT
 */
.main-layout {
    display: flex;
    min-height: 100vh;
}

.content-wrapper {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.main-content {
    padding: 20px;
    flex-grow: 1;
}

/*
 * HEADER STYLES
 */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background-color: var(--card-background);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    height: var(--header-height);
    position: sticky;
    top: 0;
    z-index: 10;
}

.search-bar {
    display: flex;
    align-items: center;
    border: 1px solid var(--secondary-color);
    border-radius: 5px;
    padding: 5px 10px;
}

.search-bar input {
    border: none;
    outline: none;
    padding: 0 10px;
    width: 200px;
}

.header-meta {
    display: flex;
    align-items: center;
}

.header-meta span {
    font-size: 0.8rem;
    margin-right: 15px;
    color: var(--primary-color);
}

.profile-info {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.profile-info img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 10px;
}

.profile-info .role {
    display: block;
    font-size: 0.75rem;
    color: var(--secondary-color);
}

/*
 * SIDEBAR STYLES (Mobile: Hidden, Desktop: Visible)
 */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--heading-color);
    color: var(--card-background);
    padding: 20px 0;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
    display: none;
    /* Hide by default on mobile */
}

.sidebar-header {
    text-align: center;
    padding: 0 20px 20px;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h2 {
    color: var(--card-background);
    font-size: 1.2rem;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.7);
    transition: background-color 0.2s, color 0.2s;
    font-size: 0.95rem;
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--card-background);
    border-left: 3px solid var(--primary-color);
    padding-left: 17px;
}

.sidebar-menu a i {
    margin-right: 10px;
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    position: absolute;
    bottom: 20px;
    width: 100%;
    padding: 0 20px;
}

.sidebar-footer a {
    display: block;
    color: rgba(255, 255, 255, 0.7);
    padding: 8px 0;
    transition: color 0.2s;
}

.sidebar-footer a:hover {
    color: var(--card-background);
}

/*
 * UTILITIES & CARDS
 */
.page-header {
    margin-bottom: 20px;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.page-header p {
    font-size: 0.85rem;
    color: var(--secondary-color);
}

.card {
    background-color: var(--card-background);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.info-item {
    padding: 10px;
    border-left: 3px solid var(--primary-color);
}

.info-item .label {
    display: block;
    font-size: 0.8rem;
    color: var(--secondary-color);
    margin-bottom: 5px;
}

.info-item .value {
    font-size: 1rem;
    font-weight: 500;
    color: var(--heading-color);
}

/*
 * TABLES
 */
.data-table-container {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    font-size: 0.9rem;
    white-space: nowrap;
}

.data-table th,
.data-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
}

.data-table th {
    background-color: #f1f1f1;
    font-weight: 600;
    color: var(--heading-color);
}

.data-table tr:hover {
    background-color: #f8f9fa;
}

.status-claimed {
    color: var(--success-color);
    font-weight: 600;
}

.show-all-transactions {
    text-align: center;
    padding: 15px 0 0;
}

/*
 * WIDGETS
 */
.counter-widget-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.counter-widget {
    background-color: var(--card-background);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    text-align: center;
}

.counter-widget .count {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1;
}

.counter-widget .label {
    font-size: 0.85rem;
    color: var(--secondary-color);
    margin-top: 5px;
}

/*
 * PATIENT CARD HOVER STYLES
 */
.patient-card {
    transition: all 0.3s ease;
    cursor: pointer;
}

.patient-card:hover {
    background-color: #ffdec7 !important;
    border-color: #007bff;
    border-left: 3px solid #0056b3;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.2);
    transform: translateY(-2px);
}

/*
 * RELATED VISITORS STYLES (Page 8)
 */
.family-tree {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    padding: 50px 0;
}

.patient-node {
    margin-bottom: 50px;
}

.patient-node .avatar-box {
    margin-bottom: 10px;
}

.patient-node img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
}

.patient-node .name {
    font-weight: 600;
    font-size: 1.1rem;
}

.patient-node .contact {
    font-size: 0.8rem;
    color: var(--secondary-color);
}

.family-relations {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    width: 100%;
    max-width: 900px;
}

.relation-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.relation-box .avatar-box {
    width: 100px;
    height: 100px;
    background-color: #e0f7fa;
    /* Light blue background for the icon circle */
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 10px;
}

.relation-box .avatar-box img {
    width: 60px;
    /* Placeholder icon size */
    height: 60px;
}

.relation-box .relationship-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary-color);
    margin: 5px 0;
}

.relation-box .name {
    font-weight: 500;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

.btn-insurance {
    background-color: var(--primary-color);
    color: white;
}

.btn-insurance:hover {
    background-color: #0056b3;
}


/* Lines for the family tree - A simplified, grid-based approach */
@media (min-width: 768px) {
    .family-tree::before {
        content: '';
        position: absolute;
        width: 1px;
        height: calc(100% - 100px);
        background: #ccc;
        top: 50px;
        left: 50%;
        transform: translateX(-50%);
        z-index: 0;
        display: none;
        /* Hide simplified line on large view, lines drawn by diagram */
    }

    .family-relations {
        grid-template-columns: repeat(4, 1fr);
        /* 4 columns for desktop to better match the diagram */
    }
}


/*
 * MEDIA QUERIES
 */
@media (min-width: 992px) {
    .sidebar {
        display: block;
        /* Show sidebar on desktop */
        position: sticky;
        top: 0;
        height: 100vh;
    }

    .main-content {
        padding: 30px;
    }

    .info-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}