/* Blacktech Shelfflow Main Styles */

/* Base styles - variables now defined in css/base.css */

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--app-bg);
    color: var(--text-color);
}

/* Navigation */
.navbar-brand {
    font-weight: bold;
    color: var(--header-text-color) !important;
}

.navbar-nav .nav-link {
    font-weight: 500;
}

/* Cards */
.card {
    border: none;
    background-color: var(--card-bg);
    color: var(--card-text-color);
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    transition: box-shadow 0.15s ease-in-out;
}

.card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.card-header {
    background-color: var(--card-header-bg);
    color: var(--card-header-text-color);
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
}

/* Buttons */
.btn {
    font-weight: 500;
    border-radius: 0.375rem;
}

.btn-primary {
    /* background-color: var(--primary-color); */
    border-color: var(--primary-color);
}

/* Tables */
.table {
    background-color: var(--table-bg);
}

.table th {
    border-top: none;
    font-weight: 600;
    color: var(--text-color);
}

/* Forms */
.form-control {
    border-radius: 0.375rem;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Dashboard stats */
.stat-card {
    background: linear-gradient(135deg, var(--primary-color), #0056b3);
    color: white;
    border-radius: 0.5rem;
}

.stat-card .stat-number {
    font-size: 2rem;
    font-weight: bold;
}

.stat-card .stat-label {
    font-size: 0.875rem;
    opacity: 0.9;
}

/* Notifications */
.notification-item {
    border-left: 4px solid var(--primary-color);
    background-color: white;
    padding: 1rem;
    margin-bottom: 0.5rem;
    border-radius: 0.25rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.notification-item.unread {
    background-color: #f8f9ff;
}

.notification-item.warning {
    border-left-color: var(--warning-color);
}

.notification-item.error {
    border-left-color: var(--danger-color);
}

.notification-item.success {
    border-left-color: var(--success-color);
}

/* Sidebar */
.sidebar {
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text-color);
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    min-height: calc(100vh - 56px);
}

.sidebar .nav-link {
    color: var(--sidebar-link-color) !important;
    padding: 0.75rem 1rem;
    border-radius: 0.25rem;
    margin: 0.125rem 0;
}

.sidebar .nav-link:hover {
    background-color: var(--sidebar-link-hover-bg);
    color: var(--sidebar-text-color) !important;
}

.sidebar .nav-link.active {
    background-color: var(--sidebar-link-active-bg);
    color: var(--sidebar-text-color) !important;
}

/* Responsive utilities */
@media (max-width: 768px) {
    .sidebar {
        min-height: auto;
    }

    .stat-card .stat-number {
        font-size: 1.5rem;
    }
}

/* Loading spinner */
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

/* Alert styles */
.alert {
    border-radius: 0.375rem;
    border: none;
}

/* Badge styles */
.badge {
    font-weight: 500;
}

/* Custom utilities */
.text-muted {
    color: var(--secondary-color) !important;
}

.bg-light {
    background-color: var(--light-color) !important;
}

/* Sidebar Layout Styles */
.sidebar {
    width: 280px;
    min-height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    transition: all 0.3s ease;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar .nav-link {
    color: rgba(255, 255, 255, 0.8) !important;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 0.25rem;
    transition: all 0.3s ease;
    font-weight: 500;
}

.sidebar .nav-link:hover {
    color: white !important;
    background-color: rgba(255, 255, 255, 0.1);
    transform: translateX(5px);
}

.sidebar .nav-link.active {
    color: white !important;
    background-color: rgba(255, 255, 255, 0.2);
}

.sidebar .nav-section-header {
    padding: 0.5rem 1rem;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-brand {
    font-size: 1.25rem;
    font-weight: 700;
}

.brand-text {
    transition: opacity 0.3s ease;
    color: #ffffff !important;
}

.avatar-circle {
    width: 32px;
    height: 32px;
    font-size: 0.875rem;
}

/* Top Header Styles */
.top-header {
    margin-left: 0 !important;
    height: 70px;
    position: sticky;
    top: 0;
    z-index: 999;
    background: var(--header-bg);
    color: var(--header-text-color);
    border-bottom: 1px solid var(--border-color);
}

/* Main Content Area */
.main-content-wrapper {
    margin-left: 280px;
    min-height: calc(100vh - 70px);
    display: flex;
    flex-direction: column;
}

/* Standardized Content Width System */
main.container-fluid {
    padding: 0;
    width: 100%;
    max-width: none;
}

/* Main content wrapper with percentage-based width */
.content-wrapper {
    width: 75%;
    min-width: 320px;
    max-width: none;
    margin: 0 auto;
    padding: 2rem 2rem;
    box-sizing: border-box;
}

/* Content wrappers background: map to theme-aware white (dark -> dark surface) */
.content-wrapper,
.content-wrapper-narrow,
.content-wrapper-full {
    background-color: var(--white);
    color: var(--text-color);
}


/* Alternative content wrapper for forms and detailed pages */
.content-wrapper-narrow {
    width: 70%;
    min-width: 300px;
    max-width: none;
    margin: 0 auto;
    padding: 2rem 2rem;
    box-sizing: border-box;
}

/* Full width content wrapper for tables and lists */
.content-wrapper-full {
    width: 80%;
    min-width: 350px;
    max-width: none;
    margin: 0 auto;
    padding: 2rem 2rem;
    box-sizing: border-box;
}

/* Ensure all page elements respect the content wrapper */
.page-header {
    margin-bottom: 2rem;
    width: 100%;
}

.card, .form-section {
    width: 100%;
    margin-left: 0;
    margin-right: 0;
    box-sizing: border-box;
}

/* Ensure percentage-based widths work with sidebar */
.main-content-wrapper {
    width: 100%;
    box-sizing: border-box;
}

/* Prevent horizontal scrolling */
.content-wrapper *,
.content-wrapper-narrow *,
.content-wrapper-full * {
    box-sizing: border-box;
}

/* Responsive Sidebar */
@media (max-width: 768px) {
    .sidebar {
        margin-left: -280px;
    }

    .sidebar.show {
        margin-left: 0;
    }

    .top-header,
    .main-content-wrapper {
        margin-left: 0;
    }

    .content-wrapper,
    .content-wrapper-narrow,
    .content-wrapper-full {
        width: 95%;
        padding: 1rem 1rem;
    }

    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 999;
        display: none;
    }

    .sidebar-overlay.show {
        display: block;
    }
}

/* Sticky Footer with Scroll Behavior */
.sticky-footer {
    position: fixed;
    bottom: 0;
    left: 280px;
    right: 0;
    z-index: 1000;
    transform: translateY(0);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

.sticky-footer.hidden {
    transform: translateY(100%);
}

.sticky-footer:hover {
    transform: translateY(0) !important;
}

/* Ensure body has proper flex layout for sticky footer */
body.d-flex.flex-column.min-vh-100 {
    margin-bottom: 0;
}

/* Add padding to main content to account for fixed footer */
.main-content-wrapper {
    padding-bottom: 120px; /* Adjust based on footer height */
}

@media (max-width: 768px) {
    .sticky-footer {
        left: 0;
    }

    .main-content-wrapper {
        padding-bottom: 100px;
    }
}

/* Ensure body has proper flex layout for sticky footer */
body.d-flex.flex-column.min-vh-100 {
    margin-bottom: 0;
}

/* Add padding to main content to account for fixed footer */
main.flex-grow-1 {
    padding-bottom: 120px; /* Adjust based on footer height */
}

/* Responsive Content Width Adjustments */
@media (max-width: 576px) {
    .content-wrapper,
    .content-wrapper-narrow,
    .content-wrapper-full {
        width: 100%;
        padding: 1rem 1.5rem; /* Match header px-4 horizontal gutters */
    }
}

@media (min-width: 577px) and (max-width: 768px) {
    .content-wrapper {
        width: 85%;
        padding: 1.5rem 1rem;
    }

    .content-wrapper-narrow {
        width: 80%;
        padding: 1.5rem 1rem;
    }

    .content-wrapper-full {
        width: 90%;
        padding: 1.5rem 1rem;
    }
}

@media (min-width: 769px) and (max-width: 992px) {
    .content-wrapper {
        width: 80%;
        padding: 2rem 1.5rem;
    }

    .content-wrapper-narrow {
        width: 75%;
        padding: 2rem 1.5rem;
    }

    .content-wrapper-full {
        width: 85%;
        padding: 2rem 1.5rem;
    }
}

@media (min-width: 993px) and (max-width: 1200px) {
    .content-wrapper {
        width: 75%;
        padding: 2rem 2rem;
    }

    .content-wrapper-narrow {
        width: 70%;
        padding: 2rem 2rem;
    }

    .content-wrapper-full {
        width: 80%;
        padding: 2rem 2rem;
    }
}

/* Large screens maintain the base percentages */
@media (min-width: 1201px) {
    .content-wrapper {
        width: 75%;
    }

    .content-wrapper-narrow {
        width: 70%;
    }

    .content-wrapper-full {
        width: 80%;
    }
}

/* Bootstrap Grid Adjustments */
.row {
    margin-left: 0;
    margin-right: 0;
}

.col, .col-1, .col-2, .col-3, .col-4, .col-5, .col-6,
.col-7, .col-8, .col-9, .col-10, .col-11, .col-12,
.col-sm, .col-sm-1, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6,
.col-sm-7, .col-sm-8, .col-sm-9, .col-sm-10, .col-sm-11, .col-sm-12,
.col-md, .col-md-1, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6,
.col-md-7, .col-md-8, .col-md-9, .col-md-10, .col-md-11, .col-md-12,
.col-lg, .col-lg-1, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6,
.col-lg-7, .col-lg-8, .col-lg-9, .col-lg-10, .col-lg-11, .col-lg-12,
.col-xl, .col-xl-1, .col-xl-2, .col-xl-3, .col-xl-4, .col-xl-5, .col-xl-6,
.col-xl-7, .col-xl-8, .col-xl-9, .col-xl-10, .col-xl-11, .col-xl-12 {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
}

/* Content Type Specific Adjustments */
.content-wrapper .page-header,
.content-wrapper-narrow .page-header,
.content-wrapper-full .page-header {
    margin-bottom: 2rem;
    padding: 0;
}

.content-wrapper .card,
.content-wrapper-narrow .card,
.content-wrapper-full .card {
    margin-bottom: 1.5rem;
}

/* Dashboard specific fixes */
.dashboard-stats .col {
    margin-bottom: 1rem;
}

/* Table responsive fixes */
.table-responsive {
    margin-left: 0;
    margin-right: 0;
    border-radius: 0.375rem;
    overflow: hidden;
}

/* Form specific fixes */
.form-section {
    margin-left: 0;
    margin-right: 0;
    width: 100%;
    margin-bottom: 2rem;
}

/* Breadcrumb adjustments */
.breadcrumb {
    background: none;
    padding: 0;
    margin: 0;
}

/* Ensure consistent button spacing */
.btn-group, .btn-toolbar {
    margin-bottom: 1rem;
}

/* Alert positioning adjustments */
.alert {
    margin-bottom: 1.5rem;
}

/* List group adjustments */
.list-group {
    margin-bottom: 1.5rem;
}

/* Pagination adjustments */
.pagination {
    justify-content: center;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

/* Utility Classes for Consistent Spacing */
.section-spacing {
    margin-bottom: 2rem;
}

.content-spacing {
    margin-bottom: 1.5rem;
}

.tight-spacing {
    margin-bottom: 1rem;
}

/* Ensure consistent width for all content elements */
.w-100 {
    width: 100% !important;
}

/* Fix any overflow issues */
.content-wrapper *,
.content-wrapper-narrow *,
.content-wrapper-full * {
    max-width: 100%;
    box-sizing: border-box;
}

/* Specific fixes for tables in different wrappers */
.content-wrapper-full .table-responsive {
    width: 100%;
    margin: 0;
    overflow-x: auto;
}

.content-wrapper .table-responsive,
.content-wrapper-narrow .table-responsive {
    width: 100%;
    margin: 0;
    overflow-x: auto;
}

/* Ensure tables don't break the percentage layout */
.table {
    width: 100%;
    min-width: 600px; /* Minimum width for table readability */
}

/* Print styles */
@media print {
    .no-print, .sidebar, .top-header {
        display: none !important;
    }

    .main-content-wrapper {
        margin-left: 0 !important;
        padding: 0 !important;
    }

    .sticky-footer {
        position: static !important;
        transform: none !important;
    }

    main.container-fluid {
        padding: 1rem !important;
        max-width: 100% !important;
    }
}


/* Ensure left sidebar is scrollable and brand/footer remain visible */
#sidebar.sidebar {
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0; /* fill viewport height on mobile too */
  overflow: hidden; /* only inner nav scrolls */
}
#sidebar .sidebar-nav {
  flex: 1 1 auto;
  min-height: 0; /* critical for flex child to allow overflow */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0 !important; /* remove extra bottom gap from .p-3 on mobile */
}
