/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    background: #fff;
    color: #000;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 40px;
}

/* Header */
header {
    padding: 40px 0 30px;
    border-bottom: 1px solid #e0e0e0;
}

.site-title {
    font-size: 28px;
    font-weight: 400;
    margin-bottom: 5px;
    letter-spacing: -0.5px;
}

.site-subtitle {
    font-size: 11px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.nav-buttons {
    display: flex;
    gap: 12px;
    margin-top: 25px;
}

.nav-button {
    padding: 10px 24px;
    font-size: 11px;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 1px;
    background: transparent;
    border: 1px solid #000;
    cursor: pointer;
    transition: all 0.2s;
}

.nav-button:hover {
    background: #f0f0f0;
}

/* Upload Section */
.upload-section {
    margin: 80px auto;
    max-width: 600px;
    height: 400px;
    border: 2px dashed #ccc;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    background: #fafafa;
}

.upload-section:hover {
    border-color: #000;
    background: #f5f5f5;
}

.upload-section.dragover {
    border-color: #000;
    background: #f0f0f0;
}

.upload-icon {
    font-size: 72px;
    color: #ccc;
    margin-bottom: 20px;
    font-weight: 200;
}

.upload-text {
    font-size: 16px;
    font-weight: 400;
    margin-bottom: 8px;
}

.upload-subtext {
    font-size: 11px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.file-input {
    display: none;
}

/* Loading */
.loading-section {
    margin: 120px auto;
    text-align: center;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f0f0f0;
    border-top: 3px solid #000;
    border-radius: 50%;
    margin: 0 auto 30px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    font-size: 13px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Critique View */
.critique-section {
    max-width: 1400px;
    margin: 60px auto;
    padding: 0 40px;
}

.artwork-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 80px;
    margin-bottom: 60px;
}

.artwork-image-wrapper {
    position: sticky;
    top: 40px;
    height: fit-content;
    display: flex;
    align-items: center;
    justify-content: center;
}

.artwork-image {
    max-width: 100%;
    max-height: 80vh;
    width: auto;
    height: auto;
    display: block;
    border: 1px solid #e0e0e0;
    object-fit: contain;
}

.artwork-metadata {
    padding: 20px 0;
}

.artwork-title {
    font-size: 24px;
    font-weight: 400;
    margin-bottom: 8px;
    line-height: 1.3;
}

.artist-name {
    font-size: 14px;
    color: #666;
    margin-bottom: 20px;
}

.artwork-details {
    font-size: 13px;
    color: #000;
    margin-bottom: 30px;
    padding-bottom: 30px;
    border-bottom: 1px solid #e0e0e0;
    line-height: 1.8;
}

.label-section {
    margin-bottom: 40px;
}

.label-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 15px;
    color: #666;
}

.label-text {
    font-size: 12px;
    line-height: 1.8;
    font-style: italic;
    color: #333;
}

.critique-content {
    max-width: 900px;
    margin: 0 auto;
}

.section-heading {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 15px;
    margin-top: 40px;
    color: #666;
}

.critique-text {
    font-size: 13px;
    line-height: 1.9;
    margin-bottom: 40px;
    color: #000;
}

.critique-text p {
    margin-bottom: 20px;
}

.exhibition-list {
    list-style: none;
    font-size: 12px;
    line-height: 1.8;
    color: #333;
    margin-bottom: 40px;
}

.exhibition-item {
    margin-bottom: 8px;
}

.provenance-chain {
    font-size: 12px;
    line-height: 1.8;
    color: #333;
    margin-bottom: 8px;
}

.qr-section {
    margin-top: 60px;
    padding-top: 40px;
    border-top: 1px solid #e0e0e0;
    text-align: center;
}

.qr-code {
    width: 100px;
    height: 100px;
    margin: 0 auto 15px;
    border: 2px solid #000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 400;
    letter-spacing: 2px;
}

.qr-caption {
    font-size: 11px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.new-analysis-section {
    max-width: 900px;
    margin: 60px auto 0;
    padding-top: 40px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 12px;
}

.new-analysis-button {
    flex: 1;
    padding: 15px 40px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    border: 1px solid #000;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.new-analysis-button:hover {
    background: #000;
    color: #fff;
}

.new-analysis-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f0f0f0;
}

/* Archive View */
.archive-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 60px 0 40px;
    border-bottom: 1px solid #e0e0e0;
}

.archive-title {
    font-size: 18px;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.archive-controls {
    display: flex;
    gap: 12px;
}

.archive-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 40px;
    padding: 60px 0;
}

.archive-item {
    position: relative;
    cursor: pointer;
    transition: transform 0.2s;
}

.archive-item:hover {
    transform: translateY(-4px);
}

.archive-item-checkbox {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 24px;
    height: 24px;
    cursor: pointer;
    z-index: 10;
    appearance: none;
    border: 2px solid #fff;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 3px;
    transition: all 0.2s;
}

.archive-item-checkbox:hover {
    background: rgba(0, 0, 0, 0.7);
    transform: scale(1.1);
}

.archive-item-checkbox:checked {
    background: #000;
    border-color: #fff;
}

.archive-item-checkbox:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 16px;
    font-weight: bold;
}

.archive-item img {
    width: 100%;
    height: 350px;
    object-fit: cover;
    display: block;
    border: 1px solid #e0e0e0;
}

.archive-item-info {
    padding: 15px 0;
}

.archive-item-title {
    font-size: 14px;
    font-weight: 400;
    margin-bottom: 5px;
}

.archive-item-artist {
    font-size: 12px;
    color: #666;
    margin-bottom: 3px;
}

.archive-item-year {
    font-size: 12px;
    color: #999;
}

/* Auction Setup */
.auction-setup {
    max-width: 900px;
    margin: 60px auto;
}

.auction-title {
    font-size: 18px;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.selected-works {
    display: flex;
    flex-direction: column;
    gap: 30px;
    margin-bottom: 40px;
}

.selected-work-item {
    display: flex;
    gap: 30px;
    padding: 30px;
    border: 1px solid #e0e0e0;
    background: #fafafa;
}

.selected-work-item img {
    width: 150px;
    height: 150px;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid #e0e0e0;
}

.selected-work-info {
    flex: 1;
}

.starting-price-input {
    margin-top: 20px;
}

.starting-price-input label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
    color: #666;
}

.starting-price-input input {
    width: 200px;
    padding: 12px;
    font-size: 16px;
    border: 1px solid #ccc;
    background: #fff;
}

.start-auction-button {
    padding: 15px 40px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    background: #000;
    color: #fff;
    border: 1px solid #000;
    cursor: pointer;
    transition: all 0.2s;
}

.start-auction-button:hover {
    background: #333;
}

/* Live Auction Interface */
.auction-live {
    max-width: 1200px;
    margin: 60px auto;
    padding: 0 40px;
}

.auction-live-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    margin-top: 40px;
}

.auction-artwork-display {
    position: sticky;
    top: 40px;
    height: fit-content;
}

.auction-artwork-display img {
    width: 100%;
    max-height: 60vh;
    object-fit: contain;
    border: 1px solid #e0e0e0;
    margin-bottom: 20px;
}

.current-bid {
    font-size: 48px;
    font-weight: 400;
    margin: 30px 0;
}

.end-auction-button {
    padding: 20px 40px;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1px;
    background: #000;
    color: #fff;
    border: none;
    cursor: pointer;
    width: 100%;
    transition: all 0.2s;
}

.end-auction-button:hover {
    background: #333;
}

.bid-history {
    max-height: 70vh;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    padding: 20px;
    background: #fafafa;
}

.bid-history-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 20px;
    color: #666;
}

.bid-item {
    padding: 12px 0;
    border-bottom: 1px solid #e0e0e0;
}

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

.bid-amount {
    font-size: 18px;
    font-weight: 400;
    margin-bottom: 4px;
}

.bid-time {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
}

@keyframes bidEnter {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Auction Summary */
.auction-summary-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.auction-summary-content {
    background: white;
    padding: 40px;
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.auction-summary-title {
    font-size: 24px;
    font-weight: 400;
    margin-bottom: 40px;
    text-align: center;
}

.auction-summary-details {
    margin-bottom: 30px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border: 1px solid #e0e0e0;
    background: #fafafa;
    margin-bottom: 15px;
}

.summary-label {
    font-size: 11px;
    color: #666;
    margin-top: 5px;
}

.summary-value {
    font-size: 20px;
    font-weight: 400;
}

.final-price {
    font-size: 32px;
    font-weight: 400;
    text-align: center;
    padding: 40px;
    border: 2px solid #000;
    margin: 30px 0;
}

/* Art Market Modal */
.art-market-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.art-market-content {
    background: white;
    padding: 40px;
    max-width: 1000px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

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

.art-market-item {
    border: 1px solid #e0e0e0;
    padding: 20px;
}

.art-market-image {
    width: 100%;
    height: 150px;
    margin-bottom: 15px;
    overflow: hidden;
    background: #f0f0f0;
}

.art-market-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.purchase-button {
    width: 100%;
    padding: 10px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    background: #000;
    color: #fff;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.purchase-button:hover {
    background: #333;
}

.purchase-button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Purchased Art Actions Modal */
.purchased-art-actions {
    background: white;
    padding: 0;
    max-width: 700px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    display: flex;
    gap: 0;
}

.purchased-art-preview {
    width: 300px;
    height: 400px;
    flex-shrink: 0;
    overflow: hidden;
    background: #f0f0f0;
}

.purchased-art-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.purchased-art-details {
    flex: 1;
    padding: 40px;
}

/* Responsive */
@media (max-width: 1500px) {
    .gallery-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 30px;
    }
    
    .art-market-grid {
        grid-template-columns: 1fr;
    }
    
    .purchased-art-actions {
        flex-direction: column;
        max-width: 90%;
    }
    
    .purchased-art-preview {
        width: 100%;
        height: 250px;
    }
    
    .purchased-art-details {
        padding: 30px 20px;
    }
}

@media (max-width: 968px) {
    .gallery-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 25px;
    }
    
    .perspective-room {
        padding: 40px;
    }
    
    .artwork-container {
        grid-template-columns: 1fr;
        gap: 40px;
    }
    
    .artwork-image-wrapper {
        position: static;
    }
    
    .archive-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 30px;
    }
    
    .auction-live-grid {
        grid-template-columns: 1fr;
        gap: 40px;
    }
    
    .auction-artwork-display {
        position: static;
    }
}

@media (max-width: 600px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    
    .perspective-gallery {
        padding: 40px 20px;
    }
    
    .perspective-room {
        padding: 30px 20px;
    }
    
    .container {
        padding: 0 20px;
    }
    
    .critique-section {
        padding: 0 20px;
    }
    
    .archive-grid {
        grid-template-columns: 1fr;
    }
    
    .new-analysis-section {
        flex-direction: column;
    }
    
    .new-analysis-button {
        width: 100%;
    }
}

/* IMMERSIVE GALLERY STYLES */

.immersive-gallery-container {
    position: relative;
    width: 100%;
    height: 85vh; /* Takes up most of the screen */
    background: #000;
    overflow: hidden;
    margin-top: -40px; /* Pull up closer to header if needed */
}

.gallery-room-view {
    position: relative;
    width: 100%;
    height: 100%;
    perspective: 2000px; /* Essential for the 3D transforms */
}

.room-background {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
    opacity: 0.9; /* Slight dim to make art pop */
}

/* The invisible container for each artwork on the wall */
.gallery-slot-container {
    position: absolute;
    /* Styles like top, left, width, height come from inline styles in JS */
    box-shadow: 0 10px 30px rgba(0,0,0,0.5); /* Shadow behind the frame */
    background: #e0e0e0; /* Placeholder color */
    transition: transform 0.5s ease;
}

.gallery-slot-container:hover {
    z-index: 100;
    filter: brightness(1.1);
}

/* The actual content (Image or Empty State) */
.gallery-wall-content {
    width: 100%;
    height: 100%;
    position: relative;
    cursor: pointer;
    background: #fff;
    border: 4px solid #fff; /* White matte/frame */
}

.gallery-wall-content img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.gallery-wall-content.selected {
    border-color: #000;
    box-shadow: 0 0 0 4px #ffff00; /* Highlight selection */
}

/* Empty State (+) */
.gallery-wall-empty {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.15);
    border: 2px dashed rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.2s;
}

.gallery-wall-empty:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: #fff;
}

.gallery-wall-empty .plus-icon {
    font-size: 32px;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

/* Selection Checkbox for Auction */
.gallery-checkbox {
    position: absolute;
    top: -15px;
    right: -15px;
    width: 30px;
    height: 30px;
    background: #fff;
    border: 2px solid #000;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    z-index: 10;
    opacity: 0;
    transition: opacity 0.2s;
}

.gallery-wall-content:hover .gallery-checkbox,
.gallery-checkbox.checked {
    opacity: 1;
}

/* Hover Label */
.gallery-wall-label {
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    color: #fff;
    padding: 4px 10px;
    font-size: 10px;
    text-transform: uppercase;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
}

.gallery-wall-content:hover .gallery-wall-label {
    opacity: 1;
}

/* Navigation UI */
.gallery-nav-overlay {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 30px;
    z-index: 50;
    background: rgba(255, 255, 255, 0.9);
    padding: 15px 30px;
    border-radius: 40px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
}

.gallery-nav-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #000;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.gallery-nav-btn:hover {
    background: #f0f0f0;
}

.room-indicator {
    text-align: center;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: bold;
}

.dots {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-top: 5px;
    font-size: 20px;
    line-height: 10px;
    color: #ccc;
}

.dots span.active {
    color: #000;
}