/* 
 * Household Information Management System (HIMS)
 * Main Stylesheet
 */

 :root {
    --sidebar-width: 250px;
    --topbar-height: 56px;
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
}

/* General Layout Styles */
body {
    overflow-x: hidden;
    background-color: #f8f9fa;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.wrapper {
    display: flex;
    width: 100%;
    min-height: 100vh;
    align-items: stretch;
}

/* Main content container */
.content-wrapper {
    width: 100%;
    margin-top: var(--topbar-height);
    margin-left: var(--sidebar-width);
    padding: 20px;
    transition: margin-left 0.3s ease;
}

/* For mobile devices - hide sidebar by default */
@media (max-width: 992px) {
    .content-wrapper {
        margin-left: 0;
    }
    
    .sidebar {
        margin-left: calc(-1 * var(--sidebar-width));
    }
    
    .sidebar.active {
        margin-left: 0;
    }
}

/* Sidebar Styles */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    padding-top: var(--topbar-height);
    z-index: 998;
    transition: margin-left 0.3s ease;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.sidebar .list-group-item {
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    border-color: #495057;
    transition: all 0.2s;
}

.sidebar .list-group-item.active {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.sidebar .list-group-item:hover:not(.active) {
    background-color: #2d3238;
}

/* Topbar Styles */
.navbar {
    padding-left: 15px;
    padding-right: 15px;
    z-index: 999;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.navbar-brand {
    font-weight: 600;
}

/* Card Styles */
.card {
    border: none;
    border-radius: 10px;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    margin-bottom: 20px;
}

.card-header {
    background-color: #fff;
    border-bottom: 1px solid rgba(0, 0, 0, 0.125);
    padding: 15px 20px;
    font-weight: 600;
}

.card-header:first-child {
    border-radius: 10px 10px 0 0;
}

.card-footer {
    background-color: #fff;
    border-top: 1px solid rgba(0, 0, 0, 0.125);
    padding: 15px 20px;
}

/* Dashboard Stats Cards */
.stats-card {
    border-left: 5px solid;
    transition: transform 0.3s;
}

.stats-card:hover {
    transform: translateY(-5px);
}

.stats-card.primary {
    border-left-color: var(--primary-color);
}

.stats-card.success {
    border-left-color: var(--success-color);
}

.stats-card.warning {
    border-left-color: var(--warning-color);
}

.stats-card.danger {
    border-left-color: var(--danger-color);
}

.stats-card .card-body {
    padding: 20px;
}

.stats-card .icon {
    font-size: 2.5rem;
    opacity: 0.6;
}

.stats-card .stat-number {
    font-size: 1.75rem;
    font-weight: 700;
}

/* Data Tables Customization */
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_processing,
.dataTables_wrapper .dataTables_paginate {
    margin-bottom: 10px;
    color: var(--dark-color);
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    border-radius: 5px;
}

/* Forms Styling */
.form-control, .form-select {
    border-radius: 5px;
    padding: 0.5rem 0.75rem;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(0, 123, 255, 0.25);
}

label {
    font-weight: 500;
    margin-bottom: 0.5rem;
}

/* Buttons */
.btn {
    border-radius: 5px;
    padding: 0.5rem 1rem;
    font-weight: 500;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: #0069d9;
    border-color: #0062cc;
}

/* Utilities */
.border-left-primary {
    border-left: 4px solid var(--primary-color);
}

.border-left-success {
    border-left: 4px solid var(--success-color);
}

.border-left-warning {
    border-left: 4px solid var(--warning-color);
}

.border-left-danger {
    border-left: 4px solid var(--danger-color);
}

/* Navbar Dropdown Hover */
.dropdown:hover .dropdown-menu {
    display: block;
    margin-top: 0;
}

/* Page Headings */
.page-heading {
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #dee2e6;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .content-wrapper {
        padding: 15px;
    }
    
    .card-header, .card-body, .card-footer {
        padding: 12px;
    }
    
    .stats-card .stat-number {
        font-size: 1.5rem;
    }
}


/* Fix for oversized elements */
.content-wrapper {
    padding: 15px;
    margin-top: 56px; /* Match topbar height */
    width: 100%;
}

/* Adjust table column widths */
#usersTable th, #usersTable td {
    font-size: 0.9rem;
    padding: 0.5rem;
}

/* Reduce card padding */
.card-body {
    padding: 0.75rem;
}

/* Make buttons more compact */
.btn-sm {
    padding: 0.25rem 0.4rem;
    font-size: 0.75rem;
}

/* Adjust sidebar width */
.sidebar {
    width: 220px; /* Smaller sidebar width */
}

/* Adjust content margin when sidebar is visible */
@media (min-width: 992px) {
    .content-wrapper {
        margin-left: 220px; /* Match sidebar width */
    }
}

/* Make headings smaller */
.h3, h3 {
    font-size: 1.5rem;
}

/* Reduce card margins */
.card {
    margin-bottom: 0.75rem;
}