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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f0f2f5;
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

header {
    background: #2c3e50;
    color: white;
    padding: 30px;
    text-align: center;
    position: relative;
}

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

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

main {
    padding: 40px;
}

.form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.product-entry {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.product-entry h3 {
    font-size: 18px;
    color: #2c3e50;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
}

.btn-danger {
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-danger:hover {
    background: #c0392b;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 600;
    color: #555;
    font-size: 14px;
}

.form-group input[type="text"],
.form-group input[type="url"],
.form-group select,
.form-group textarea {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-group input[type="text"]:focus,
.form-group input[type="url"]:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #2c3e50;
}

.custom-instructions {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    resize: vertical;
    min-height: 100px;
}

.radio-group {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 14px;
}

.radio-label input[type="radio"] {
    accent-color: #667eea;
}

.help-text {
    font-size: 12px;
    color: #6c757d;
    margin-top: 4px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background: #2c3e50;
    color: white;
}

.btn-primary:hover {
    background: #34495e;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
}

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

.btn-secondary:hover {
    background: #5a6268;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.loading {
    text-align: center;
    padding: 40px;
}

.spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 20px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error {
    background: #f8d7da;
    color: #721c24;
    padding: 16px;
    border-radius: 8px;
    border: 1px solid #f5c6cb;
    margin-top: 20px;
}

.debug-panel {
    background: #f5f5f5;
    border: 1px solid #ddd;
    padding: 15px;
    border-radius: 8px;
    margin-top: 20px;
    max-height: 400px;
    overflow-y: auto;
}

.debug-panel h3 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 16px;
    color: #333;
}

#debugLog {
    background: #fff;
    border: 1px solid #ccc;
    padding: 10px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 10px;
    white-space: pre-wrap;
    word-wrap: break-word;
}

#debugLog .debug-error {
    color: #c33;
}

#debugLog .debug-info {
    color: #333;
}

#debugLog .debug-success {
    color: #3c3;
}

.preview {
    margin-top: 30px;
    padding: 30px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px solid #e9ecef;
}

.preview h2 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 24px;
}

#previewContent {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.download-section {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.hidden {
    display: none;
}

footer {
    background: #f8f9fa;
    padding: 20px;
    text-align: center;
    color: #6c757d;
    font-size: 14px;
}

@media (max-width: 600px) {
    .container {
        margin: 0;
        border-radius: 0;
    }
    
    main {
        padding: 20px;
    }
    
    .radio-group {
        flex-direction: column;
        gap: 10px;
    }
    
    .download-section {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
}

/* Layout Builder Styles */
.layout-builder-toggle {
    margin: 20px 0 10px;
}

.layout-builder-toggle .btn {
    width: 100%;
    background: #f1f3f5;
    color: #495057;
    border: 1px solid #dee2e6;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.layout-builder-toggle .btn:hover {
    background: #e9ecef;
    transform: none;
    box-shadow: none;
}

.layout-builder-container {
    background: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
}

.layout-builder-container h3 {
    color: #2b3035;
    margin-bottom: 8px;
    font-size: 1.25rem;
}

.builder-sections {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin: 20px 0;
}

.builder-section {
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 16px;
    position: relative;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    transition: box-shadow 0.2s, border-color 0.2s;
}

.builder-section:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.05);
    border-color: #adb5bd;
}

.builder-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f1f3f5;
    cursor: grab;
}

.builder-section-header:active {
    cursor: grabbing;
}

.builder-section-type-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.drag-handle {
    color: #adb5bd;
    font-size: 18px;
    cursor: grab;
    user-select: none;
}

.builder-section-type {
    background: #e9ecef;
    color: #495057;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.builder-section-controls {
    display: flex;
    gap: 6px;
}

.builder-section-controls button {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #6c757d;
    transition: all 0.2s;
}

.builder-section-controls button:hover {
    background: #e9ecef;
    color: #343a40;
}

.builder-section-controls .delete-btn:hover {
    background: #ffe3e3;
    color: #e03131;
    border-color: #ffc9c9;
}

.builder-section-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.builder-row {
    display: flex;
    gap: 12px;
    align-items: center;
    background: #f8f9fa;
    padding: 10px 12px;
    border-radius: 6px;
    border: 1px solid #f1f3f5;
}

.builder-row input, .builder-row select {
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    flex: 1;
    font-size: 14px;
    background: white;
    transition: border-color 0.2s;
}

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

.btn-sm {
    padding: 8px 14px;
    font-size: 13px;
    text-transform: none;
    letter-spacing: normal;
    border-radius: 6px;
    background: #f8f9fa;
    color: #495057;
    border: 1px solid #dee2e6;
}

.btn-sm:hover {
    background: #e9ecef;
    color: #212529;
    transform: none;
}

.builder-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
}
}
