/* Auction System Custom Styles */

:root {
    --primary-color: #2563eb;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;
    --dark-color: #1e293b;
    --light-color: #f8fafc;
}

body {
    font-family: 'Trebuchet MS', Trebuchet, 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #1e293b;
    background: #ffffff;
}

/* Navbar */
.navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
}

/* Item Cards */
.item-card {
    transition: all 0.3s ease;
    cursor: pointer;
    border: 1px solid #e2e8f0;
}

.item-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.item-card img {
    border-radius: 0.375rem 0.375rem 0 0;
}

/* Countdown Timer */
.countdown {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--danger-color);
}

.countdown.warning {
    color: var(--warning-color);
}

.countdown.info {
    color: var(--info-color);
}

/* Status Badges */
.badge-status {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Admin Sidebar */
.admin-sidebar {
    background-color: var(--dark-color);
    min-height: 100vh;
    padding: 1.5rem;
}

.admin-sidebar .nav-link {
    color: rgba(255, 255, 255, 0.8);
    padding: 0.75rem 1rem;
    border-radius: 0.375rem;
    margin-bottom: 0.5rem;
    transition: all 0.2s;
}

.admin-sidebar .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
}

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

/* Forms */
.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.25);
}

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

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

.btn-primary:hover {
    background-color: #1d4ed8;
    border-color: #1d4ed8;
    transform: translateY(-1px);
}

/* Skeleton Loading */
.skeleton {
    animation: skeleton-loading 1s linear infinite alternate;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
}

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

.skeleton-text {
    height: 1rem;
    margin-bottom: 0.5rem;
    border-radius: 0.25rem;
}

.skeleton-title {
    height: 1.5rem;
    width: 60%;
    margin-bottom: 1rem;
    border-radius: 0.25rem;
}

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

.alert-success {
    background-color: #d1fae5;
    color: #065f46;
}

.alert-danger {
    background-color: #fee2e2;
    color: #991b1b;
}

.alert-warning {
    background-color: #fef3c7;
    color: #92400e;
}

.alert-info {
    background-color: #dbeafe;
    color: #1e40af;
}

/* Cards */
.card {
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.card-header {
    background-color: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    font-weight: 600;
}

/* Tables */
.table {
    color: #1e293b;
}

.table thead th {
    background-color: #f8fafc;
    color: #475569;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #e2e8f0;
}

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

/* Pagination */
.pagination {
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.pagination .page-link {
    color: var(--primary-color);
    border: 1px solid #e2e8f0;
}

.pagination .page-link:hover {
    background-color: #f8fafc;
}

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

/* Ensure pagination stays usable on small screens */
@media (max-width: 576px) {
    .pagination {
        flex-wrap: nowrap;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }
    .pagination .page-item {
        flex: 0 0 auto;
    }
}

/* Carousel */
.carousel-item img {
    height: 400px;
    object-fit: cover;
    border-radius: 0.5rem;
}

/* Responsive */
@media (max-width: 768px) {
    .item-card:hover {
        transform: none;
    }
    
    .carousel-item img {
        height: 250px;
    }
}

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

/* Toast Notifications */
.toast {
    border-radius: 0.5rem;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

/* File Upload */
.form-control[type="file"] {
    padding: 0.5rem;
}

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

.shadow-sm {
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.shadow {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.shadow-lg {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* ======= UI Enhancements (appended) ======= */
html { scroll-behavior: smooth; }

body { background: #ffffff; }

.item-card { border-radius: 0.75rem; }
.item-card img { border-radius: 0.75rem 0.75rem 0 0; }

.badge-status { border-radius: 999px; letter-spacing: 0.6px; font-weight: 700; font-size: 0.75rem; }

.btn { font-weight: 600; border-radius: 0.5rem; transition: transform .2s ease, box-shadow .2s ease; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 6px 14px rgba(0,0,0,0.08); }
.btn-primary { box-shadow: 0 6px 14px rgba(37, 99, 235, 0.25); }

.form-control, .form-select { border-radius: 0.5rem; }
.form-control:focus, .form-select:focus { outline: none; transform: scale(1.01); box-shadow: 0 0 0 0.25rem rgba(37,99,235,.2); }

.card { border-radius: 0.75rem; box-shadow: 0 2px 10px rgba(0,0,0,0.06); }
.card-header { font-weight: 700; }

.pagination .page-link { border-radius: 0.5rem; }

/* Hover elevation */
.elevate-on-hover { transition: transform .25s ease, box-shadow .25s ease; }
.elevate-on-hover:hover { transform: translateY(-4px); box-shadow: 0 12px 22px rgba(0,0,0,0.12); }

/* Subtle fade-in */
.fade-in { animation: fadeIn .35s ease both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* Custom scrollbars */
*::-webkit-scrollbar { height: 10px; width: 10px; }
*::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 999px; }
*::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
*::-webkit-scrollbar-track { background: transparent; }

/* Motion reduction */
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* Dark mode */
@media (prefers-color-scheme: dark) {
  body { color: #e5e7eb; background: linear-gradient(180deg, #0b1020 0%, #0a0f1a 100%); }
  .card, .item-card { background: #0f172a; border-color: #1f2937; box-shadow: 0 4px 18px rgba(0,0,0,0.35); }
  .card-header { background: #111827; border-bottom-color: #1f2937; }
  .table { color: #e5e7eb; }
  .table thead th { background: #0b1222; color: #a7b1c2; border-bottom-color: #1f2937; }
  .pagination .page-link { border-color: #1f2937; }
  .alert { box-shadow: 0 8px 24px rgba(0,0,0,0.3); }
}

/* ========== PERFORMANCE & LOADING OPTIMIZATIONS ========== */

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    backdrop-filter: blur(2px);
}

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

.loading-overlay .spinner-border {
    width: 3rem;
    height: 3rem;
    border-width: 0.3rem;
}

/* Skeleton Loaders - Enhanced */
.skeleton-loader {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-pulse 1.5s ease-in-out infinite;
    border-radius: 0.5rem;
}

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

.skeleton-card {
    height: 300px;
    margin-bottom: 1.5rem;
}

.skeleton-image {
    height: 200px;
    width: 100%;
    margin-bottom: 1rem;
}

.skeleton-title {
    height: 1.25rem;
    width: 70%;
    margin-bottom: 0.75rem;
}

.skeleton-text {
    height: 0.875rem;
    width: 100%;
    margin-bottom: 0.5rem;
}

.skeleton-text:last-child {
    width: 60%;
}

/* Smooth Page Transitions */
.page-transition {
    animation: fadeInUp 0.4s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Stagger Animation for Items */
.item-card {
    animation: fadeInUp 0.4s ease-out backwards;
}

.item-card:nth-child(1) { animation-delay: 0.05s; }
.item-card:nth-child(2) { animation-delay: 0.1s; }
.item-card:nth-child(3) { animation-delay: 0.15s; }
.item-card:nth-child(4) { animation-delay: 0.2s; }
.item-card:nth-child(5) { animation-delay: 0.25s; }
.item-card:nth-child(6) { animation-delay: 0.3s; }

/* Lazy Loading Image Placeholder */
img[loading="lazy"] {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-pulse 1.5s ease-in-out infinite;
    min-height: 150px;
}

img[loading="lazy"].loaded {
    animation: none;
    background: transparent;
}

/* Smooth Link Transitions */
a {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -2px;
    left: 50%;
    background-color: var(--primary-color);
    transition: width 0.3s ease, left 0.3s ease;
}

a:hover::after {
    width: 100%;
    left: 0;
}

/* Button Loading State */
.btn-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 1rem;
    height: 1rem;
    top: 50%;
    left: 50%;
    margin-left: -0.5rem;
    margin-top: -0.5rem;
    border: 2px solid currentColor;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

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

/* Content Fade In */
.content-fade-in {
    animation: contentFadeIn 0.5s ease-out;
}

@keyframes contentFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Optimized Transitions */
* {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Will-change for performance */
.item-card,
.card,
.btn,
.nav-link {
    will-change: transform;
}

.item-card:hover,
.card:hover,
.btn:hover {
    will-change: auto;
}

/* Reduced motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    .item-card,
    .content-fade-in,
    .page-transition,
    a::after {
        animation: none !important;
        transition: none !important;
    }
    
    html {
        scroll-behavior: auto;
    }
}

/* Performance: Contain layout */
.item-card,
.card {
    contain: layout style paint;
}

/* Optimize image rendering */
img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

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

.spinner-md {
    width: 2rem;
    height: 2rem;
    border-width: 0.2rem;
}

.spinner-lg {
    width: 3rem;
    height: 3rem;
    border-width: 0.3rem;
}

/* Progress Bar */
.progress-bar-smooth {
    transition: width 0.6s ease;
}

/* Intersection Observer for lazy loading */
.lazy-image {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lazy-image.loaded {
    opacity: 1;
}

