﻿:root {
    --primary-color: #8B4513;
    --secondary-color: #D2691E;
    --sidebar-bg: #ffffff;
    --sidebar-text: #4a5568;
    --sidebar-hover: #f3f4f6;
    --sidebar-active: #D2691E;
    --sidebar-border: #e2e8f0;
    --section-title: #6b7280;
    --font-small: 0.95rem;
    --font-xsmall: 0.82rem;
}

/* Sidebar Base */
.sidebar {
    min-height: 100vh;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    padding: 0.5rem 0.375rem;
    position: sticky;
    top: 0;
    overflow: hidden;
    font-family: 'Roboto', sans-serif;
    font-size: var(--font-xsmall);
    box-shadow: 1px 0 5px rgba(0, 0, 0, 0.05);
}

.sidebar:hover {
    overflow-y: auto;
}

/* Sidebar Header */
.sidebar-header {
    padding: 0.5rem 0.25rem;
    border-bottom: 1px solid var(--sidebar-border);
    margin-bottom: 0.5rem;
}

.sidebar-header img {
    width: 100px;
    height: 100px;
    margin: 0 auto;
    display: block;
}

.sidebar-header h5 {
    font-size: var(--font-small);
    font-weight: 600;
    color: var(--primary-color);
    margin: 0.375rem 0 0;
    text-align: center;
}

/* Navigation Links */
.sidebar .nav-link {
    color: var(--sidebar-text);
    padding: 0.5rem;
    border-radius: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
    position: relative;
}

.sidebar .nav-link:hover {
    color: var(--primary-color);
    background-color: var(--sidebar-hover);
}

.sidebar .nav-link.active {
    background-color: var(--sidebar-active);
    color: white;
}

/* Icon Styling */
.sidebar .nav-link i {
    font-size: 1rem;
    min-width: 1.25rem;
    text-align: center;
}

/* Dropdown Styling */
.sidebar .dropdown-toggle {
    position: relative;
    width: 100%;
    justify-content: flex-start;
}

.sidebar .dropdown-toggle::after {
    display: none !important;
}

.sidebar .toggle-icon {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    transition: transform 0.2s ease;
    font-size: 0.75rem;
}

.sidebar .dropdown-toggle[aria-expanded="true"] .toggle-icon {
    transform: translateY(-50%) rotate(180deg);
}

/* Nested Navigation */
.sidebar .collapse {
    padding-left: 1.5rem;
}

.sidebar .collapse .nav-link {
    padding: 0.375rem 0.5rem;
    font-size: 0.85em;
}

/* Section Titles */
.nav-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--section-title);
    padding: 0.25rem 0.5rem;
    margin-bottom: 0.125rem;
}

/* Active State Enhancements */
.sidebar .nav-link.active i {
    opacity: 1;
    color: white;
}

/* Scrollbar Styling */
.sidebar::-webkit-scrollbar {
    width: 3px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}

/* Text Spacing */
.sidebar .nav-link span {
    flex: 1;
}

/* Hover Effects */
.sidebar .nav-link:hover i {
    opacity: 1;
}

/* Collapsed State */
.sidebar .collapse:not(.show) {
    display: none;
}

.sidebar .collapsing {
    height: 0;
    overflow: hidden;
    transition: height 0.2s ease;
}

.main-content-wrapper {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.main-content-wrapper>main {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    overflow: hidden;
}

.main-content-body {
    flex-grow: 1;
    overflow-y: auto;
    padding: 1rem;
}

.sticky-top-nav {
    position: sticky;
    top: 0;
    z-index: 1020;
    background-color: #fff;
    /* Match your theme */
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .sidebar {
        padding: 0.375rem 0.25rem;
    }

    .sidebar-header img {
        width: 35px;
        height: 35px;
    }

    .sidebar-header h5 {
        font-size: 0.75rem;
    }
}

.card {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.card-header {
    background-color: var(--primary-color);
    color: white;
}

/* Table container */
.table-container {
    background-color: var(--table-background);
    border-radius: 0.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    margin-top: 1rem;
}

.table th,
.table td {
    border: 1px solid var(--table-border-color);
    padding: 0.75rem;
}

.table th {
    background-color: var(--table-header-bg);
    text-align: left;
    font-weight: bold;
}

.table tbody tr:hover {
    background-color: #f1f1f1;
}

.action-button {
    display: inline-block;
    padding: 8px;
    font-size: 20px;
    color: darkslategray;
    border: none;
    background-color: transparent;
    cursor: pointer;
    transition: color 0.3s ease;
}

.action-button:hover {
    color: #0056b3;
}

.modal.top-right .modal-dialog {
    position: fixed;
    margin: 0;
    top: 80px;
    /* Adjust based on your navbar height */
    right: 20px;
    transform: none !important;
    width: 400px;
    /* Increased width */
}

.modal.fade.top-right .modal-dialog {
    transform: none !important;
}

/* Add some padding and make inputs larger */
.modal.top-right .modal-body {
    padding: 24px;
}

.modal.top-right .form-control {
    padding: 12px;
    font-size: 16px;
}

/*
 Mobile-specific improvements (minimal and safe) */
@media (max-width: 767.98px) {

    /* Add padding to main content to account for mobile menu button */
    .main-content-body {
        padding-top: 60px;
    }

    /* Make dashboard cards stack nicely on mobile */
    .dashboard-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    /* Improve mobile table display */
    .table-responsive {
        font-size: 0.875rem;
    }

    /* Better mobile form spacing */
    .form-control,
    .form-select {
        margin-bottom: 1rem;
    }

    /* Mobile-friendly buttons */
    .btn-group {
        flex-direction: column;
    }

    .btn-group .btn {
        margin-bottom: 0.5rem;
        border-radius: 0.375rem !important;
    }
}

/* Tablet improvements */
@media (min-width: 768px) and (max-width: 991.98px) {
    .main-content-body {
        padding: 1.5rem 1rem;
    }
}

/* Ensure mobile menu button is properly styled */
.btn[data-bs-toggle="offcanvas"] {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Mobile offcanvas styling */
.offcanvas .nav-link {
    padding: 0.75rem 1rem;
    border-radius: 0.375rem;
    margin-bottom: 0.25rem;
    transition: all 0.2s ease;
}

.offcanvas .nav-link:hover {
    background-color: var(--sidebar-hover);
    color: var(--primary-color);
}

.offcanvas .nav-link i {
    width: 20px;
    text-align: center;
}

/* 
Mobile menu button styling */
.mobile-menu-btn {
    background: transparent;
    border: 1px solid var(--sidebar-border);
    color: var(--primary-color);
    padding: 0.5rem;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.mobile-menu-btn:hover {
    background-color: var(--sidebar-hover);
    color: var(--primary-color);
    border-color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.mobile-menu-btn:focus {
    background-color: var(--sidebar-hover);
    color: var(--primary-color);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(139, 69, 19, 0.25);
}

.mobile-menu-btn i {
    font-size: 1.2rem;
    line-height: 1;
}

/* Remove the previous mobile padding since button is now in header */
@media (max-width: 767.98px) {
    .main-content-body {
        padding-top: 1rem;
        /* Reset to normal padding */
    }
}