* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

header {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

header h1 {
    font-size: 1.5rem;
    color: #333;
}

.header-actions {
    display: flex;
    gap: 10px;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s ease;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5a6fd6;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* Sections */
section {
    background: white;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

section h2 {
    font-size: 1.2rem;
    margin-bottom: 20px;
    color: #333;
    border-bottom: 2px solid #667eea;
    padding-bottom: 10px;
}

.hint {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 15px;
}

/* Form */
.button-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.form-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.form-group {
    flex: 1;
    min-width: 200px;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    color: #555;
}

.form-group input[type="text"],
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
}

/* Color input */
.color-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: center;
}

.color-input-wrapper input[type="color"] {
    width: 50px;
    height: 40px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    padding: 0;
}

.color-input-wrapper input[type="text"] {
    flex: 1;
    font-family: monospace;
}

/* Width selector */
.width-selector {
    display: flex;
    gap: 10px;
}

.width-option {
    cursor: pointer;
}

.width-option input {
    display: none;
}

.width-box {
    display: inline-block;
    padding: 10px 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s;
}

.width-option input:checked + .width-box {
    border-color: #667eea;
    background: #667eea;
    color: white;
}

.w1 { min-width: 50px; }
.w2 { min-width: 80px; }
.w3 { min-width: 110px; }

/* Preview */
.preview-row {
    align-items: flex-end;
}

.button-preview {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 80px;
    border-radius: 12px;
    padding: 15px;
    background: #4CAF50;
    color: white;
    transition: all 0.3s ease;
}

.preview-name {
    font-size: 1.1rem;
    font-weight: 600;
}

.preview-note {
    font-size: 0.85rem;
    opacity: 0.9;
}

.form-actions {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

/* Buttons list */
.buttons-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.button-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    transition: all 0.2s;
    cursor: grab;
}

.button-item:active {
    cursor: grabbing;
}

.button-item.dragging {
    opacity: 0.5;
    background: #e9ecef;
}

.button-item.drag-over {
    border: 2px dashed #667eea;
}

.button-item-preview {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-width: 120px;
    min-height: 60px;
    border-radius: 10px;
    padding: 10px;
}

.button-item-preview .preview-name {
    font-size: 0.95rem;
}

.button-item-preview .preview-note {
    font-size: 0.75rem;
}

.button-item-info {
    flex: 1;
}

.button-item-info .info-row {
    display: flex;
    gap: 15px;
    font-size: 0.85rem;
    color: #666;
}

.button-item-info .info-label {
    color: #999;
}

.button-item-actions {
    display: flex;
    gap: 8px;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 40px;
    color: #666;
}

.empty-state p {
    font-size: 1.1rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 25px;
    min-width: 350px;
    max-width: 90%;
}

.modal-content h3 {
    margin-bottom: 15px;
    color: #333;
}

.modal-content p {
    margin-bottom: 20px;
    color: #666;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Responsive */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .header-actions {
        width: 100%;
        justify-content: center;
    }

    .form-row {
        flex-direction: column;
        gap: 15px;
    }

    .form-group {
        min-width: 100%;
    }

    .button-item {
        flex-direction: column;
        text-align: center;
    }

    .button-item-actions {
        width: 100%;
        justify-content: center;
    }
}
