/* Global Styles - Mobile First */

:root {
    --primary-color: #234C81;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --light-bg: #f8f9fa;
    --dark-text: #212529;
    --border-color: #dee2e6;
    --sidebar-width: 250px;
    
    /* Override Bootstrap primary color variables */
    --bs-primary: #234C81;
    --bs-primary-rgb: 35, 76, 129;
    --bs-primary-bg-subtle: rgba(35, 76, 129, 0.1);
    --bs-primary-border-subtle: rgba(35, 76, 129, 0.2);
}

* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--dark-text);
    background-color: #fff;
}

/* Top Bar */
.top-bar {
    background-color: #fff;
    padding: 0.75rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.top-bar-logo .logo-img {
    max-height: 50px;
    width: auto;
    object-fit: contain;
    display: block;
}

/* User Profile */
.user-profile-btn {
    text-decoration: none;
    color: var(--dark-text);
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    transition: all 0.2s;
}

.user-profile-btn:hover {
    background-color: var(--light-bg);
    color: var(--dark-text);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-avatar i {
    width: 18px;
    height: 18px;
}

.user-name {
    font-weight: 500;
    font-size: 0.875rem;
}

.user-profile .dropdown-menu {
    margin-top: 0.5rem;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.user-profile .dropdown-item {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.user-profile .dropdown-item i {
    width: 16px;
    height: 16px;
}

/* Sidebar Styles */
.sidebar {
    height: calc(100vh - 60px); /* Viewport height minus top bar */
    background-color: var(--light-bg);
    border-right: 1px solid var(--border-color);
    padding: 0;
    overflow-y: auto;
    overflow-x: hidden;
    position: sticky;
    top: 60px; /* Offset by top bar height */
}

.sidebar-header {
    background-color: #fff;
}

.sidebar .nav-link {
    color: var(--dark-text);
    padding: 0.75rem 1rem;
    border-radius: 0.25rem;
    margin: 0.25rem 0.5rem;
    display: flex;
    align-items: center;
    transition: all 0.2s;
}

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

.sidebar .nav-link.active {
    background-color: var(--primary-color);
    color: #fff;
}

.sidebar .nav-link i {
    width: 18px;
    height: 18px;
}

/* Main Content */
main {
    height: calc(100vh - 60px); /* Viewport height minus top bar */
    background-color: #fff;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Page Title */
#page-title {
    display: flex;
    align-items: center;
}

#page-title i {
    width: 24px;
    height: 24px;
    color: var(--primary-color);
}

/* Subtitle styling */
h2.mb-1 {
    font-size: 1rem;
    font-weight: 500;
    color: var(--secondary-color);
    margin-bottom: 0.25rem !important;
    line-height: 1.4;
}

/* Cards */
.card {
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 1.5rem;
}

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

/* Badges */
.badge {
    padding: 0.35em 0.65em;
    font-size: 0.75em;
    font-weight: 600;
    border-radius: 0.25rem;
}

.badge-status-ready {
    background-color: var(--success-color);
    color: #fff;
}

.badge-status-not-ready {
    background-color: var(--danger-color);
    color: #fff;
}

.badge-status-pending {
    background-color: var(--warning-color);
    color: #000;
}

/* Buttons */
.btn {
    border-radius: 0.375rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: all 0.2s;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

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

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
    background-color: #1a3a66;
    border-color: #1a3a66;
}

.btn-primary:focus {
    box-shadow: 0 0 0 0.2rem rgba(35, 76, 129, 0.25);
}

/* Override Bootstrap Primary Badge */
.bg-primary {
    background-color: var(--primary-color) !important;
}

/* Forms */
.form-label {
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--dark-text);
}

.form-control,
.form-select {
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(35, 76, 129, 0.25);
}

/* Tables */
.table {
    font-size: 0.875rem;
}

.table thead th {
    background-color: var(--light-bg);
    border-bottom: 2px solid var(--border-color);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

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

/* Modals */
.modal-header {
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
}

/* Alerts */
.alert {
    border-radius: 0.5rem;
    border: none;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
}

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

/* Responsive Utilities */
@media (max-width: 767.98px) {
    html, body {
        overflow: auto; /* Allow body scroll on mobile */
    }
    
    .sidebar {
        position: fixed;
        top: 60px; /* Below top bar */
        left: -100%;
        z-index: 1000;
        transition: left 0.3s;
        height: calc(100vh - 60px); /* Full height minus top bar */
        overflow-y: auto;
    }
    
    .sidebar.show {
        left: 0;
    }
    
    main {
        margin-left: 0;
        height: auto; /* Auto height on mobile */
        overflow-y: visible;
    }
    
    .card {
        margin-bottom: 1rem;
    }
}

/* Status Indicators */
.status-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 0.5rem;
}

.status-indicator.ready {
    background-color: var(--success-color);
}

.status-indicator.not-ready {
    background-color: var(--danger-color);
}

.status-indicator.pending {
    background-color: var(--warning-color);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--secondary-color);
}

.empty-state i {
    width: 64px;
    height: 64px;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Action Buttons */
.action-btn {
    padding: 0.25rem 0.5rem;
    margin: 0 0.25rem;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 0.25rem;
    transition: all 0.2s;
}

.action-btn:hover {
    background-color: var(--light-bg);
}

.action-btn.edit {
    color: var(--primary-color);
}

.action-btn.delete {
    color: var(--danger-color);
}

.action-btn.view {
    color: var(--info-color);
}

/* Dashboard Styles */
.stat-card {
    transition: transform 0.2s, box-shadow 0.2s;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

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

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.stat-icon i {
    width: 28px;
    height: 28px;
}

.stat-card .bg-primary {
    background-color: var(--primary-color) !important;
}

.stat-card h3 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--dark-text);
}

.stat-card h6 {
    font-size: 0.875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Activity List */
.activity-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.activity-item {
    display: flex;
    padding: 1.25rem;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s;
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-item:hover {
    background-color: var(--light-bg);
}

.activity-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    margin-right: 1rem;
    flex-shrink: 0;
}

.activity-icon i {
    width: 20px;
    height: 20px;
}

.activity-content {
    flex: 1;
}

.activity-content h6 {
    font-size: 0.9375rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--dark-text);
}

.activity-content p {
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.activity-content small {
    font-size: 0.75rem;
}

/* Chart Container */
.card canvas {
    max-height: 250px;
}

/* ===== Searchable Dropdown Component ===== */
.searchable-dropdown {
    position: relative;
}

.searchable-dropdown .form-control.selected {
    background-color: #f8f9fa;
    font-weight: 500;
}

.searchable-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1055;
    max-height: 260px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #dee2e6;
    border-top: 0;
    border-radius: 0 0 0.375rem 0.375rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.searchable-dropdown-menu.show {
    display: block;
}

.searchable-dropdown-item {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.1s;
}

.searchable-dropdown-item:last-of-type {
    border-bottom: none;
}

.searchable-dropdown-item:hover,
.searchable-dropdown-item.active {
    background-color: #e9ecef;
}

.searchable-dropdown-item.selected {
    background-color: #e7f0fd;
    font-weight: 500;
}

.searchable-dropdown-label {
    font-size: 0.875rem;
    color: #212529;
}

.searchable-dropdown-subtitle {
    font-size: 0.75rem;
    color: #6c757d;
}

.searchable-dropdown-empty,
.searchable-dropdown-hint {
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    color: #6c757d;
    text-align: center;
    font-style: italic;
}

/* ===== Section filter bars – consistent layout ===== */
.section-filter-card .card-body {
    padding: 0.75rem 1rem;
}
.section-filter-card .form-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #6c757d;
    margin-bottom: 0.25rem;
}
.section-search-input {
    max-width: 100%;
}

/* ===== Consistent table card headers ===== */
.card > .card-header {
    border-bottom: 1px solid #e9ecef;
}
.card > .card-header h5 {
    font-size: 1rem;
    font-weight: 600;
}

/* ===== Pagination – consistent padding so it doesn’t touch borders ===== */
.section-pagination-wrap {
    padding: 0.75rem 1rem 1rem;
    border-top: 1px solid #e9ecef;
}
.pagination-wrapper {
    padding: 0.5rem 0;
    border-top: none;
}
/* When pagination is inside section-pagination-wrap, wrapper doesn’t need its own top border */
.section-pagination-wrap .pagination-wrapper {
    border-top: none;
}
.pagination-wrapper .pagination {
    margin-bottom: 0;
}
.pagination-wrapper .form-select-sm {
    font-size: 0.8rem;
    padding: 0.2rem 1.75rem 0.2rem 0.5rem;
}

