/**
 * CardVault - Main Stylesheet
 */

/* ========================================
   CSS Reset & Base Styles
   ======================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary-color: #3498db;
    --primary-dark: #2980b9;
    --secondary-color: #2c3e50;
    --success-color: #27ae60;
    --error-color: #e74c3c;
    --warning-color: #f39c12;
    --text-color: #333;
    --text-light: #7f8c8d;
    --border-color: #ddd;
    --bg-light: #f9f9f9;
    --bg-dark: #2c3e50;
}

html {
    font-size: 16px;
    line-height: 1.6;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    color: var(--text-color);
    background-color: #fff;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--primary-color);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

img {
    max-width: 100%;
    height: auto;
}

/* ========================================
   Layout
   ======================================== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.site-main {
    flex: 1;
    padding: 30px 0;
}

/* ========================================
   Header
   ======================================== */
.site-header {
    background-color: var(--bg-dark);
    color: #fff;
    padding: 15px 0;
}

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

.logo a {
    font-size: 1.5rem;
    font-weight: bold;
    color: #fff;
    text-decoration: none;
}

.main-nav ul {
    display: flex;
    list-style: none;
    gap: 30px;
}

.main-nav a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
}

.main-nav a:hover {
    color: #fff;
}

.header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.user-menu {
    display: flex;
    gap: 10px;
    align-items: center;
}

.username {
    color: rgba(255, 255, 255, 0.8);
}

/* ========================================
   Buttons
   ======================================== */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    text-align: center;
    text-decoration: none;
    transition: background-color 0.2s;
}

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

.btn-primary:hover {
    background-color: var(--primary-dark);
    text-decoration: none;
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: #fff;
}

.btn-secondary:hover {
    background-color: #1a252f;
    text-decoration: none;
}

.btn-success {
    background-color: var(--success-color);
    color: #fff;
}

.btn-success:hover {
    background-color: #219a52;
    text-decoration: none;
}

.btn-admin {
    background-color: #9b59b6;
    color: #fff;
}

.btn-block {
    display: block;
    width: 100%;
}

/* ========================================
   Forms
   ======================================== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-checkbox input {
    width: auto;
}

.form-checkbox label {
    margin-bottom: 0;
}

.form-hint {
    font-size: 0.875rem;
    color: var(--text-light);
}

.form-error {
    color: var(--error-color);
    font-size: 0.875rem;
    margin-top: 5px;
}

/* ========================================
   Alerts
   ======================================== */
.alert {
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
}

.alert-warning {
    background-color: #fff3cd;
    color: #856404;
}

/* ========================================
   Auth Pages
   ======================================== */
.auth-container {
    display: flex;
    justify-content: center;
    padding: 40px 20px;
}

.auth-box {
    background: var(--bg-light);
    padding: 40px;
    border-radius: 8px;
    width: 100%;
    max-width: 450px;
}

.auth-box h1 {
    margin-bottom: 10px;
    text-align: center;
}

.auth-subtitle {
    text-align: center;
    color: var(--text-light);
    margin-bottom: 30px;
}

.auth-links {
    text-align: center;
    margin-top: 20px;
}

.auth-links p {
    margin: 10px 0;
}

/* ========================================
   Listings - Browse
   ======================================== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.page-header h1 {
    margin: 0;
}

.listings-layout {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 30px;
}

.listings-sidebar {
    background: var(--bg-light);
    padding: 20px;
    border-radius: 8px;
    height: fit-content;
}

.filter-section {
    margin-bottom: 30px;
}

.filter-section:last-child {
    margin-bottom: 0;
}

.filter-section h3 {
    margin-bottom: 15px;
    font-size: 1rem;
}

.category-list,
.condition-list {
    list-style: none;
}

.category-list li,
.condition-list li {
    margin-bottom: 8px;
}

.category-list a,
.condition-list a {
    color: var(--text-color);
    display: block;
    padding: 5px 10px;
    border-radius: 4px;
}

.category-list a:hover,
.condition-list a:hover {
    background-color: rgba(0, 0, 0, 0.05);
    text-decoration: none;
}

.category-list a.active,
.condition-list a.active {
    background-color: var(--primary-color);
    color: #fff;
}

.listings-toolbar {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    align-items: center;
}

.search-form {
    display: flex;
    gap: 10px;
    flex: 1;
}

.search-form input {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.clear-filters {
    font-size: 0.875rem;
}

.listings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.listing-card {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 0.2s;
}

.listing-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.listing-link {
    text-decoration: none;
    color: inherit;
}

.listing-image {
    position: relative;
    aspect-ratio: 1;
    background: var(--bg-light);
}

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

.listing-image .badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--success-color);
    color: #fff;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: bold;
}

.listing-info {
    padding: 15px;
}

.listing-title {
    font-size: 1rem;
    margin-bottom: 5px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.listing-condition {
    font-size: 0.875rem;
    color: var(--text-light);
    margin-bottom: 10px;
}

.listing-bid {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 5px;
}

.current-bid,
.starting-price {
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--primary-color);
}

.bid-count,
.starting-label {
    font-size: 0.875rem;
    color: var(--text-light);
}

.listing-time {
    font-size: 0.875rem;
    color: var(--text-light);
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 30px;
}

.page-info {
    color: var(--text-light);
}

/* ========================================
   Listing Detail
   ======================================== */
.listing-detail {
    max-width: 1000px;
    margin: 0 auto;
}

.listing-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-bottom: 40px;
}

.listing-images .main-image {
    background: var(--bg-light);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 15px;
}

.listing-images .main-image img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: contain;
}

.thumbnail-grid {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.thumbnail {
    width: 80px;
    height: 80px;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    overflow: hidden;
}

.thumbnail.active {
    border-color: var(--primary-color);
}

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

.listing-info-detail h1 {
    margin-bottom: 15px;
}

.listing-meta {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    color: var(--text-light);
}

.bid-section {
    background: var(--bg-light);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.current-bid-display,
.starting-bid-display {
    text-align: center;
    margin-bottom: 15px;
}

.current-bid-display .label,
.starting-bid-display .label {
    display: block;
    color: var(--text-light);
    font-size: 0.875rem;
}

.current-bid-display .amount,
.starting-bid-display .amount {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-color);
}

.minimum-bid {
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-light);
    margin-bottom: 15px;
}

.auction-timer {
    text-align: center;
    padding: 15px;
    background: var(--secondary-color);
    color: #fff;
    border-radius: 4px;
}

.auction-timer .time-label {
    display: block;
    font-size: 0.875rem;
    margin-bottom: 5px;
}

.auction-timer .time-value {
    font-size: 1.5rem;
    font-weight: bold;
}

.auction-ended {
    text-align: center;
    padding: 15px;
    background: var(--bg-light);
    border-radius: 4px;
    color: var(--text-light);
}

.sold-badge {
    display: inline-block;
    background: var(--success-color);
    color: #fff;
    padding: 5px 15px;
    border-radius: 4px;
    margin-left: 10px;
}

.bid-form,
.buynow-section {
    margin-top: 15px;
}

.divider-text {
    display: block;
    text-align: center;
    color: var(--text-light);
    margin: 15px 0;
}

.seller-info {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.seller-info h3 {
    margin-bottom: 10px;
}

.verified-badge {
    color: var(--success-color);
    font-size: 0.875rem;
}

.listing-description {
    margin-bottom: 40px;
}

.listing-description h2 {
    margin-bottom: 15px;
}

.description-content {
    line-height: 1.8;
}

.bid-history {
    margin-top: 40px;
}

.bid-history h2 {
    margin-bottom: 15px;
}

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

.bid-table th,
.bid-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.bid-table th {
    background: var(--bg-light);
    font-weight: 600;
}

/* ========================================
   Listing Create/Edit
   ======================================== */
.listing-form {
    max-width: 800px;
    margin: 0 auto;
    background: var(--bg-light);
    padding: 30px;
    border-radius: 8px;
}

.listing-form h1 {
    margin-bottom: 30px;
}

/* ========================================
   Footer
   ======================================== */
.site-footer {
    background: var(--bg-dark);
    color: rgba(255, 255, 255, 0.8);
    padding: 40px 0 20px;
    margin-top: auto;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}

.footer-section h4 {
    color: #fff;
    margin-bottom: 15px;
}

.footer-section ul {
    list-style: none;
}

.footer-section li {
    margin-bottom: 8px;
}

.footer-section a {
    color: rgba(255, 255, 255, 0.7);
}

.footer-section a:hover {
    color: #fff;
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.875rem;
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 15px;
    }
    
    .listings-layout {
        grid-template-columns: 1fr;
    }
    
    .listings-sidebar {
        order: 2;
    }
    
    .listing-detail-grid {
        grid-template-columns: 1fr;
    }
}
