:root {
    /* Primary Color System */
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;

    /* Neutral Palette */
    --bg-color: #f8fafc;
    --surface: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;

    /* Semantic Colors */
    --success: #10b981;
    --success-bg: #ecfdf5;
    --danger: #ef4444;
    --danger-bg: #fef2f2;
    --warning: #f59e0b;
    --warning-bg: #fffbeb;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.hidden {
    display: none !important;
}

/* Layout Containers */
#app {
    min-height: 100vh;
    display: flex;
}

.view {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Sidebar Styling */
.sidebar {
    width: 280px;
    background: var(--surface);
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    padding: 1.5rem 1rem;
    position: fixed;
    height: 100vh;
    z-index: 100;
    border-right: 1px solid var(--border);
}

.sidebar-logo {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 2.5rem;
    padding: 0 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-nav {
    list-style: none;
    flex: 1;
}

.nav-item {
    padding: 0.875rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    font-weight: 500;
    color: var(--text-muted);
    position: relative;
}

.nav-item:hover {
    background: var(--primary);
    color: white;
}

.nav-item.active {
    background: var(--primary);
    color: white;
}

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

.nav-badge {
    position: absolute;
    right: 1.25rem;
    background: transparent;
    color: #000000;
    font-size: 0.95rem;
    font-weight: 700;
    min-width: 18px;
    text-align: center;
    transition: all 0.2s;
}

.nav-item:hover .nav-badge,
.nav-item.active .nav-badge {
    color: #ffffff;
}

/* Notification specific badge styling */
#sidebar-notif-badge {
    background: var(--primary);
    color: #ffffff;
    font-size: 0.75rem;
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
    min-width: 20px;
    right: 1rem;
}

.nav-item:hover #sidebar-notif-badge,
.nav-item.active #sidebar-notif-badge {
    background: #ffffff;
    color: #000000;
}

/* Dashboard Layout */
.layout-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.sidebar-header {
    padding: 1.5rem 1rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 1rem;
}

.sidebar-header .logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.sidebar-header .logo i {
    color: var(--primary);
    font-size: 1.5rem;
}

.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin-left: 280px;
}

.content-area {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    background: var(--bg-color);
}

/* Topbar Icon Buttons */
.icon-btn {
    background: transparent;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.1rem;
    color: var(--text-muted);
    position: relative;
    transition: all 0.2s;
}

.icon-btn:hover {
    background: var(--bg-color);
    color: var(--primary);
}

#notifications-btn i {
    font-size: 1.4rem;
}

/* Topbar Search */
.search-bar {
    display: none;
    align-items: center;
    gap: 0.75rem;
    background: var(--bg-color);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 0.5rem 1rem;
    flex: 1;
    max-width: 400px;
    color: var(--text-muted);
}

.search-bar input {
    border: none;
    background: transparent;
    outline: none;
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--text-main);
    width: 100%;
}

.search-bar input::placeholder {
    color: var(--text-muted);
}

/* Topbar User Info */
.user-info h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
    line-height: 1.2;
}

.user-info span {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: capitalize;
}

/* Notification Badge on Bell */
.badge-notif {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--danger);
    color: white;
    font-size: 0.65rem;
    padding: 1px 5px;
    border-radius: 10px;
    font-weight: 700;
    min-width: 16px;
    text-align: center;
    pointer-events: none;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 1rem;
}

/* Main Content Area */
.main-content {
    margin-left: 280px;
    padding: 1.5rem;
    width: calc(100% - 280px);
}

.page-header {
    margin-bottom: 1.5rem;
}

.marketplace-page-header {
    margin-bottom: 0.45rem;
}

.page-header h2 {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.25rem;
}

.page-header p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Topbar Styling */
.topbar {
    height: 70px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 2rem;
    gap: 1.5rem;
    position: sticky;
    top: 0;
    z-index: 90;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn-icon {
    background: transparent;
    border: none;
    font-size: 1.25rem;
    color: var(--text-muted);
    cursor: pointer;
    position: relative;
    padding: 0.5rem;
    border-radius: 0.5rem;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: var(--bg-color);
    color: var(--primary);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0.25rem 0.5rem;
    border-radius: 0.5rem;
}

.user-profile:hover {
    background: var(--bg-color);
}

.user-profile span {
    font-weight: 600;
    font-size: 0.95rem;
}

.avatar {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    overflow: hidden;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
}

.user-profile:hover .avatar {
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(37, 99, 235, 0.3);
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Common Components */
.card {
    background: var(--surface);
    border-radius: 1rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1rem;
    overflow: hidden;
}

.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
}

.card-body {
    padding: 1rem;
}

/* Table Styling */
.table-responsive {
    overflow-x: auto;
}

/* ── Marketplace & Listing Cards ─────────────────────────────── */
.marketplace-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    padding-top: 0.5rem;
}

.listing-card {
    background: var(--surface);
    border-radius: 1rem;
    border: 1px solid var(--border);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.listing-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(37, 99, 235, 0.2), 0 4px 12px rgba(37, 99, 235, 0.15);
}

.listing-card-header {
    height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
    color: var(--primary);
    position: relative;
}

.listing-card-header.type-plastic {
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
    color: #059669;
}

.listing-card-header.type-metal {
    background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
    color: #475569;
}

.listing-card-header.type-glass {
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
    color: #2563eb;
}

.listing-card-header.type-paper {
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
    color: #d97706;
}

.listing-card-header.type-organic {
    background: linear-gradient(135deg, #f0fdf4, #dcfce7);
    color: #16a34a;
}

.listing-card-header.type-ewaste {
    background: linear-gradient(135deg, #fdf4ff, #fae8ff);
    color: #9333ea;
}

.listing-card-body {
    padding: 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.listing-card-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.listing-card-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: 0.02em;
}

.listing-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.listing-card-meta span {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.listing-card-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: auto;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border);
}

.listing-card-actions .btn {
    flex: 1;
    text-align: center;
    font-size: 0.85rem;
    padding: 0.5rem;
}

/* ── Badge colours ──────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 0.2em 0.65em;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.badge-success {
    background: #dcfce7;
    color: #16a34a;
}

.badge-warning {
    background: #fef3c7;
    color: #b45309;
}

.badge-info {
    background: #dbeafe;
    color: #1d4ed8;
}

.badge-danger {
    background: #fee2e2;
    color: #dc2626;
}

.badge-secondary {
    background: #f1f5f9;
    color: #64748b;
}

.badge-purple {
    background: #f3e8ff;
    color: #7e22ce;
}

.badge-teal {
    background: #ccfbf1;
    color: #0f766e;
}

/* Filters row */
.filters {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.filters .form-control {
    max-width: 220px;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    text-align: left;
    padding: 1rem;
    background: var(--bg-color);
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 600;
    border-bottom: 1px solid var(--border);
}

.table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.95rem;
}

.table tr:last-child td {
    border-bottom: none;
}

/* Form Elements */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.form-control {
    width: 100%;
    padding: 0.625rem 1rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border);
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-control[readonly] {
    background: var(--bg-color);
    cursor: not-allowed;
}

/* Buttons */
.btn {
    padding: 0.625rem 1.25rem;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    border: 1px solid transparent;
}

.btn:disabled,
.btn[disabled] {
    opacity: 0.8;
    cursor: not-allowed;
}

.btn[style*="width: 100%"],
.btn-block {
    display: flex;
    width: 100%;
    justify-content: center;
}

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

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-outline {
    background: transparent;
    border-color: var(--border);
    color: var(--text-main);
}

.btn-outline:hover {
    background: var(--bg-color);
    border-color: var(--text-muted);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.875rem;
}

.btn-block {
    display: flex;
    width: 100%;
    justify-content: center;
}

.btn.loading {
    opacity: 0.8;
    cursor: not-allowed;
}

/* Badges */
.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-success {
    background: var(--success-bg);
    color: var(--success);
}

.badge-warning {
    background: var(--warning-bg);
    color: var(--warning);
}

.badge-danger {
    background: var(--danger-bg);
    color: var(--danger);
}

.badge-primary {
    background: var(--primary-light);
    color: var(--primary);
}

/* KPI Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.kpi-card {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
}

.kpi-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 600;
}

.kpi-value {
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 0.5rem;
}

/* Marketplace Grid */
.marketplace-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.listing-card {
    display: flex;
    flex-direction: column;
}

.listing-img {
    height: 120px;
    background: var(--bg-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--text-muted);
}

/* Kebab / Overflow menu */
.listing-menu-wrapper {
    position: relative;
    display: inline-block;
}

.btn-kebab {
    background: transparent;
    border: none;
    font-size: 1.05rem;
    color: #6b7280;
    /* muted grey */
    padding: 0.35rem;
    border-radius: 0.35rem;
    cursor: pointer;
    transition: color 0.2s ease, transform 0.12s ease;
}

.btn-kebab:hover,
.listing-card:hover .btn-kebab {
    color: #111827;
    /* darker on hover */
}

.listing-menu-wrapper.active .btn-kebab,
.listing-menu-wrapper:hover .btn-kebab,
.listing-menu-wrapper:focus-within .btn-kebab {
    outline: 2px solid rgba(37, 99, 235, 0.15);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.06);
}

.listing-menu-dropdown {
    position: absolute;
    top: 36px;
    right: 0;
    min-width: 200px;
    background: white;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    padding: 0.4rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: scale(0.96);
    transform-origin: top right;
    transition: opacity 180ms ease, transform 180ms ease;
    visibility: hidden;
    pointer-events: none;
}

.listing-menu-dropdown.open {
    opacity: 1;
    transform: scale(1);
    visibility: visible;
    pointer-events: auto;
}

.listing-menu-dropdown.hidden {
    /* keep hidden state for server-side or initial markup */
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.listing-menu-item {
    background: transparent;
    border: none;
    text-align: left;
    padding: 0.75rem 0.75rem;
    border-radius: 6px;
    font-size: 0.95rem;
    color: var(--text-main);
    display: flex;
    gap: 0.6rem;
    align-items: center;
    cursor: pointer;
}

.listing-menu-item:hover {
    background: #f3f4f6;
}

.listing-menu-item:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.06);
    background: #f3f4f6;
}

.listing-menu-delete {
    color: var(--danger);
}

.listing-menu-delete:hover {
    background: rgba(239, 68, 68, 0.06);
}

.listing-details {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.request-collection-btn {
    justify-content: center;
    text-align: center;
}

.request-collection-btn:disabled {
    pointer-events: none;
    opacity: 0.8;
}

.listing-title {
    font-weight: 700;
    font-size: 1.125rem;
    margin-bottom: 0.75rem;
}

.listing-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.listing-ref-time-row {
    width: 100%;
}

.listing-relative-time {
    text-align: right;
    color: #111827;
    font-weight: 400;
}

.listing-timestamp-row {
    width: 100%;
}

.listing-timestamp {
    color: var(--text-muted);
}

.page-filter-block {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.45rem;
    margin: 1.25rem 0 1.5rem;
}

.page-filter-label {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 600;
}

.page-filter-control {
    width: 200px;
    padding: 0.55rem 0.85rem;
}

.notifications-load-more-row {
    display: flex;
    justify-content: flex-start;
    margin-top: 1rem;
}

.notifications-load-more-row .btn {
    min-width: 160px;
}

/* Load more primary style */
#btn-load-more-notifs {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

/* Notifications Specific Styles */
.notif-table tbody tr {
    transition: background-color 0.2s ease;
}

.notif-table tr.unread td {
    background-color: rgba(37, 99, 235, 0.08);
}

/* Notification icon color rules */
.notif-type-read {
    color: var(--primary) !important;
}

.notif-type-unread {
    color: #111827 !important;
}

/* Per-row action buttons */
.btn-mark-read {
    background-color: white !important;
    color: var(--primary) !important;
    border: 1px solid rgba(37, 99, 235, 0.12) !important;
    box-shadow: none !important;
}

.btn-mark-read:hover {
    background-color: var(--primary) !important;
    color: white !important;
}

.notif-delete-btn {
    background-color: white;
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.08);
}

.notif-delete-btn:hover {
    background-color: rgba(239, 68, 68, 0.06);
    color: #b91c1c;
}

.notif-table td input[type="checkbox"] {
    cursor: pointer;
    width: 20px;
    height: 20px;
    accent-color: var(--primary);
}

.notif-table thead input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--primary);
}

.notif-table .select-col {
    display: none;
}

#notif-content-area.is-selecting .notif-table .select-col {
    display: table-cell;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Notifications Container */
.notifications-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Bulk Actions Toolbar */
.bulk-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--primary-light);
    border: 1px solid var(--primary);
    border-radius: 0.75rem;
    padding: 0.75rem 1.25rem;
    animation: slideDown 0.2s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.bulk-info {
    font-weight: 600;
    color: var(--primary);
    font-size: 0.95rem;
}

.bulk-buttons {
    display: flex;
    gap: 0.75rem;
}

.bulk-close-btn {
    background: #fff !important;
    color: #000 !important;
    border: 1px solid rgba(0, 0, 0, 0.12) !important;
    box-shadow: none !important;
    min-width: 40px;
    padding-inline: 0.75rem;
}

.bulk-close-btn:hover {
    background: rgba(0, 0, 0, 0.04) !important;
    color: #000 !important;
}

/* Notification Action Buttons */
.notif-action-btns {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.modal-content {
    background: var(--surface);
    border-radius: 1rem;
    width: 100%;
    max-width: 540px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
    padding: 0;
    transition: color 0.2s;
}

.close-btn:hover {
    color: var(--danger);
}

/* KPI Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.kpi-card {
    padding: 1.25rem;
    text-align: center;
}

.kpi-value {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
    margin-bottom: 0.5rem;
}

.kpi-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}


.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    background: var(--bg-color);
}

/* Post Waste Button Placement */
.view-actions {
    display: flex;
    gap: 0.75rem;
}

/* Dashboard Activity Feed */
.activity-list {
    list-style: none;
}

.activity-item {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 1rem;
}

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

/* Collections Table */
.collections-table-wrapper {
    overflow-x: auto;
}

/* Password Toggle */
.password-wrapper {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: var(--text-muted);
    font-size: 1rem;
    background: none;
    border: none;
    padding: 0;
    transition: color 0.2s;
}

.password-toggle:hover {
    color: var(--primary);
}

#toggle-password,
.pwd-toggle {
    color: var(--primary);
    transition: color 0.2s;
}

#toggle-password:hover,
.pwd-toggle:hover {
    color: var(--primary-hover);
}

#notifications-btn {
    color: var(--primary);
}

#notifications-btn:hover {
    color: var(--primary-hover);
}

#logout-btn {
    color: var(--primary);
}

#logout-btn:hover {
    color: #991b1b;
}

.btn-outline-danger {
    background: transparent;
    border: 1px solid var(--danger);
    color: var(--danger);
}

.btn-outline-danger:hover {
    background: #991b1b;
    color: white;
}

.logout-btn-styled {
    background: #e0f2fe;
    color: var(--primary);
}

.logout-btn-styled:hover {
    background: #bae6fd;
}

.deactivate-btn-styled {
    background: #fee2e2;
    color: var(--danger);
}

.deactivate-btn-styled:hover {
    background: #991b1b;
    color: white;
}

/* Notification Badge on Bell */
.notif-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--danger);
    color: white;
    font-size: 0.65rem;
    padding: 1px 5px;
    border-radius: 10px;
    font-weight: 700;
    min-width: 16px;
    text-align: center;
    pointer-events: none;
}

/* Profile Pic Upload Area */
.profile-pic-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

/* Responsive */
/* Settings Styles */
.large-avatar {
    width: 120px;
    height: 120px;
    font-size: 2.5rem;
}

.large-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.avatar-container {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto;
    border-radius: 50%;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.avatar-container:hover {
    transform: scale(1.05);
}

.avatar-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    opacity: 0;
    transition: opacity 0.3s;
    cursor: pointer;
}

.avatar-container.editable:hover .avatar-overlay {
    opacity: 1;
}

/* Auth Styles */
.auth-view {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    width: 100%;
}

.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    width: 100%;
    background: linear-gradient(135deg, #eff6ff 0%, #f1f5f9 50%, #e0f2fe 100%);
    padding: 1.5rem;
}

.auth-card {
    width: 100%;
    max-width: 460px;
    background: white;
    border-radius: 1.5rem;
    padding: 2.75rem;
    box-shadow: 0 20px 60px -10px rgba(37, 99, 235, 0.15), 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(226, 232, 240, 0.8);
}

.auth-logo {
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 1.75rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.auth-logo i {
    font-size: 1.5rem;
    color: var(--primary);
}

#auth-title {
    font-size: 1.625rem;
    font-weight: 700;
    margin-bottom: 0.35rem;
    color: var(--text-main);
}

#auth-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.75rem;
}

.auth-toggle {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.auth-toggle a {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
    margin-left: 0.25rem;
}

.auth-toggle a:hover {
    text-decoration: underline;
}

.error-message {
    background: var(--danger-bg);
    color: var(--danger);
    padding: 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    margin-bottom: 1rem;
    font-weight: 500;
    border-left: 3px solid var(--danger);
}

/* Avatar Edit Overlay Hover */
.avatar-container {
    transition: transform 0.2s ease;
}

.avatar-container.editable .avatar-overlay {
    opacity: 0.5 !important;
}

.avatar-container.editable:hover {
    transform: scale(1.05);
}

.avatar-container.editable:hover .avatar-overlay {
    background: rgba(0, 0, 0, 0.7) !important;
    opacity: 0.8 !important;
}

/* Card Edit Button */
.btn-edit-card {
    border: 1px solid black !important;
    color: black !important;
    background: transparent !important;
    transition: all 0.2s;
}

.btn-edit-card:hover {
    background: var(--primary) !important;
    color: white !important;
    border-color: var(--primary) !important;
}

/* Card Delete Button */
.btn-delete-card {
    border: none !important;
    background: #ad1536 !important;
    /* Brighter red */
    color: white !important;
    transition: background 0.2s;
}

.btn-delete-card:hover {
    background: #881337 !important;
    /* Dark red */
}

/* ── NEW MARKETPLACE STYLES ─────────────────────────────────── */

.marketplace-filters-section {
    margin-top: -0.3rem;
    margin-bottom: 1.15rem;
}

.search-filter-sort-container {
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
}

.marketplace-search-group {
    flex: 0 1 400px;
    max-width: 400px;
    min-width: 260px;
}

.marketplace-control-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 180px;
}

.marketplace-dropdowns-group {
    display: flex;
    gap: 1rem;
    margin-left: auto;
}

.sort-clear-group {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.marketplace-control-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
}

.marketplace-search-field {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 0.5rem 1rem;
    color: var(--text-muted);
    min-height: 44px;
}

.marketplace-search-field i {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.search-input {
    border: none;
    background: transparent;
    outline: none;
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--text-main);
    width: 100%;
    padding: 0;
    min-width: 0;
    max-width: none;
}

.search-input::placeholder {
    color: var(--text-muted);
}

.filter-select,
.sort-select {
    min-width: 180px;
}

.clear-all-btn {
    border-radius: 0.75rem;
    padding: 0.55rem 0.85rem;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
}

.clear-all-btn:hover {
    border-color: var(--text-muted);
    color: var(--text-main);
}

.marketplace-info {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin: 1.5rem 0 1rem 0;
    padding: 0;
}

.marketplace-info-emphasis {
    color: #000;
    font-weight: 700;
}

.marketplace-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 2rem;
    padding: 1.5rem 0;
    flex-wrap: wrap;
}

.pagination-btn {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-main);
    border-radius: 0.375rem;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
    min-width: 36px;
    text-align: center;
    font-size: 0.875rem;
}

.pagination-btn:hover:not(:disabled) {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.pagination-btn.page-num {
    min-width: 32px;
    padding: 0.5rem 0.6rem;
}

/* ── REFERENCE NUMBER BADGE ─────────────────────────────────── */

.ref-number-badge {
    display: inline-block;
    background: var(--primary);
    color: white;
    padding: 0.25rem 0.625rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.listing-relative-time {
    font-size: 0.76rem;
    font-weight: 600;
    color: #000;
    white-space: nowrap;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.listing-meta-time {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--text-muted);
}

.listing-meta-time i {
    color: var(--text-muted);
}

/* ── MODAL WASTE CONTENT STYLING ─────────────────────────────── */

.modal-waste-content {
    max-width: 450px !important;
}

/* Modal Form Group Spacing */
.modal-body .form-group {
    margin-bottom: 1.5rem;
}

.modal-body .form-group:last-child {
    margin-bottom: 1rem;
}

/* ── RESPONSIVENESS SYSTEM ─────────────────────────────────── */

/* Desktop & Large Screens Defaults */
.hamburger-btn,
.mobile-logo {
    display: none;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 95;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Receipt Modal Styles */
.receipt-modal-body {
    padding: 2rem;
}

.receipt-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}

.receipt-waste-section {
    grid-column: span 4;
    background: #f8fafc;
    padding: 1.5rem;
    border-radius: 1rem;
    border: 1px solid #e2e8f0;
    margin-bottom: 0.5rem;
}

.receipt-waste-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}

.receipt-info-box {
    background: white;
    padding: 1rem;
    border-radius: 0 0.5rem 0.5rem 0;
    box-shadow: var(--shadow-sm);
}

.recycler-box {
    border-left: 4px solid var(--primary);
}

.customer-box {
    border-left: 4px solid #3b82f6;
}

.collector-box {
    border-left: 4px solid #10b981;
}

.status-box {
    border-left: 4px solid #f59e0b;
}

.receipt-modal-footer {
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* TV & Ultra-wide screens */
@media (min-width: 1440px) {
    .content-area {
        max-width: 1600px;
        margin: 0 auto;
    }
}

/* Tablet & Mobile Breakpoints (<= 1024px) */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: var(--shadow-lg);
    }

    .sidebar.active {
        transform: translateX(0);
    }

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

    .topbar {
        justify-content: space-between;
        padding: 0 1rem;
    }

    .hamburger-btn {
        display: flex;
        background: transparent;
        border: none;
        font-size: 1.5rem;
        color: var(--text-main);
        cursor: pointer;
        padding: 0.5rem;
        border-radius: 0.5rem;
    }

    .mobile-logo {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        font-weight: 700;
        font-size: 1.1rem;
        color: var(--text-main);
    }

    .mobile-logo i {
        color: var(--primary);
        font-size: 1.25rem;
    }

    .search-bar {
        display: none !important;
        /* Hide global search on small screens to save space */
    }

    .marketplace-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    #report-charts-container {
        grid-template-columns: 1fr !important;
        gap: 1rem;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .view-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .view-actions .btn {
        flex: 1;
    }

    .marketplace-search-group {
        flex: 1 1 100%;
        max-width: none;
    }

    .marketplace-dropdowns-group {
        width: 100%;
        margin-left: 0;
        flex-direction: column;
        gap: 0.75rem;
    }

    .search-input,
    .filter-select,
    .sort-select {
        width: 100%;
        max-width: 100%;
    }
}

/* Normal Mobile (<= 768px) */
@media (max-width: 768px) {
    .content-area {
        padding: 1rem;
    }

    .kpi-grid {
        grid-template-columns: 1fr;
    }

    .marketplace-filters-section .search-filter-sort-container {
        flex-direction: column;
        align-items: stretch;
    }

    .marketplace-dropdowns-group {
        flex-direction: column;
        margin-left: 0;
    }

    .marketplace-control-group {
        width: 100%;
    }

    .marketplace-search-group {
        max-width: none;
    }

    .user-info {
        display: none;
        /* Hide name/role on small phones to save space */
    }

    .topbar-actions {
        gap: 0.5rem;
    }

    .modal-content {
        max-width: 95%;
        margin: 1rem;
    }

    .auth-card {
        padding: 1.5rem;
        border-radius: 1rem;
    }

    .auth-logo {
        font-size: 1.5rem;
    }

    /* Table adjustments */
    .table th,
    .table td {
        padding: 0.75rem 0.5rem;
        font-size: 0.85rem;
    }

    .notif-table th:nth-child(4),
    .notif-table td:nth-child(4) {
        display: none;
        /* Hide date column on mobile */
    }

    .marketplace-grid {
        grid-template-columns: 1fr;
    }

    /* Receipt Modal Responsive */
    .receipt-modal-body {
        padding: 1rem;
    }

    .receipt-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .receipt-waste-section {
        grid-column: span 1;
        padding: 1rem;
    }

    .receipt-waste-grid {
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }

    .receipt-modal-footer {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
        padding: 1rem;
    }

    .receipt-modal-footer p {
        text-align: center;
    }

    .receipt-modal-footer div {
        flex-direction: column;
    }
}

/* Small Mobile (<= 425px) */
@media (max-width: 425px) {
    .receipt-waste-grid {
        grid-template-columns: 1fr;
    }

    .topbar-actions {
        gap: 0.25rem;
    }

    .icon-btn {
        width: 35px;
        height: 35px;
    }

    .avatar {
        width: 2rem;
        height: 2rem;
    }

    .page-header h2 {
        font-size: 1.35rem;
    }

    .btn {
        padding: 0.5rem 0.85rem;
        font-size: 0.825rem;
    }

    /* Prevent wrapping of important action buttons */
    #settings-logout-btn,
    #btn-edit-profile,
    #btn-edit-pickup,
    #btn-edit-delivery {
        white-space: nowrap;
        font-size: 0.75rem !important;
        padding: 0.4rem 0.6rem;
    }

    /* Scaling for waste card on small devices */
    .listing-card-body {
        padding: 0.75rem;
    }

    .ref-number-badge {
        font-size: 0.65rem;
        padding: 0.2rem 0.4rem;
    }

    .listing-relative-time {
        font-size: 0.65rem !important;
    }

    .listing-timestamp {
        font-size: 0.75rem !important;
    }

    .badge {
        font-size: 0.6rem !important;
        padding: 0.2rem 0.5rem;
    }

    .listing-title {
        font-size: 0.95rem !important;
    }
}

/* Medium Mobile (<= 375px) */
@media (max-width: 375px) {
    .btn {
        font-size: 0.85rem;
    }

    .card-header h3 {
        font-size: 1rem;
    }
}

/* Fix for Auth View Vertical Overflow */
.auth-container {
    padding: 1rem;
    min-height: 100vh;
    height: auto;
    overflow-y: auto;
}

.auth-card {
    margin-top: auto;
    margin-bottom: auto;
}

/* Modal Responsiveness */
.modal-body {
    max-height: 70vh;
    overflow-y: auto;
}

.modal-content {
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

/* Notification wrapping */
.notif-table td {
    word-break: break-word;
}

/* Receipt Modal Specific Fixes */
#receipt-modal .receipt-content {
    padding: 1rem;
}

/* Ensure images don't break layout */
img {
    max-width: 100%;
    height: auto;
}

/* Table Scroll Wrapper */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

.table {
    min-width: 700px;
    /* Force scroll on mobile for better data readability */
}

.notif-table {
    min-width: 700px;
    /* Standardized with other tables */
}

/* Desktop Consistency Fixes */
@media (min-width: 1025px) {
    .content-area>* {
        max-width: 1200px !important;
        margin-left: auto !important;
        margin-right: auto !important;
        width: 100% !important;
    }

    /* Special case for marketplace grid which is a direct child sometimes */
    .marketplace-grid {
        display: grid !important;
    }
}

/* Avatar Styling Fixes */
.avatar,
.large-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: var(--primary);
    color: white;
}

.avatar img,
.large-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Form Responsiveness Fixes */
.profile-form-grid,
.settings-grid-layout {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

@media (max-width: 375px) {

    .profile-form-grid,
    .settings-grid-layout {
        grid-template-columns: 1fr;
    }
}

/* Charts responsive height */
@media (max-width: 768px) {
    .card-body canvas {
        max-height: 250px !important;
    }
}

/* Ensure buttons don't overflow */
.view-actions {
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Modal Scrollability */
.modal-body {
    max-height: 75vh;
    overflow-y: auto;
    padding: 1.5rem;
}

/* Fix for Sign Out button in settings */
.logout-btn-styled {
    background: var(--primary-light) !important;
    color: var(--primary) !important;
    border: 1px solid var(--primary-light) !important;
    font-weight: 700;
    white-space: nowrap;
}

.logout-btn-styled:hover {
    background: var(--primary) !important;
    color: white !important;
}

/* Ensure consistent spacing for titles in settings on mobile */
@media (max-width: 480px) {
    .card-header {
        flex-direction: row;
        align-items: center;
        gap: 0.5rem;
        padding: 0.75rem 1rem;
    }

    .card-header h3 {
        font-size: 0.95rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        flex: 1;
    }
}