/* ============================================
   EnergyXtra.com — Modern UI Stylesheet
   Inter font + refined color system + depth
   ============================================ */

/* --- Design Tokens --- */
:root {
    --ex-primary: #0f172a;
    --ex-primary-light: #1e293b;
    --ex-accent: #f59e0b;
    --ex-accent-hover: #d97706;
    --ex-accent-subtle: rgba(245, 158, 11, 0.1);
    --ex-success: #10b981;
    --ex-danger: #ef4444;
    --ex-info: #3b82f6;
    --ex-text: #1e293b;
    --ex-text-muted: #64748b;
    --ex-border: #e2e8f0;
    --ex-light-bg: #f8fafc;
    --ex-card-bg: #ffffff;
    --ex-card-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --ex-card-shadow-hover: 0 10px 25px rgba(0,0,0,0.08), 0 4px 10px rgba(0,0,0,0.04);
    --ex-radius: 12px;
    --ex-radius-sm: 8px;
    --ex-radius-lg: 16px;
    --ex-transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Global --- */
body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: var(--ex-text);
    background: var(--ex-light-bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

main {
    flex: 1;
}

a {
    transition: color var(--ex-transition);
}

/* --- Navbar --- */
.navbar {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    background: rgba(15, 23, 42, 0.95) !important;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    padding: 0.6rem 0;
}

.navbar-brand {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.navbar .form-control {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.1);
    color: #fff;
    border-radius: var(--ex-radius-sm);
    transition: all var(--ex-transition);
}

.navbar .form-control::placeholder {
    color: rgba(255,255,255,0.4);
}

.navbar .form-control:focus {
    background: rgba(255,255,255,0.12);
    border-color: var(--ex-accent);
    box-shadow: 0 0 0 3px var(--ex-accent-subtle);
}

.navbar .btn-warning {
    border-radius: 0 var(--ex-radius-sm) var(--ex-radius-sm) 0;
    font-weight: 600;
}

.navbar .dropdown-menu {
    border: 1px solid var(--ex-border);
    border-radius: var(--ex-radius-sm);
    box-shadow: 0 10px 40px rgba(0,0,0,0.12);
    padding: 0.5rem;
}

.navbar .dropdown-item {
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    transition: background var(--ex-transition);
}

.navbar .dropdown-item:hover {
    background: var(--ex-light-bg);
}

/* --- Hero Section --- */
.hero {
    background:
        radial-gradient(ellipse at 20% 80%, rgba(59, 130, 246, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(245, 158, 11, 0.1) 0%, transparent 50%),
        linear-gradient(160deg, #0f172a 0%, #1e293b 40%, #0f3460 100%);
    color: white;
    padding: 5rem 0 4.5rem;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(245, 158, 11, 0.06) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.hero h1 {
    font-size: 3.2rem;
    font-weight: 900;
    letter-spacing: -1.5px;
    line-height: 1.1;
}

.hero .lead {
    font-size: 1.15rem;
    opacity: 0.8;
    font-weight: 400;
    max-width: 540px;
    margin: 0 auto;
}

.hero .form-control {
    border: 2px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.07);
    color: #fff;
    padding: 0.85rem 1.25rem;
    font-size: 1.05rem;
    border-radius: var(--ex-radius) 0 0 var(--ex-radius);
    backdrop-filter: blur(4px);
}

.hero .form-control:focus {
    border-color: var(--ex-accent);
    background: rgba(255,255,255,0.1);
    box-shadow: 0 0 0 4px var(--ex-accent-subtle);
}

.hero .form-control::placeholder {
    color: rgba(255,255,255,0.45);
}

.hero .btn {
    padding: 0.85rem 1.75rem;
    font-size: 1.05rem;
    font-weight: 700;
    border-radius: 0 var(--ex-radius) var(--ex-radius) 0;
}

.hero .btn-outline-light {
    border-width: 2px;
    border-radius: var(--ex-radius);
    font-weight: 600;
    padding: 0.6rem 1.5rem;
    transition: all var(--ex-transition);
}

.hero .btn-outline-light:hover {
    background: rgba(255,255,255,0.12);
    transform: translateY(-1px);
}

/* --- Popular Search Badges --- */
.popular-searches .badge {
    font-weight: 500;
    font-size: 0.8rem;
    margin: 0.15rem;
    padding: 0.45em 0.9em;
    border-radius: 50px;
    background: rgba(255,255,255,0.08) !important;
    border: 1px solid rgba(255,255,255,0.12);
    transition: all var(--ex-transition);
}

.popular-searches .badge:hover {
    background: rgba(255,255,255,0.18) !important;
    border-color: rgba(255,255,255,0.25);
    transform: translateY(-1px);
}

/* --- Cards (shared base) --- */
.card {
    border: 1px solid var(--ex-border);
    border-radius: var(--ex-radius);
    background: var(--ex-card-bg);
}

/* --- Category Cards --- */
.category-card {
    transition: all var(--ex-transition);
    border: 1px solid var(--ex-border);
    box-shadow: var(--ex-card-shadow);
    text-decoration: none;
    color: inherit;
    border-radius: var(--ex-radius);
    position: relative;
    overflow: hidden;
}

.category-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--ex-accent);
    transform: scaleX(0);
    transition: transform var(--ex-transition);
}

.category-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--ex-card-shadow-hover);
    border-color: transparent;
    color: inherit;
}

.category-card:hover::after {
    transform: scaleX(1);
}

.category-card .bi {
    font-size: 2.5rem;
    color: var(--ex-accent);
    transition: transform var(--ex-transition);
}

.category-card:hover .bi {
    transform: scale(1.1);
}

.category-card h6 {
    font-weight: 700;
    font-size: 0.95rem;
}

/* --- Listing Cards --- */
.listing-card {
    border: 1px solid var(--ex-border);
    box-shadow: var(--ex-card-shadow);
    transition: all var(--ex-transition);
    overflow: hidden;
    border-radius: var(--ex-radius);
}

.listing-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--ex-card-shadow-hover);
    border-color: transparent;
}

.listing-card .card-img-top {
    height: 200px;
    object-fit: cover;
    background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
    transition: transform var(--ex-transition);
}

.listing-card:hover .card-img-top {
    transform: scale(1.03);
}

.listing-card .card-body {
    padding: 1rem 1.1rem;
}

.listing-card .price {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--ex-primary);
    letter-spacing: -0.3px;
}

.listing-card .card-title {
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 0.35rem;
}

.listing-card .meta {
    font-size: 0.82rem;
    color: var(--ex-text-muted);
}

/* --- Listing Detail Gallery --- */
.listing-gallery img {
    width: 100%;
    height: 420px;
    object-fit: contain;
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    border-radius: var(--ex-radius);
    border: 1px solid var(--ex-border);
}

.listing-gallery .thumbnail {
    width: 80px;
    height: 60px;
    object-fit: cover;
    border-radius: var(--ex-radius-sm);
    cursor: pointer;
    opacity: 0.5;
    border: 2px solid transparent;
    transition: all var(--ex-transition);
}

.listing-gallery .thumbnail:hover {
    opacity: 0.8;
}

.listing-gallery .thumbnail.active {
    opacity: 1;
    border-color: var(--ex-accent);
    box-shadow: 0 0 0 3px var(--ex-accent-subtle);
}

/* --- Stats Cards --- */
.stat-card {
    border: 1px solid var(--ex-border);
    box-shadow: var(--ex-card-shadow);
    border-left: 4px solid var(--ex-accent);
    border-radius: var(--ex-radius);
    transition: all var(--ex-transition);
}

.stat-card:hover {
    box-shadow: var(--ex-card-shadow-hover);
}

.stat-card .stat-number {
    font-size: 2rem;
    font-weight: 800;
    color: var(--ex-primary);
    letter-spacing: -1px;
}

/* --- Badges --- */
.badge {
    font-weight: 600;
    letter-spacing: 0.01em;
    border-radius: 6px;
}

.badge-condition {
    font-weight: 600;
    font-size: 0.75rem;
    padding: 0.35em 0.65em;
}

/* --- Buttons --- */
.btn {
    font-weight: 600;
    border-radius: var(--ex-radius-sm);
    transition: all var(--ex-transition);
}

.btn:active {
    transform: scale(0.97);
}

.btn-accent {
    background: linear-gradient(135deg, var(--ex-accent) 0%, #e8920a 100%);
    border: none;
    color: #000;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

.btn-accent:hover {
    background: linear-gradient(135deg, var(--ex-accent-hover) 0%, #c27f08 100%);
    color: #000;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(245, 158, 11, 0.4);
}

.btn-outline-dark {
    border-width: 2px;
}

.btn-warning {
    font-weight: 700;
}

/* --- Save/Favorite Button --- */
.btn-save {
    border: none;
    background: none;
    color: #94a3b8;
    font-size: 1.3rem;
    cursor: pointer;
    transition: all var(--ex-transition);
    padding: 0.25rem;
}

.btn-save:hover {
    color: #f87171;
    transform: scale(1.15);
}

.btn-save.saved {
    color: #ef4444;
}

.btn-save.saved:hover {
    transform: scale(1.15);
}

/* --- Filter Sidebar --- */
.filter-sidebar {
    background: var(--ex-card-bg);
    border: 1px solid var(--ex-border);
    border-radius: var(--ex-radius);
    padding: 1.25rem;
}

.filter-sidebar .form-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--ex-text);
    margin-bottom: 0.35rem;
}

.filter-sidebar .form-select,
.filter-sidebar .form-control {
    border-radius: var(--ex-radius-sm);
    border-color: var(--ex-border);
    transition: all var(--ex-transition);
}

.filter-sidebar .form-select:focus,
.filter-sidebar .form-control:focus {
    border-color: var(--ex-accent);
    box-shadow: 0 0 0 3px var(--ex-accent-subtle);
}

/* --- Quote Form --- */
.quote-card {
    border: 2px solid var(--ex-accent);
    border-radius: var(--ex-radius);
    background: linear-gradient(135deg, rgba(245,158,11,0.02) 0%, rgba(245,158,11,0.06) 100%);
}

/* --- Form Controls (global) --- */
.form-control,
.form-select {
    border-radius: var(--ex-radius-sm);
    border: 1.5px solid var(--ex-border);
    transition: all var(--ex-transition);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--ex-accent);
    box-shadow: 0 0 0 3px var(--ex-accent-subtle);
}

/* --- Tables --- */
.table {
    border-color: var(--ex-border);
}

.table th {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--ex-text-muted);
    border-bottom-width: 2px;
}

/* --- Admin Table --- */
.admin-table th {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ex-text-muted);
    border-top: none;
    white-space: nowrap;
    font-weight: 700;
}

.admin-table td {
    vertical-align: middle;
}

.admin-review-row {
    transition: all var(--ex-transition);
    border-radius: var(--ex-radius-sm);
}

.admin-review-row:hover {
    background: var(--ex-light-bg);
}

.admin-activity-list {
    max-height: 500px;
    overflow-y: auto;
}

.admin-activity-row {
    transition: background var(--ex-transition);
}

.admin-activity-row:hover {
    background: var(--ex-light-bg);
}

.admin-activity-row:last-child {
    border-bottom: none !important;
}

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

.empty-state .bi {
    font-size: 3.5rem;
    display: block;
    margin-bottom: 1rem;
    opacity: 0.4;
}

.empty-state h5 {
    font-weight: 700;
    color: var(--ex-text);
}

/* --- Photo Upload Preview --- */
.photo-preview {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

.photo-preview img {
    width: 100px;
    height: 80px;
    object-fit: cover;
    border-radius: var(--ex-radius-sm);
    border: 1px solid var(--ex-border);
}

/* --- Category Page Hero --- */
.category-hero {
    background:
        radial-gradient(ellipse at 30% 70%, rgba(59, 130, 246, 0.12) 0%, transparent 50%),
        linear-gradient(160deg, #0f172a 0%, #1e293b 40%, #0f3460 100%);
    color: white;
    padding: 3rem 0;
}

.category-hero .bi {
    font-size: 3rem;
    color: var(--ex-accent);
}

/* --- Alerts --- */
.alert {
    border-radius: var(--ex-radius-sm);
    border: none;
    font-size: 0.9rem;
}

/* --- Breadcrumb --- */
.breadcrumb {
    font-size: 0.85rem;
}

.breadcrumb a {
    color: var(--ex-info);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

/* --- Pagination --- */
.pagination .page-link {
    border-radius: var(--ex-radius-sm) !important;
    margin: 0 2px;
    border: 1px solid var(--ex-border);
    color: var(--ex-text);
    font-weight: 500;
    font-size: 0.9rem;
    transition: all var(--ex-transition);
}

.pagination .page-item.active .page-link {
    background: var(--ex-primary);
    border-color: var(--ex-primary);
}

.pagination .page-link:hover {
    background: var(--ex-light-bg);
    border-color: var(--ex-accent);
    color: var(--ex-accent);
}

/* --- Nav Pills (admin tabs) --- */
.nav-pills .nav-link {
    border-radius: var(--ex-radius-sm);
    font-weight: 600;
    font-size: 0.875rem;
    padding: 0.45rem 1rem;
    transition: all var(--ex-transition);
    color: var(--ex-text-muted);
}

.nav-pills .nav-link:hover {
    background: var(--ex-light-bg);
    color: var(--ex-text);
}

.nav-pills .nav-link.active {
    background: var(--ex-primary);
}

/* --- Cards with Auth Forms (login/register) --- */
.bg-light-custom {
    background: var(--ex-light-bg);
}

.card.shadow-sm {
    box-shadow: var(--ex-card-shadow);
    border: 1px solid var(--ex-border);
    border-radius: var(--ex-radius-lg);
}

/* --- Footer --- */
footer {
    background: var(--ex-primary) !important;
    border-top: 1px solid rgba(255,255,255,0.05);
}

footer h5, footer h6 {
    letter-spacing: -0.3px;
}

footer a.text-muted {
    transition: color var(--ex-transition);
}

footer a.text-muted:hover {
    color: var(--ex-accent) !important;
}

/* --- Section Spacing --- */
section h2 {
    font-weight: 800;
    letter-spacing: -0.5px;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .hero {
        padding: 3.5rem 0 3rem;
    }

    .hero h1 {
        font-size: 2.2rem;
    }

    .listing-card .card-img-top {
        height: 170px;
    }

    .listing-gallery img {
        height: 260px;
    }

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

    .filter-sidebar {
        margin-bottom: 1rem;
    }
}

@media (max-width: 576px) {
    .hero h1 {
        font-size: 1.8rem;
    }

    .hero .lead {
        font-size: 1rem;
    }

    .popular-searches .badge {
        font-size: 0.75rem;
    }
}

/* --- Misc Utilities --- */
.text-accent {
    color: var(--ex-accent) !important;
}

.truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.border-2 {
    border-width: 2px !important;
}

/* --- Smooth Scroll --- */
html {
    scroll-behavior: smooth;
}

/* --- Selection Color --- */
::selection {
    background: var(--ex-accent);
    color: #000;
}

/* --- Focus Visible (accessibility + style) --- */
:focus-visible {
    outline: 2px solid var(--ex-accent);
    outline-offset: 2px;
}

/* --- Skeleton loading placeholder for no-image cards --- */
.listing-card .card-img-top.bg-light {
    background: linear-gradient(135deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%) !important;
    background-size: 200% 100% !important;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
