* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 5px;
    padding: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 15px;
    margin-top: 0;
    font-size: 2.5em;
}

.home-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    margin-bottom: 10px;
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 5px;
    background: rgba(102, 126, 234, 0.1);
}

.home-link:hover {
    color: #5568d3;
    background: rgba(102, 126, 234, 0.2);
    border-color: rgba(102, 126, 234, 0.5);
}

.controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.upload-section {
    text-align: center;
}

.file-name {
    margin-top: 10px;
    color: #667eea;
    font-weight: 600;
    font-size: 0.95em;
}

.upload-btn {
    display: inline-block;
    padding: 12px 24px;
    background: #667eea;
    color: white;
    border-radius: 3px;
    cursor: pointer;
    font-size: 1.1em;
    transition: all 0.3s ease;
}

.upload-btn:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.settings-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 3px;
    align-items: start;
}

.setting-category {
    background: white;
    padding: 12px;
    border-radius: 3px;
    border: 2px solid #e0e0e0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.setting-category h3 {
    margin: 0 0 10px 0;
    font-size: 1em;
    color: #667eea;
    font-weight: 600;
    border-bottom: 2px solid #667eea;
    padding-bottom: 6px;
    grid-column: 1 / -1;
    height: 2em;
    display: flex;
    align-items: flex-start;
}

.setting-category .checkbox-group {
    grid-column: 1 / -1;
}

.setting-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.setting-group label {
    font-weight: 600;
    color: #555;
    font-size: 0.9em;
}

.setting-group input,
.setting-group select {
    padding: 8px;
    border: 2px solid #ddd;
    border-radius: 3px;
    font-size: 1em;
    transition: border-color 0.3s ease;
    min-width: 0;
    width: 100%;
}

.setting-group input:focus,
.setting-group select:focus {
    outline: none;
    border-color: #667eea;
}

.setting-group input:disabled {
    background-color: #e9ecef;
    color: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Color picker styling */
.pickr {
    width: 100%;
}

.pickr .pcr-button {
    width: 100%;
    height: 42px;
    border-radius: 3px;
    border: 2px solid #ddd;
    transition: border-color 0.3s ease;
}

.pickr .pcr-button:hover {
    border-color: #667eea;
}

.pcr-app {
    position: fixed !important;
    left: 50% !important;
    top: 50% !important;
    transform: translate(-50%, -50%) !important;
    z-index: 9999 !important;
}

.pcr-app .pcr-swatches > button {
    border-radius: 4px !important;
}

.pcr-app .pcr-interaction .pcr-result {
    border-radius: 4px;
}

.pcr-app .pcr-selection .pcr-color-preview {
    border-radius: 4px;
}

/* Color select with preview */
.color-select-wrapper {
    position: relative;
    width: 100%;
}

.color-select-wrapper select {
    padding-left: 40px;
}

.color-preview {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    border-radius: 2px;
    border: 2px solid #ddd;
    pointer-events: none;
    z-index: 1;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: #555;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.action-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 3px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: #218838;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(40, 167, 69, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: #5a6268;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(108, 117, 125, 0.4);
}

.canvas-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
    background: #f8f9fa;
    border-radius: 3px;
    padding: 15px;
    overflow: auto;
}

#canvas {
    max-width: 100%;
    height: auto;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    border-radius: 2px;
}

.info-section {
    margin-top: 15px;
    text-align: center;
    color: #666;
    font-size: 0.9em;
}

@media (max-width: 768px) {
    .container {
        padding: 20px;
    }

    h1 {
        font-size: 1.8em;
    }

    .settings-section {
        grid-template-columns: 1fr;
    }

    .action-buttons {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }
}
