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

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 100vw;
    overflow-x: hidden;
}

/* Container */
.container {
    max-width: 1400px;
    width: 100%;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    overflow: hidden;
}

@media (max-width: 600px) {
    .container {
        border-radius: 10px;
        max-width: 100%;
    }
}

/* Header */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

.header h1 {
    font-size: 32px;
    margin-bottom: 10px;
}

.header p {
    font-size: 16px;
    opacity: 0.9;
}

/* Content Grid */
.content {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 0;
    min-height: 600px;
}

/* Form Section */
.form-section {
    padding: 40px;
    background: #f8f9fa;
    border-right: 1px solid #e0e0e0;
    overflow-y: auto;
    max-height: calc(100vh - 200px);
}

/* Preview Section */
.preview-section {
    padding: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
}

/* Steps */
.step {
    margin-bottom: 30px;
}

.step-title {
    font-size: 14px;
    font-weight: bold;
    color: #667eea;
    text-transform: uppercase;
    margin-bottom: 10px;
    letter-spacing: 1px;
}

/* Upload Area */
.upload-area {
    border: 3px dashed #667eea;
    border-radius: 10px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: white;
}

.upload-area:hover {
    border-color: #764ba2;
    background: #f8f9fa;
}

.upload-area.dragover {
    border-color: #764ba2;
    background: #f0f0ff;
}

.upload-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

input[type="file"] {
    display: none;
}

/* Form Elements */
.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
    font-size: 14px;
}

input[type="text"],
input[type="number"],
select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
    font-family: 'Arial', sans-serif;
}

input:focus,
select:focus {
    outline: none;
    border-color: #667eea;
}

/* Buttons */
.btn {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.4);
}

.btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* Messages */
.error-message,
.success-message {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: 500;
}

.error-message {
    background: #fee;
    color: #c00;
    border: 2px solid #fcc;
}

.success-message {
    background: #efe;
    color: #0a0;
    border: 2px solid #cfc;
}

.hidden {
    display: none;
}

/* Preview Placeholder */
.preview-placeholder {
    text-align: center;
    color: #999;
    padding: 40px;
}

.preview-placeholder-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.3;
}

.preview-placeholder h3 {
    font-size: 24px;
    margin-bottom: 10px;
}

/* Card Preview */
.card-preview {
    width: 500px;
    height: 700px;
    position: relative;
    border-radius: 15px;
    box-shadow: 0 15px 50px rgba(0,0,0,0.3);
    overflow: hidden;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .card-preview {
        transform: scale(0.8);
        transform-origin: center center;
    }
    
    .preview-section {
        padding: 20px;
    }
}

@media (max-width: 1024px) {
    .content {
        display: flex;
        flex-direction: column;
    }

    /* Make form-section transparent on mobile so its children can be reordered */
    .form-section {
        display: contents;
    }
    
    /* Create a wrapper div effect with a pseudo-container */
    .form-section > * {
        order: 1; /* Default order for all form elements */
    }
    
    /* Error/success messages at top */
    #errorMessage,
    #successMessage {
        order: 0;
        margin: 20px;
    }
    
    /* Upload area */
    .form-section > .step:nth-of-type(1) { order: 1; }
    
    /* Sport select */
    #sportStep { order: 2; }
    
    /* Style select */
    #styleStep { order: 3; }
    
    /* Player info */
    #infoStep { order: 4; }
    
    /* Color picker */
    #colorPickerSection { order: 5; }
    
    /* Photo controls - after color picker */
    #photoControls { 
        order: 6;
        padding: 20px;
        background: #f8f9fa;
        margin: 0;
        border-bottom: 1px solid #e0e0e0;
    }

    /* Preview in middle */
    .preview-section {
        order: 7;
        min-height: 600px;
        border-top: 1px solid #e0e0e0;
        border-bottom: 1px solid #e0e0e0;
    }
    
    /* Download button at the end */
    #downloadSection {
        order: 8;
        padding: 20px;
        background: #f8f9fa;
        margin: 0;
    }
}

@media (max-width: 600px) {
    body {
        padding: 10px;
    }
    
    .preview-section {
        padding: 5px;
        min-height: 480px;
        overflow: hidden; /* Clip any overflow */
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .card-preview {
        transform: scale(0.64);
        transform-origin: center center;
    }

    .header h1 {
        font-size: 24px;
    }

    .form-section {
        padding: 20px;
    }
}
/* ====================================
   COLOR PICKER BUTTONS (ADD TO YOUR CSS)
   ==================================== */

.color-picker-btn {
    flex: 1;
    padding: 12px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.color-picker-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.color-picker-btn.active {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    box-shadow: 0 4px 15px rgba(56, 239, 125, 0.5);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 4px 15px rgba(56, 239, 125, 0.5);
    }
    50% {
        box-shadow: 0 4px 25px rgba(56, 239, 125, 0.8);
    }
}

.btn-secondary {
    padding: 10px 20px;
    background: #f5f5f5;
    color: #666;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: #e0e0e0;
    border-color: #bbb;
    color: #333;
}

/* When eyedropper is active */
#previewArea[style*="crosshair"] {
    cursor: crosshair !important;
}

#previewArea[style*="crosshair"] * {
    cursor: crosshair !important;
}
/* === MOBILE FIX FOR HORIZONTAL CARDS ONLY === */
@media (max-width: 600px) {
    /* Only target horizontal cards (700x500) on mobile */
    .card-preview[style*="width: 700px"] {
        transform: scale(0.48) !important;
        transform-origin: center center !important;
    }
    
    /* Keep vertical cards as they were */
    .card-preview[style*="width: 500px"] {
        transform: scale(0.64);
        transform-origin: center center;
    }
}