/* TKN8R - Main Stylesheet (token prep UI) */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Norse-ish black & gold theme (keeps liquid-glass UI) */
    --primary-bg: #07060a;
    --secondary-bg: #0f0d14;
    --accent-bg: rgba(212, 175, 55, 0.08);
    --primary-text: #f2eee6;
    --accent-color: #d4af37; /* gold */
    --accent-hover: #f3d77a;
    --border-color: rgba(212, 175, 55, 0.25);
    --success-color: #4caf50;
    --error-color: #f44336;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: radial-gradient(1200px circle at 30% 10%, rgba(212, 175, 55, 0.10), transparent 55%),
                radial-gradient(900px circle at 70% 0%, rgba(212, 175, 55, 0.06), transparent 50%),
                linear-gradient(135deg, var(--primary-bg) 0%, var(--secondary-bg) 100%);
    color: var(--primary-text);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.container {
    width: 100%;
    max-width: 800px;
    background: rgba(10, 10, 14, 0.70);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(212, 175, 55, 0.18);
}

header,
.app-header {
    text-align: center;
    margin-bottom: 40px;
}

.app-logo {
    display: block;
    width: min(320px, 70%);
    height: auto;
    margin: 0 auto 10px;
    filter: drop-shadow(0 10px 26px rgba(0, 0, 0, 0.55));
}

.subtitle {
    color: rgba(242, 238, 230, 0.72);
    font-size: 1rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Upload Area */
.upload-area {
    border: 3px dashed var(--border-color);
    border-radius: 15px;
    padding: 60px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(15, 52, 96, 0.3);
}

.upload-area:hover {
    border-color: var(--accent-color);
    background: rgba(83, 52, 131, 0.2);
    transform: translateY(-2px);
}

.upload-area.dragover {
    border-color: var(--accent-color);
    background: rgba(83, 52, 131, 0.3);
    transform: scale(1.02);
}

.upload-content {
    pointer-events: none;
}

.upload-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    color: var(--accent-color);
}

.upload-text {
    font-size: 1.2rem;
    margin-bottom: 8px;
    font-weight: 500;
}

.upload-hint {
    font-size: 0.9rem;
    color: rgba(234, 234, 234, 0.6);
}

/* Processing Area */
.processing-area {
    text-align: center;
    padding: 60px 20px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(83, 52, 131, 0.3);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

.processing-area p {
    font-size: 1.1rem;
    color: rgba(234, 234, 234, 0.8);
}

/* Preview Area */
.preview-area {
    animation: fadeIn 0.5s ease;
}

.preview-area.dragover {
    background: rgba(83, 52, 131, 0.2);
    border: 2px dashed var(--accent-color);
    border-radius: 15px;
}

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


.preview-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: 30px;
    padding: 20px;
    background: rgba(15, 52, 96, 0.3);
    border-radius: 15px;
    position: relative;
}

.border-customization {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 15px;
    flex-wrap: nowrap;
}

.preview-canvas-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
}

.swatch-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    min-width: 80px;
}

.swatch-label {
    font-size: 0.85rem;
    color: rgba(234, 234, 234, 0.7);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.swatch-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    max-width: 80px;
}

.color-swatch,
.texture-swatch {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.color-swatch {
    /* Background color is set inline via JavaScript */
}

.color-swatch:hover {
    transform: scale(1.1);
    border-color: var(--accent-color);
    box-shadow: 0 0 8px rgba(83, 52, 131, 0.5);
}

.color-swatch.active {
    border-color: var(--accent-color);
    border-width: 3px;
    box-shadow: 0 0 12px rgba(83, 52, 131, 0.7);
}

.texture-swatch {
    background: var(--texture-pattern, #ccc);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    text-transform: uppercase;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.texture-swatch:hover {
    transform: scale(1.1);
    border-color: var(--accent-color);
    box-shadow: 0 0 8px rgba(83, 52, 131, 0.5);
}

.texture-swatch.active {
    border-color: var(--accent-color);
    border-width: 3px;
    box-shadow: 0 0 12px rgba(83, 52, 131, 0.7);
}

.reset-swatch-btn {
    padding: 4px 12px;
    font-size: 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: rgba(234, 234, 234, 0.8);
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.reset-swatch-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: var(--accent-color);
}

.drag-hint {
    margin-top: 10px;
    font-size: 0.85rem;
    color: rgba(234, 234, 234, 0.5);
    font-style: italic;
    text-align: center;
}

.preview-canvas-wrapper {
    position: relative;
}

#previewCanvas {
    max-width: 100%;
    height: auto;
    border-radius: 50%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    touch-action: none; /* Prevent touch scrolling on mobile */
}

.canvas-hint {
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.7rem;
    color: rgba(234, 234, 234, 0.6);
    white-space: nowrap;
    pointer-events: none;
    font-style: italic;
}

/* Adjustment Controls */
.adjustment-controls {
    margin-bottom: 30px;
    padding: 20px;
    background: rgba(15, 52, 96, 0.2);
    border-radius: 10px;
}

.slider-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-weight: 500;
    color: var(--primary-text);
}

.slider-label span:first-child {
    font-size: 1rem;
}

#zoomValue {
    font-size: 1.1rem;
    color: var(--accent-color);
    font-weight: 600;
    min-width: 60px;
    text-align: right;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 8px;
}

.slider-label-min,
.slider-label-max {
    font-size: 0.85rem;
    color: rgba(234, 234, 234, 0.6);
    min-width: 70px;
    text-align: center;
}

.slider-label-min {
    text-align: left;
}

.slider-label-max {
    text-align: right;
}

.slider {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.1);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-color) 0%, var(--accent-hover) 100%);
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 3px 8px rgba(83, 52, 131, 0.5);
}

.slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-color) 0%, var(--accent-hover) 100%);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
}

.slider::-moz-range-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 3px 8px rgba(83, 52, 131, 0.5);
}

.slider-hint {
    font-size: 0.85rem;
    color: rgba(234, 234, 234, 0.5);
    text-align: center;
    margin-top: 5px;
    font-style: italic;
}

.controls {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.btn {
    padding: 12px 30px;
    font-size: 1rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-color) 0%, var(--accent-hover) 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(83, 52, 131, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--primary-text);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

/* Error Message */
.error-message {
    background: rgba(244, 67, 54, 0.2);
    border: 1px solid var(--error-color);
    border-radius: 10px;
    padding: 15px 20px;
    margin-top: 20px;
    color: var(--error-color);
    text-align: center;
}

/* Footer */
footer {
    text-align: center;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    color: rgba(242, 238, 230, 0.60);
    font-size: 0.9rem;
}

.token-count {
    margin-top: 6px;
    font-size: 0.8rem;
    color: rgba(212, 175, 55, 0.75);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* Texture Patterns */
.texture-swatch[data-texture="solid"] {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.texture-swatch[data-texture="gradient"] {
    background: radial-gradient(circle, #667eea 0%, #764ba2 100%);
}

.texture-swatch[data-texture="metallic"] {
    background: linear-gradient(135deg, #c0c0c0 0%, #808080 50%, #c0c0c0 100%);
}

.texture-swatch[data-texture="leather"] {
    background: linear-gradient(135deg, #8b4513 0%, #654321 100%);
    background-image: repeating-linear-gradient(45deg, transparent, transparent 2px, rgba(0,0,0,0.1) 2px, rgba(0,0,0,0.1) 4px);
}

.texture-swatch[data-texture="wood"] {
    background: linear-gradient(90deg, #deb887 0%, #8b6914 50%, #deb887 100%);
}

.texture-swatch[data-texture="stone"] {
    background: linear-gradient(135deg, #696969 0%, #2f2f2f 100%);
    background-image: repeating-linear-gradient(0deg, transparent, transparent 3px, rgba(255,255,255,0.1) 3px, rgba(255,255,255,0.1) 6px);
}

.texture-swatch[data-texture="crystal"] {
    background: linear-gradient(135deg, rgba(173, 216, 230, 0.8) 0%, rgba(135, 206, 250, 0.8) 100%);
}

.texture-swatch[data-texture="glow"] {
    background: radial-gradient(circle, #ffff00 0%, #ff6600 100%);
    box-shadow: 0 0 10px rgba(255, 255, 0, 0.5);
}

/* Responsive Design */
@media (max-width: 600px) {
    .container {
        padding: 20px;
    }

    header h1 {
        font-size: 2rem;
    }

    .controls {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .border-customization {
        flex-direction: column;
        gap: 15px;
    }

    .swatch-group {
        min-width: auto;
        width: 100%;
    }

    .swatch-container {
        max-width: 100%;
        justify-content: center;
    }
}
