/* Modern 2025 Base Styles */
:root {
    --primary-color: #4361ee;
    --secondary-color: #7209b7;
    --accent-color: #f72585;
    --success-color: #4cc9f0;
    --danger-color: #ef233c;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --text-color: #2b2d42;
    --bg-gradient: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    --card-bg: rgba(255, 255, 255, 0.85);
    --glass-bg: rgba(255, 255, 255, 0.25);
    --glass-border: rgba(255, 255, 255, 0.18);
    --shadow-sm: 0 2px 12px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.16);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background: var(--bg-gradient);
    min-height: 100vh;
}

/* Smooth scrolling and focus styles */
html {
    scroll-behavior: smooth;
}

:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* Modern Link Styles */
a {
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
    position: relative;
}

a:hover {
    color: var(--accent-color);
}

a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent-color);
    transition: width 0.3s ease;
}

a:hover::after {
    width: 100%;
}

/* Modern Header with Glass Morphism */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 5%;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-sm);
}

.logo {
    font-size: 1.8rem;
    font-weight: 800;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    letter-spacing: -0.5px;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 24px;
}

.nav-links a {
    font-weight: 600;
    font-size: 1.05rem;
}

.user-menu {
    position: relative;
}

.user-menu button {
    background: none;
    border: none;
    font-weight: 600;
    color: var(--primary-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
}

.user-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    min-width: 180px;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    z-index: 100;
    animation: fadeIn 0.3s ease forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.user-dropdown a {
    display: block;
    padding: 12px 16px;
    transition: all 0.2s ease;
}

.user-dropdown a:hover {
    background: rgba(0, 0, 0, 0.05);
    padding-left: 20px;
}

/* Main Content Styles */
main {
    padding: 2rem 5%;
    min-height: calc(100vh - 120px);
}

/* Modern Hero Section */
.hero {
    text-align: center;
    padding: 5rem 2rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: 16px;
    margin-bottom: 3rem;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: rotate 20s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.hero h2 {
    font-size: 3rem;
    margin-bottom: 1rem;
    position: relative;
    font-weight: 800;
    line-height: 1.2;
}

.hero p {
    font-size: 1.2rem;
    max-width: 700px;
    margin: 0 auto 2rem;
    opacity: 0.9;
    position: relative;
}

/* Featured Items Section */
.featured-items h2 {
    margin-bottom: 2rem;
    text-align: center;
    font-size: 2rem;
    font-weight: 700;
    position: relative;
    display: inline-block;
    margin-left: auto;
    margin-right: auto;
}

.featured-items h2::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 4px;
    background: var(--accent-color);
    border-radius: 2px;
}

/* Modern Item Cards - Updated for centering */
.items-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
    justify-items: center; /* Centers the cards horizontally */
}

.item-card {
    width: 100%;
    max-width: 350px; /* Prevents cards from getting too wide */
    background: var(--card-bg);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    border: 1px solid var(--glass-border);
}

.item-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
}

.item-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
}

.item-card img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.item-card:hover img {
    transform: scale(1.03);
}

.item-card-content {
    padding: 1.5rem;
}

.item-card h3 {
    margin-bottom: 0.75rem;
    font-size: 1.25rem;
    font-weight: 700;
}

.item-card p {
    color: #666;
    margin-bottom: 1rem;
    font-size: 0.95rem;
    line-height: 1.5;
}

.item-price {
    font-weight: 800;
    color: var(--primary-color);
    margin: 1rem 0;
    font-size: 1.25rem;
}

/* Modern Button Styles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    position: relative;
    overflow: hidden;
    font-size: 1rem;
}

.btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(rgba(255,255,255,0.1), rgba(255,255,255,0));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.btn:hover::after {
    opacity: 1;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    box-shadow: 0 4px 15px rgba(67, 97, 238, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(67, 97, 238, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, #6c757d, #495057);
    color: white;
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.3);
}

.btn-modern {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(247, 37, 133, 0.3);
}

.btn-modern:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(247, 37, 133, 0.4);
}

/* Modern Form Styles */
.auth-form {
    max-width: 500px;
    margin: 0 auto;
    background: var(--card-bg);
    padding: 2.5rem;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(8px);
    border: 1px solid var(--glass-border);
}

.auth-form h2 {
    text-align: center;
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-color);
}

.form-input {
    margin-bottom: 1.5rem;
    position: relative;
}

.form-input label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-color);
}

.form-input input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.8);
}

.form-input input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.2);
    outline: none;
}

/* Item Detail Styles */
.item-detail {
    max-width: 900px;
    margin: 0 auto;
    background: var(--card-bg);
    padding: 25px;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    backdrop-filter: blur(8px);
    border: 1px solid var(--glass-border);
}

.item-detail img {
    width: 100%;
    height: auto;
    border-radius: 12px;
    object-fit: cover;
    aspect-ratio: 1/1;
    box-shadow: var(--shadow-sm);
}

.item-info {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.item-info h1 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.item-info .price {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--primary-color);
}

/* Modern Search Bar */
.item-search {
    margin-bottom: 2rem;
    position: relative;
}

#search-bar {
    width: 100%;
    padding: 0.75rem 1.5rem 0.75rem 3rem;
    border: 1px solid #e0e0e0;
    border-radius: 50px;
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.8) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%236c757d' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z'/%3E%3C/svg%3E") no-repeat 1rem center;
    transition: all 0.3s ease;
}

#search-bar:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.2);
    outline: none;
}

/* Dashboard Styles */
.dashboard-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.dashboard-actions {
    margin-bottom: 2rem;
    display: flex;
    justify-content: flex-end;
}

.my-listings h2 {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    position: relative;
    padding-bottom: 0.5rem;
}

.my-listings h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 60px;
    height: 3px;
    background: var(--accent-color);
    border-radius: 3px;
}

.listings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    justify-items: center; /* Also center dashboard listings */
}

.listing-card {
    width: 100%;
    max-width: 350px;
    background: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--glass-border);
}

.listing-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.listing-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.listing-info {
    padding: 1.5rem;
}

.listing-info h3 {
    margin: 0 0 0.5rem;
    font-size: 1.25rem;
    font-weight: 700;
}

.listing-info .price {
    font-weight: 800;
    color: var(--primary-color);
    margin: 0.5rem 0;
    font-size: 1.25rem;
}

.listing-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
}

.btn-edit {
    background: linear-gradient(135deg, var(--success-color), #3a86ff);
    color: white;
}

.btn-edit:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(76, 201, 240, 0.3);
}

.btn-delete {
    background: linear-gradient(135deg, var(--danger-color), #d90429);
    color: white;
}

.btn-delete:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 35, 60, 0.3);
}

/* Modern Create Listing Form */
.create-listing-form {
    max-width: 800px;
    margin: 2rem auto;
    background: var(--card-bg);
    padding: 25px;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    position: relative;
    overflow: hidden;
}

.create-listing-form::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
}

.create-listing-form h1 {
    text-align: center;
    margin-bottom: 2rem;
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--primary-color);
    position: relative;
    padding-bottom: 1rem;
}

.create-listing-form h1::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background: var(--accent-color);
    border-radius: 2px;
}

.form-group {
    margin-bottom: 1.8rem;
    position: relative;
}

.form-group label {
    display: block;
    margin-bottom: 0.8rem;
    font-weight: 600;
    color: var(--text-color);
    font-size: 1.05rem;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 1rem 1.5rem;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.2);
    outline: none;
}

.form-group textarea {
    min-height: 150px;
    resize: vertical;
    line-height: 1.6;
}

/* File Upload Styling */
.file-upload-wrapper {
    position: relative;
    margin-bottom: 1.8rem;
}

.file-upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    border: 2px dashed rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.file-upload-label:hover {
    border-color: var(--primary-color);
    background: rgba(255, 255, 255, 0.9);
}

.file-upload-label i {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.file-upload-label p {
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.file-upload-label span {
    color: var(--secondary-color);
    font-size: 0.9rem;
}

.file-upload-input {
    position: absolute;
    left: 0;
    top: 0;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

/* Preview Images */
.image-preview-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.image-preview {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    height: 120px;
}

.image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.remove-image {
    position: absolute;
    top: 5px;
    right: 5px;
    background: var(--danger-color);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s ease;
}

.remove-image:hover {
    transform: scale(1.1);
}

/* Form Actions */
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

/* Price Input with Currency Symbol */
.price-input-container {
    position: relative;
}

.price-input-container::before {
    content: '$';
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-weight: 600;
    color: var(--text-color);
}

.price-input-container input {
    padding-left: 2.5rem !important;
}

/* Category Select Styling */
.form-group select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%236c757d' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 12px;
}

/* Error Message */
.error-message {
    color: var(--danger-color);
    margin-bottom: 1.5rem;
    padding: 1rem;
    background-color: rgba(239, 35, 60, 0.1);
    border-radius: 8px;
    border-left: 4px solid var(--danger-color);
}

/* Modern Footer */
footer {
    text-align: center;
    padding: 2rem;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--glass-border);
    margin-top: 3rem;
}

footer p {
    color: #666;
}

/* Responsive Styles */
@media (max-width: 1024px) {
    .item-detail {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .header {
        flex-direction: column;
        padding: 1rem;
        gap: 1rem;
    }

    .nav-links {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }

    .hero h2 {
        font-size: 2.2rem;
    }

    .hero p {
        font-size: 1rem;
    }

    .items-list, .listings-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }

    .create-listing-form {
        padding: 1.5rem;
        border-radius: 16px;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .form-actions .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    :root {
        font-size: 14px;
    }

    .hero {
        padding: 3rem 1rem;
    }

    .hero h2 {
        font-size: 1.8rem;
    }

    .items-list, .listings-grid {
        grid-template-columns: 1fr;
    }

    .auth-form, .form-container {
        padding: 1.5rem;
    }

    .listing-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .create-listing-form h1 {
        font-size: 1.8rem;
    }
    
    .form-group input,
    .form-group textarea,
    .form-group select {
        padding: 0.8rem 1rem;
    }
}

/* Micro-interactions and animations */
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.floating {
    animation: float 3s ease-in-out infinite;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(var(--primary-color), var(--secondary-color));
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-color);
}

.contact-btn {
  display: inline-block;
  margin-top: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  border-radius: 8px;
  background: var(--secondary-color);
  color: white;
  text-align: center;
  transition: background-color 0.3s ease;
}

.contact-btn:hover {
  background: var(--accent-color);
  color: white;
}
