/**
 * PhotoPoints 3D v2.0 - Styles
 * 3D Crystal Engraving Application
 */

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

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0066cc 0%, #00aaff 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    overflow: hidden;
}

/* Header */
.header {
    background: linear-gradient(135deg, #0066cc 0%, #00aaff 100%);
    color: white;
    padding: 15px 20px;
    text-align: center;
    position: relative;
}

.header h1 {
    font-size: 1.8em;
    margin-bottom: 5px;
    font-weight: 700;
}

.header p {
    font-size: 0.9em;
    opacity: 0.95;
}

.version {
    position: absolute;
    top: 10px;
    right: 20px;
    background: rgba(255,255,255,0.2);
    padding: 3px 10px;
    border-radius: 15px;
    font-size: 0.75em;
    font-weight: 600;
}

/* Main Content Layout */
.main-content {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 0;
    min-height: calc(100vh - 120px);
    max-height: calc(100vh - 120px);
}

/* Controls Panel */
.controls-panel {
    background: #f8f9fa;
    padding: 15px;
    border-right: 1px solid #e0e0e0;
    overflow-y: auto;
    max-height: calc(100vh - 120px);
}

/* Step Indicator */
.step-indicator {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
}

.step {
    flex: 1;
    text-align: center;
    opacity: 0.4;
    transition: opacity 0.3s;
}

.step.active {
    opacity: 1;
}

.step.completed {
    opacity: 0.7;
}

.step-number {
    width: 32px;
    height: 32px;
    background: #ddd;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 5px;
    font-weight: 700;
    font-size: 0.9em;
    transition: all 0.3s;
}

.step.active .step-number {
    background: linear-gradient(135deg, #0066cc 0%, #00aaff 100%);
    color: white;
    transform: scale(1.1);
}

.step.completed .step-number {
    background: #00cc66;
    color: white;
}

.step-label {
    font-size: 0.75em;
    font-weight: 600;
    color: #666;
}

.step.active .step-label {
    color: #0066cc;
}

.divider {
    height: 2px;
    background: linear-gradient(90deg, transparent, #ddd, transparent);
    margin: 25px 0;
}

/* Control Sections */
.control-section {
    margin-bottom: 15px;
}

.control-section.hidden {
    display: none;
}

.control-section h3 {
    font-size: 1.1em;
    margin-bottom: 12px;
    color: #0066cc;
    font-weight: 700;
}

.control-group {
    margin-bottom: 12px;
}

.control-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    color: #333;
    font-size: 0.85em;
}

.value-display {
    float: right;
    background: #0066cc;
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75em;
    font-weight: 600;
}

.control-group input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
}

.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #0066cc;
    cursor: pointer;
    transition: transform 0.2s;
}

.control-group input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.control-group input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #0066cc;
    cursor: pointer;
    border: none;
}

/* Upload Button */
.control-group input[type="file"] {
    display: none;
}

.upload-btn {
    display: block;
    background: linear-gradient(135deg, #0066cc 0%, #00aaff 100%);
    color: white;
    padding: 10px 18px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9em;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 15px rgba(0,102,204,0.3);
}

.upload-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,102,204,0.4);
}

.file-name {
    margin-top: 10px;
    font-size: 0.9em;
    color: #666;
    font-style: italic;
}

/* Glass Block Selector */
.glass-block-selector {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.glass-block-option {
    background: white;
    border: 3px solid #ddd;
    border-radius: 12px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 15px;
}

.glass-block-option:hover {
    border-color: #00aaff;
    transform: translateX(5px);
}

.glass-block-option.selected {
    border-color: #0066cc;
    background: linear-gradient(135deg, rgba(0,102,204,0.05) 0%, rgba(0,170,255,0.05) 100%);
    box-shadow: 0 4px 15px rgba(0,102,204,0.2);
}

.glass-block-icon {
    font-size: 2.5em;
    width: 60px;
    text-align: center;
}

.glass-block-info {
    flex: 1;
}

.glass-block-name {
    font-weight: 700;
    font-size: 1.1em;
    color: #333;
    margin-bottom: 5px;
}

.glass-block-dims {
    font-size: 0.85em;
    color: #666;
    margin-bottom: 3px;
}

.glass-block-price {
    font-size: 0.9em;
    color: #0066cc;
    font-weight: 600;
}

/* Action Buttons */
.action-buttons {
    margin-top: 30px;
}

.action-btn {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 10px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 10px;
}

.action-btn.primary {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(245,87,108,0.3);
}

.action-btn.primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245,87,108,0.4);
}

.action-btn.secondary {
    background: #6c757d;
    color: white;
}

.action-btn.secondary:hover:not(:disabled) {
    background: #5a6268;
}

.action-btn.success {
    background: #00cc66;
    color: white;
}

.action-btn.success:hover:not(:disabled) {
    background: #00b359;
}

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

.action-btn.hidden {
    display: none;
}

.export-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.export-buttons.hidden {
    display: none;
}

/* Advanced Settings */
details {
    background: white;
    border-radius: 10px;
    padding: 15px;
    margin-top: 15px;
}

details summary {
    cursor: pointer;
    font-weight: 600;
    color: #0066cc;
    user-select: none;
}

details[open] summary {
    margin-bottom: 15px;
}

/* Viewer Panel */
.viewer-panel {
    background: #ffffff;
    padding: 15px;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 120px);
    overflow: hidden;
}

.viewer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    flex-shrink: 0;
}

.viewer-header h3 {
    font-size: 1.1em;
    color: #333;
    font-weight: 700;
}

.viewer-info {
    font-size: 0.9em;
    color: #666;
}

.preview-container {
    flex: 1;
    background: #f8f9fa;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    border: 1px solid #e0e0e0;
    min-height: 0;
}

/* Checkered pattern for transparent background */
.preview-container.transparent-bg {
    background-image: 
        linear-gradient(45deg, #ccc 25%, transparent 25%),
        linear-gradient(-45deg, #ccc 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #ccc 75%),
        linear-gradient(-45deg, transparent 75%, #ccc 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    background-color: #fff;
}

/* Black background */
.preview-container.black-bg {
    background: #000000;
}

.preview-container canvas {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.preview-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.placeholder {
    text-align: center;
    color: #999;
}

.placeholder svg {
    opacity: 0.3;
    margin-bottom: 20px;
}

.placeholder p {
    font-size: 1.1em;
}

/* Status Messages */
#statusMessage {
    margin-top: 20px;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    font-weight: 600;
}

#statusMessage.loading {
    background: #fff3cd;
    color: #856404;
    border: 2px solid #ffc107;
}

#statusMessage.success {
    background: #d4edda;
    color: #155724;
    border: 2px solid #00cc66;
}

#statusMessage.error {
    background: #f8d7da;
    color: #721c24;
    border: 2px solid #dc3545;
}

#statusMessage:empty {
    display: none;
}

/* Viewer Controls Hint */
.viewer-controls {
    margin-top: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    text-align: center;
}

.control-hint {
    font-size: 0.9em;
    color: #666;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .main-content {
        grid-template-columns: 350px 1fr;
    }
}

@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    
    .controls-panel {
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
        max-height: none;
    }
}

@media (max-width: 768px) {
    .header h1 {
        font-size: 1.8em;
    }
    
    .step-indicator {
        flex-wrap: wrap;
    }
    
    .step {
        flex-basis: 50%;
        margin-bottom: 15px;
    }
    
    .export-buttons {
        grid-template-columns: 1fr;
    }
}


/* Image Editor */
#imageEditor {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

#imageEditor h4 {
    font-size: 16px;
    margin-bottom: 15px;
    color: #333;
}

.editor-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.btn-secondary {
    flex: 1;
    padding: 8px 12px;
    font-size: 0.85em;
    font-weight: 600;
    color: #666;
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: #e0e0e0;
    transform: translateY(-2px);
}

.btn-primary {
    flex: 1;
    padding: 8px 12px;
    font-size: 0.85em;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, #0066cc 0%, #0052a3 100%);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 102, 204, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 102, 204, 0.4);
}

/* Clickable Steps */
.step {
    cursor: pointer;
    user-select: none;
}

.step:hover:not(.active) {
    opacity: 0.7;
}

.hidden {
    display: none;
}

/* Step Navigation Buttons */
.step-navigation {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.step-navigation button {
    flex: 1;
    padding: 12px 20px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

/* Override for step navigation buttons */
.step-navigation .btn-primary,
.btn-primary.btn-block {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.step-navigation .btn-primary:hover,
.btn-primary.btn-block:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.step-navigation .btn-secondary {
    background: #6c757d;
    color: white;
}

.step-navigation .btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

/* Editor Actions */
.editor-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.editor-actions button {
    flex: 1;
}


/* Slider with numeric input */
.slider-with-input {
    display: flex;
    gap: 6px;
    align-items: center;
}

.slider-with-input input[type="range"] {
    flex: 1;
}

.numeric-input {
    width: 60px;
    padding: 4px 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.8em;
    text-align: center;
    background: white;
}

.numeric-input:focus {
    outline: none;
    border-color: #4a90e2;
    box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.1);
}

/* Remove spinner arrows from number input */
.numeric-input::-webkit-inner-spin-button,
.numeric-input::-webkit-outer-spin-button {
    opacity: 1;
}

/* ============================================================================
   ORIGINAL THUMBNAIL
   ============================================================================ */

.original-thumbnail {
    margin-top: 10px;
    padding: 6px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.original-thumbnail img {
    width: 100%;
    height: auto;
    max-height: 80px;
    object-fit: contain;
    border-radius: 4px;
    display: block;
    margin: 0 auto;
}

.thumbnail-label {
    text-align: center;
    font-size: 0.7em;
    color: #666;
    margin-top: 3px;
    font-weight: 500;
}

/* ============================================================================
   CROP MODAL
   ============================================================================ */

.crop-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.crop-container {
    width: 100%;
    max-width: 900px;
    max-height: 70vh;
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.crop-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e0e0e0;
}

.crop-header h3 {
    font-size: 1.3em;
    color: #333;
    margin: 0;
}

.crop-image-container {
    width: 100%;
    max-height: 50vh;
    overflow: hidden;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 15px;
}

.crop-image-container img {
    max-width: 100%;
    display: block;
}

.crop-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.crop-actions button {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.crop-actions .btn-cancel {
    background: #6c757d;
    color: white;
}

.crop-actions .btn-cancel:hover {
    background: #5a6268;
}

.crop-actions .btn-apply {
    background: #0066cc;
    color: white;
}

.crop-actions .btn-apply:hover {
    background: #0052a3;
}

/* Full width preview for edited image */
.preview-full-width {
    width: 100% !important;
    max-width: 100% !important;
}


/* Toggle Label */
.toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.toggle-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.toggle-label span {
    font-size: 0.85em;
    color: #333;
}

/* Status Text */
.status-text {
    margin-top: 6px;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 0.75em;
    text-align: center;
}

.status-text.loading {
    background: #e3f2fd;
    color: #1976d2;
}

.status-text.success {
    background: #e8f5e9;
    color: #388e3c;
}

.status-text.error {
    background: #ffebee;
    color: #d32f2f;
}

/* Refinement Tools */
.refinement-tools {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}

.tool-btn {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.75em;
    transition: all 0.2s;
}

.tool-btn:hover {
    background: #f5f5f5;
    border-color: #0066cc;
}

.tool-btn.active {
    background: #0066cc;
    color: white;
    border-color: #0066cc;
}

/* Refinement Actions */
.refinement-actions {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}

.refinement-actions button {
    flex: 1;
    padding: 6px 10px;
    font-size: 0.75em;
}

/* Background Toggle */
.bg-toggle {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}

.bg-option {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8em;
    transition: all 0.2s;
}

.bg-option:hover {
    background: #f5f5f5;
    border-color: #0066cc;
}

.bg-option.active {
    background: #0066cc;
    color: white;
    border-color: #0066cc;
}

/* Refinement Canvas Overlay */
#refinementCanvas {
    position: absolute;
    top: 0;
    left: 0;
    cursor: crosshair;
    z-index: 10;
}
