/* ระบบบันทึกการเยี่ยมบ้าน - Sidebar Layout */
:root {
    --sidebar-width: 260px;
    --topbar-height: 50px;
}

body {
    font-family: 'Sarabun', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: #f5f7fa;
    margin: 0;
    overflow-x: hidden;
}

/* ===== Top Bar ===== */
.topbar {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--topbar-height);
    padding: 0 20px;
    z-index: 1030;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

/* ===== Sidebar ===== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    overflow-y: auto;
    z-index: 1040;
    transition: transform 0.3s ease;
    box-shadow: 2px 0 8px rgba(0,0,0,0.15);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 18px;
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,0.15);
}

.sidebar-brand img {
    border-radius: 6px;
}

.sidebar-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.sidebar-brand-text span {
    font-weight: 700;
    font-size: 0.95rem;
}

.sidebar-brand-text small {
    font-size: 0.7rem;
    opacity: 0.75;
}

/* Sidebar Nav */
.sidebar-nav {
    list-style: none;
    padding: 8px 0;
    margin: 0;
}

.sidebar-nav li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    font-size: 0.92rem;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.sidebar-nav li a:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

.sidebar-nav li a.active {
    background: rgba(255,255,255,0.15);
    color: #fff;
    border-left-color: #fff;
    font-weight: 600;
}

.sidebar-nav li a i {
    font-size: 1.15rem;
    width: 22px;
    text-align: center;
}

.sidebar-divider {
    height: 0;
    margin: 8px 16px;
    border-top: 1px solid rgba(255,255,255,0.15);
}

.sidebar-heading {
    padding: 10px 20px 4px;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.45);
    font-weight: 600;
}

/* Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 1035;
}

/* ===== Main Content ===== */
.main-content {
    margin-left: var(--sidebar-width);
    padding-top: calc(var(--topbar-height) + 16px);
    min-height: 100vh;
}

/* ===== Cards ===== */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: transform 0.2s;
}

.card:hover {
    transform: translateY(-1px);
}

.table th {
    font-weight: 600;
    color: #495057;
    white-space: nowrap;
}

.btn {
    border-radius: 8px;
}

.form-control, .form-select {
    border-radius: 8px;
}

.badge {
    border-radius: 6px;
}

.card h3 {
    font-weight: 700;
    margin-bottom: 0;
}

/* ===== Mobile Responsive ===== */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.show {
        transform: translateX(0);
    }
    .sidebar-overlay.show {
        display: block;
    }
    .topbar {
        left: 0;
    }
    .main-content {
        margin-left: 0;
    }
}

@media (min-width: 992px) {
    #sidebarToggle {
        display: none !important;
    }
}

@media (max-width: 768px) {
    .table-responsive {
        font-size: 0.85rem;
    }
}
}
