/* Custom theme overrides for Bootstrap */
:root {
    --bs-primary: #2c5530;
    --bs-success: #2c5530;
}

.btn-success {
    background-color: #2c5530;
    border-color: #2c5530;
}

.btn-success:hover {
    background-color: #1e3a21;
    border-color: #1e3a21;
}

.navbar-brand {
    font-size: 1.5rem;
}

.card {
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15) !important;
}

/* Custom form styling */
.form-label {
    font-weight: 500;
    color: #2c5530;
}

/* Lot detail specific styles */
.detail-section {
    border-left: 4px solid #2c5530;
}

/* Ensure form controls get Bootstrap styling */
.form-control,
.form-select {
    display: block;
    width: 100%;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: #212529;
    background-color: #fff;
    background-image: none;
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus,
.form-select:focus {
    color: #212529;
    background-color: #fff;
    border-color: #2c5530;
    outline: 0;
    box-shadow: 0 0 0 0.25rem rgba(44, 85, 48, 0.25);
}

/* Textarea styling */
textarea.form-control {
    min-height: calc(1.5em + 0.75rem + 2px);
}

/* Modal fixes */
.modal {
    z-index: 1055;
}

.modal-backdrop {
    z-index: 1050;
}

.modal-content {
    z-index: 1056;
}

/* Ensure form controls in modals are enabled */
.modal .form-control,
.modal .form-select {
    pointer-events: auto;
    opacity: 1;
}

/* Sidebar styling - High specificity to override Bootstrap */
nav.sidebar,
#sidebar.sidebar {
    position: sticky !important;
    top: 0 !important;
    height: 100vh !important;
    overflow-y: auto !important;
    background: linear-gradient(180deg, #2c5530 0%, #1e3a21 100%) !important;
    background-color: #2c5530 !important;
    width: 180px !important;
    min-width: 180px !important;
    max-width: 180px !important;
    flex-shrink: 0 !important;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1) !important;
    border-right: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: white !important;
}

.sidebar-content {
    padding: 1.5rem 0;
}

.sidebar-brand {
    padding: 0 0.75rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 1rem;
}

.sidebar .brand-link,
#sidebar .brand-link,
.brand-link {
    display: flex !important;
    align-items: center !important;
    gap: 0.4rem !important;
    text-decoration: none !important;
    color: white !important;
    font-size: 1.4rem !important;
    font-weight: 700 !important;
    transition: opacity 0.2s !important;
    white-space: nowrap !important;
    min-width: 0 !important;
}

.sidebar .brand-link:hover,
.sidebar .brand-link:focus,
.sidebar .brand-link:active,
#sidebar .brand-link:hover,
#sidebar .brand-link:focus,
#sidebar .brand-link:active,
.brand-link:hover,
.brand-link:focus,
.brand-link:active {
    opacity: 0.9 !important;
    color: white !important;
    text-decoration: none !important;
}

.brand-link i {
    font-size: 1.8rem;
    color: #8fbc8f;
    flex-shrink: 0;
}

.brand-text {
    letter-spacing: 0.3px;
    white-space: nowrap !important;
    flex-shrink: 0;
    font-size: 1.4rem !important;
}

.sidebar-nav {
    padding: 0 0.75rem;
}

.sidebar .nav-item {
    margin-bottom: 0.25rem;
}

nav.sidebar .nav-link,
#sidebar .nav-link,
.sidebar .nav-link,
.sidebar-nav .nav-link {
    display: flex !important;
    align-items: center !important;
    gap: 0.75rem !important;
    padding: 0.75rem 1rem !important;
    border-radius: 0.5rem !important;
    color: rgba(255, 255, 255, 0.85) !important;
    text-decoration: none !important;
    transition: all 0.2s ease !important;
    font-size: 0.95rem !important;
    position: relative !important;
    background-color: transparent !important;
}

nav.sidebar .nav-link:hover,
nav.sidebar .nav-link:focus,
#sidebar .nav-link:hover,
#sidebar .nav-link:focus,
.sidebar .nav-link:hover,
.sidebar .nav-link:focus {
    background-color: rgba(255, 255, 255, 0.1) !important;
    color: white !important;
    transform: translateX(2px) !important;
    text-decoration: none !important;
}

nav.sidebar .nav-link:active,
nav.sidebar .nav-link.active,
#sidebar .nav-link:active,
#sidebar .nav-link.active,
.sidebar .nav-link:active,
.sidebar .nav-link.active {
    background-color: rgba(255, 255, 255, 0.15) !important;
    color: white !important;
    font-weight: 600 !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
    text-decoration: none !important;
}

.sidebar .nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background-color: #8fbc8f;
    border-radius: 0 2px 2px 0;
}

.sidebar .nav-link i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
    opacity: 0.9;
}

.sidebar .nav-link.active i {
    opacity: 1;
}

.sidebar .nav-link span {
    flex: 1;
}

.sidebar-divider {
    height: 1px;
    background-color: rgba(255, 255, 255, 0.1);
    margin: 0.75rem 0;
    padding: 0 !important;
}

/* Responsive: On mobile, make sidebar collapsible */
@media (max-width: 768px) {
    nav.sidebar,
    #sidebar.sidebar {
        position: fixed !important;
        left: -180px !important;
        transition: left 0.3s !important;
        z-index: 1000 !important;
        box-shadow: 2px 0 10px rgba(0,0,0,0.3) !important;
        width: 180px !important;
        min-width: 180px !important;
        max-width: 180px !important;
    }
    
    nav.sidebar.show,
    #sidebar.sidebar.show {
        left: 0 !important;
    }
    
    .sidebar-toggle {
        position: fixed;
        top: 1rem;
        left: 1rem;
        z-index: 1001;
        background-color: #2c5530;
        color: white;
        border: none;
        padding: 0.5rem 0.75rem;
        border-radius: 0.25rem;
        font-size: 1.25rem;
        cursor: pointer;
        box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    }
    
    .sidebar-toggle:hover {
        background-color: #1e3a21;
    }
    
    /* Add overlay when sidebar is open on mobile */
    nav.sidebar.show::before,
    #sidebar.sidebar.show::before {
        content: '';
        position: fixed;
        top: 0;
        left: 180px;
        right: 0;
        bottom: 0;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: -1;
    }
    
    /* Adjust main content margin on mobile */
    .flex-grow-1 {
        margin-left: 0 !important;
    }
    
    /* Add padding to main content to account for hamburger menu */
    .flex-grow-1 main {
        padding-top: 4rem !important;
        padding-left: 1rem !important;
    }
    
    .flex-grow-1 .container-fluid {
        padding-left: 1.5rem !important;
    }
}

/* Ensure main content area doesn't shrink */
.d-flex > .flex-grow-1 {
    flex: 1 1 auto !important;
    min-width: 0 !important;
}
