* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 500px;
    margin: 0 auto;
}

h1 {
    color: white;
    text-align: center;
    margin-bottom: 30px;
    font-size: 24px;
}

.preview-area {
    background: white;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.preview-box {
    width: 100%;
    aspect-ratio: 4/3;
    background: #f5f5f5;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    margin-bottom: 15px;
}

.placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #999;
}

.placeholder svg {
    margin-bottom: 10px;
}

.preview-image {
    display: none;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-image.active {
    display: block;
}

#fileInput {
    display: none;
}

.upload-btn {
    width: 100%;
    padding: 14px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s;
}

.upload-btn:hover {
    background: #5568d3;
}

.cabinet-buttons {
    display: flex;
    justify-content: center;
    align-items: center;
    /* grid-template-columns: 1fr 1fr; */
    gap: 15px;
    margin-bottom: 20px;
}

.cabinet-btn {
    width: 100%;
    padding: 16px;
    background: white;
    color: #333;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.cabinet-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.cabinet-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 16px;
    padding: 24px;
    max-width: 90%;
    width: 400px;
    max-height: 80vh;
    overflow-y: auto;
}

#modalTitle {
    font-size: 20px;
    margin-bottom: 20px;
    text-align: center;
}

.color-selector {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: center;
}

.color-option {
    flex: 1;
    padding: 10px 20px;
    background: #f5f5f5;
    color: #666;
    border: 2px solid transparent;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.color-option:hover {
    background: #e8e8e8;
}

.color-option.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.cabinet-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.cabinet-option {
    position: relative;
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
    border: 3px solid transparent;
    transition: border-color 0.3s;
}

.cabinet-option img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    display: block;
}

.cabinet-option.selected {
    border-color: #667eea;
}

.generate-btn {
    width: 100%;
    padding: 14px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 10px;
}

.generate-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.close-btn {
    width: 100%;
    padding: 14px;
    background: #f5f5f5;
    color: #333;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
}

.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.loading-overlay.active {
    display: flex;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay p {
    color: white;
    margin-top: 20px;
    font-size: 16px;
}
