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

:root {
    --primary: #0066FF;
    --primary-dark: #0052CC;
    --secondary: #6B7280;
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --bg-light: #F9FAFB;
    --bg-white: #FFFFFF;
    --text-dark: #111827;
    --text-medium: #4B5563;
    --text-light: #9CA3AF;
    --border: #E5E7EB;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --radius: 8px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', sans-serif;
    background: url('/static/bg.png') repeat;
    background-size: auto;
    color: var(--text-dark);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='22' viewBox='0 0 16 22'%3E%3Cpath fill='white' stroke='black' stroke-width='1' d='M0,0 L0,16 L4,12 L6,18 L8,17.5 L6,11.5 L10,11.5 Z'/%3E%3C/svg%3E"), auto;
}

/* MySpace-like diagonal tagline */
.myspace-tagline {
    position: fixed;
    top: 10%;
    left: 10%;
    transform: rotate(-15deg);
    transform-origin: left top;
    color: #7C3AED; /* purple */
    z-index: 1200;
    pointer-events: none;
    font-family: 'Comic Sans MS', 'Papyrus', 'Trebuchet MS', cursive, sans-serif;
    text-shadow: 1px 1px 0 #fff, 2px 2px 0 rgba(0,0,0,0.15);
}

/* Only show tagline when landing menu is visible */
.myspace-tagline { display: none; }
.menu-visible .myspace-tagline { display: block; }

.myspace-tagline div {
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    line-height: 1.1;
}

@media (max-width: 768px) {
    .myspace-tagline {
        top: 8%;
        left: 8%;
        transform: rotate(-12deg);
    }
    .myspace-tagline div { font-size: 1rem; }
}

/* Main Menu */
.main-menu {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-bottom: 60px;
    z-index: 1000;
    background: url('/static/bg.png') repeat;
    background-size: auto;
}

.main-menu.hidden {
    pointer-events: none;
    z-index: -1;
}

.menu-options {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    align-items: center;
}

.menu-option {
    background: white;
    border: 2px solid #0055CC;
    border-bottom: 3px solid #003399;
    border-right: 3px solid #003399;
    color: #000;
    font-size: 2.5rem;
    font-weight: 600;
    text-transform: lowercase;
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='24' viewBox='0 0 20 24'%3E%3Cpath fill='white' stroke='black' stroke-width='1.5' d='M2,2 L2,18 L8,12 L10,20 L13,19 L11,11 L18,11 Z'/%3E%3C/svg%3E"), pointer;
    padding: 1rem 3rem;
    font-family: 'Trebuchet MS', 'Lucida Grande', Arial, sans-serif;
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    transition: all 0.1s;
}

.menu-option:hover {
    background: #E5F3FF;
    border-top: 2px solid #0066FF;
    border-left: 2px solid #0066FF;
}

.menu-option:active {
    border-top: 3px solid #003399;
    border-left: 3px solid #003399;
    border-bottom: 2px solid #0055CC;
    border-right: 2px solid #0055CC;
    transform: translateY(1px);
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Main */
.main {
    flex: 1;
    padding-top: 2rem;
    padding-bottom: 60px;
    position: relative;
    z-index: 100;
}

.section {
    padding: 2rem 0;
    position: relative;
    z-index: 100;
}

/* Upload Section */
.upload-container {
    max-width: 600px;
    margin: 0 auto;
    position: relative;
    z-index: 100;
}

.upload-box {
    background: white;
    border: 2px solid #0055CC;
    border-bottom: 3px solid #003399;
    border-right: 3px solid #003399;
    border-radius: 0;
    padding: 3rem;
    text-align: center;
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='24' viewBox='0 0 20 24'%3E%3Cpath fill='white' stroke='black' stroke-width='1.5' d='M2,2 L2,18 L8,12 L10,20 L13,19 L11,11 L18,11 Z'/%3E%3C/svg%3E"), pointer;
    transition: all 0.1s;
    position: relative;
    box-shadow: 3px 3px 6px rgba(0, 0, 0, 0.3);
    z-index: 100;
}

.upload-box:hover {
    background: #E5F3FF;
    border-color: #0066FF;
}

.upload-box.dragover {
    background: #CCE5FF;
    border-color: #0066FF;
}

.upload-icon {
    width: 80px;
    height: 80px;
    margin-bottom: 1rem;
}

.folder-icon {
    filter: drop-shadow(2px 2px 3px rgba(0, 0, 0, 0.3));
}

.upload-content h3 {
    font-size: 1.25rem;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.upload-content p {
    color: var(--text-light);
}

.preview-container {
    position: relative;
}

.preview-container img {
    max-width: 100%;
    max-height: 400px;
    border-radius: var(--radius);
}

.btn-remove {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-remove:hover {
    background: rgba(0, 0, 0, 0.9);
}

/* Form */
.form-group {
    margin: 1.5rem 0;
    position: relative;
    z-index: 100;
}

.form-group label {
    display: block;
    font-weight: 500;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px inset #9CA3AF;
    border-radius: 0;
    font-family: 'Trebuchet MS', Arial, sans-serif;
    font-size: 1rem;
    resize: vertical;
    background: white;
    position: relative;
    z-index: 10;
}

.form-group textarea:focus {
    outline: 2px solid #0066FF;
    outline-offset: 2px;
    border-color: #0055CC;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    gap: 0.5rem;
    width: 100%;
    position: relative;
    z-index: 100;
}

.btn-primary {
    background: linear-gradient(180deg, #5BA3FF 0%, #0066FF 100%);
    color: white;
    border: 2px solid #0055CC;
    border-bottom: 3px solid #003399;
    border-right: 3px solid #003399;
    border-radius: 3px;
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    font-family: 'Trebuchet MS', 'Lucida Grande', Arial, sans-serif;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='24' viewBox='0 0 20 24'%3E%3Cpath fill='white' stroke='black' stroke-width='1.5' d='M2,2 L2,18 L8,12 L10,20 L13,19 L11,11 L18,11 Z'/%3E%3C/svg%3E"), pointer;
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(180deg, #6BB3FF 0%, #0077FF 100%);
    transform: translateY(0);
}

.btn-primary:active:not(:disabled) {
    border-top: 3px solid #003399;
    border-left: 3px solid #003399;
    border-bottom: 2px solid #0055CC;
    border-right: 2px solid #0055CC;
    transform: translateY(1px);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* Progress Bar */
.progress-container {
    margin-top: 1.5rem;
    padding: 1.5rem;
    background: white;
    border: 2px solid #0055CC;
    border-radius: 0;
    box-shadow: 3px 3px 6px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 100;
}

.progress-bar {
    width: 100%;
    height: 22px;
    background: #EAEAEA;
    border: 2px inset #9CA3AF; /* WinXP inset */
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.progress-fill {
    height: 100%;
    background: repeating-linear-gradient(
        90deg,
        #55A1FF 0px,
        #55A1FF 12px,
        #86BEFF 12px,
        #86BEFF 24px
    ); /* WinXP blue candy stripes */
    transition: width 0.3s ease;
    box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.6);
    position: relative;
}

/* Fax-style Report */
.fax-report {
    background: #FFFFFF;
    border: 2px solid #000;
    padding: 1rem;
    font-family: 'Courier New', Courier, monospace; /* monospaced */
    color: #000;
    box-shadow: 0 0 0 3px #000 inset; /* heavy border feel */
    filter: contrast(1.2) grayscale(0.2);
    white-space: pre-wrap;
    margin-bottom: 1rem;
}

/* Retro Tabs */
.fax-tabs {
    display: flex;
    gap: 0.5rem;
    margin: 0.5rem 0 0.75rem 0;
}

.fax-tab {
    background: linear-gradient(180deg, #F6F6F6 0%, #D9D9D9 100%);
    border: 2px solid #888;
    border-bottom: 2px solid #555;
    border-right-color: #555;
    color: #111;
    padding: 0.25rem 0.75rem;
    font-family: 'Trebuchet MS', 'Lucida Grande', Arial, sans-serif;
    font-weight: 700;
    text-transform: lowercase;
    box-shadow: 1px 1px 0 #fff inset, -1px -1px 0 #bbb inset, 1px 1px 2px rgba(0,0,0,0.2);
    cursor: pointer;
}

.fax-tab.active {
    background: linear-gradient(180deg, #FFFFFF 0%, #EDEDED 100%);
    border-color: #0055CC;
    border-bottom-color: #003399;
    color: #000;
}
.fax-ascii-gallery {
    background: #FFFFFF;
    border: 2px solid #000;
    padding: 1rem;
    font-family: 'Courier New', Courier, monospace;
    color: #000;
    box-shadow: 0 0 0 3px #000 inset;
    filter: contrast(1.2) grayscale(0.2);
    margin-bottom: 1rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}

.fax-ascii-item {
    position: relative;
    border: 2px solid #000;
    background: #fff;
    box-shadow: 0 0 0 3px #000 inset;
    overflow: hidden;
}

.fax-ascii-pre {
    margin: 0;
    padding: 0.5rem;
    font-family: 'Courier New', Courier, monospace;
    font-size: 10px;
    line-height: 10px;
    color: #000;
    white-space: pre;
    min-height: 140px;
}

.fax-ascii-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.15s ease-in-out;
}

.fax-ascii-item:hover .fax-ascii-image {
    opacity: 1;
}

.fax-report .fax-header {
    border-bottom: 2px dashed #000;
    padding-bottom: 0.5rem;
    margin-bottom: 0.5rem;
}

.fax-report .fax-line {
    margin: 0.2rem 0;
}

.fax-report .fax-meta {
    color: #111;
}

/* Hide modern cards when fax mode is shown */
.fax-mode .card { display: none; }
.fax-mode #authenticityCard { display: none; }

.progress-text {
    text-align: center;
    color: var(--text-medium);
    font-size: 0.875rem;
    font-weight: 500;
    margin: 0;
}

/* Cards */
.card {
    background: white;
    border: 2px solid #0055CC;
    border-bottom: 3px solid #003399;
    border-right: 3px solid #003399;
    border-radius: 0;
    box-shadow: 3px 3px 6px rgba(0, 0, 0, 0.3);
    margin-bottom: 1.5rem;
    overflow: hidden;
    position: relative;
    z-index: 100;
}

.card-header {
    padding: 1rem 1.5rem;
    background: linear-gradient(180deg, #5BA3FF 0%, #0066FF 100%);
    border-bottom: 2px solid #003399;
}

.card-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
    font-family: 'Trebuchet MS', 'Lucida Grande', Arial, sans-serif;
}

.card-body {
    padding: 1.5rem;
}

/* Grid */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.info-block label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-medium);
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.info-block p {
    color: var(--text-dark);
    font-size: 1rem;
}

/* Authenticity */
.authenticity-text {
    padding: 1rem;
    background: #FFFACD;
    border: 2px solid #FFD700;
    border-left: 4px solid #FFA500;
    border-radius: 0;
}

/* Prices */
.price-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.price-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: #F0F7FF;
    border: 1px solid #B8D4FF;
    border-radius: 0;
}

.price-info {
    flex: 1;
}

.price-title {
    font-weight: 500;
    color: var(--text-dark);
    margin-bottom: 0.25rem;
}

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

.price-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--success);
}

/* Similar Items Grid */
.similar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
}

.similar-item {
    position: relative;
    aspect-ratio: 1;
    border: 2px solid #0055CC;
    border-radius: 0;
    overflow: hidden;
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='24' viewBox='0 0 20 24'%3E%3Cpath fill='white' stroke='black' stroke-width='1.5' d='M2,2 L2,18 L8,12 L10,20 L13,19 L11,11 L18,11 Z'/%3E%3C/svg%3E"), pointer;
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.similar-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.similar-item:hover img {
    transform: scale(1.05);
}

/* Catalog */
.catalog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.catalog-item {
    background: white;
    border: 2px solid #0055CC;
    border-bottom: 3px solid #003399;
    border-right: 3px solid #003399;
    border-radius: 0;
    overflow: hidden;
    box-shadow: 3px 3px 6px rgba(0, 0, 0, 0.3);
    transition: all 0.1s;
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='24' viewBox='0 0 20 24'%3E%3Cpath fill='white' stroke='black' stroke-width='1.5' d='M2,2 L2,18 L8,12 L10,20 L13,19 L11,11 L18,11 Z'/%3E%3C/svg%3E"), pointer;
}

.catalog-item:hover {
    transform: translateY(-2px);
    box-shadow: 4px 4px 8px rgba(0, 0, 0, 0.4);
}

.catalog-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.catalog-info {
    padding: 1rem;
}

.catalog-title {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.catalog-meta {
    font-size: 0.875rem;
    color: var(--text-medium);
    margin-bottom: 0.25rem;
}

.catalog-price {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--success);
    margin-top: 0.5rem;
}

/* Catalog ASCII grid (browse) */
.catalog-ascii-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}

/* Fax modal */
#faxModal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2500;
}

#faxModalContent {
    background: #fff;
    border: 2px solid #000;
    box-shadow: 0 0 0 3px #000 inset;
    max-width: 900px;
    width: 90%;
    max-height: 90vh;
    overflow: auto;
    padding: 1rem;
    font-family: 'Courier New', Courier, monospace;
}

.catalog-ascii-item {
    position: relative;
    border: 2px solid #000;
    background: #fff;
    box-shadow: 0 0 0 3px #000 inset;
    overflow: hidden;
}

.catalog-ascii-pre {
    margin: 0;
    padding: 0.5rem;
    font-family: 'Courier New', Courier, monospace;
    font-size: 10px;
    line-height: 10px;
    color: #000;
    white-space: pre;
    min-height: 160px;
}
/* .ascii-cell no longer used in text mode */

.catalog-ascii-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.15s ease-in-out;
}

.catalog-ascii-item:hover .catalog-ascii-image {
    opacity: 1;
}

/* Footer */
.footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.5rem 1rem;
    text-align: center;
    background: rgba(255, 255, 255, 0.9);
    border-top: 2px solid #0055CC;
    box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.2);
    z-index: 2000;
}

.footer p {
    margin: 0;
    color: #333;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: 'Trebuchet MS', 'Lucida Grande', Arial, sans-serif;
}

/* Back Button */
.back-button {
    position: fixed;
    top: 1rem;
    left: 1rem;
    width: 32px;
    height: 24px;
    background: linear-gradient(180deg, #E8E8E8 0%, #B8B8B8 100%);
    border: 1px solid #888;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='24' viewBox='0 0 20 24'%3E%3Cpath fill='white' stroke='black' stroke-width='1.5' d='M2,2 L2,18 L8,12 L10,20 L13,19 L11,11 L18,11 Z'/%3E%3C/svg%3E"), pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    transition: all 0.1s;
    z-index: 600;
    padding: 0;
}

.back-button:hover {
    background: linear-gradient(180deg, #F0F0F0 0%, #C8C8C8 100%);
}

.back-button:active {
    background: linear-gradient(180deg, #A8A8A8 0%, #D8D8D8 100%);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3);
}

.back-button svg {
    color: #333;
}

/* Utility */
.hidden {
    display: none !important;
}

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

    .upload-box {
        padding: 2rem 1rem;
    }

    .menu-option {
        font-size: 2rem;
    }
}
