/**
 * Shared Form Styles
 * Reusable form components used across modals and panels
 */

/* Form Group */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 500;
    color: #403d39;
}

/* Form Inputs */
.form-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc5b9;
    border-radius: 4px;
    font-size: 14px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #ffffff;
    color: #252422;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: #eb5e28;
    box-shadow: 0 0 0 3px rgba(235, 94, 40, 0.1);
}

textarea.form-input {
    resize: vertical;
    min-height: 60px;
}

select.form-input {
    cursor: pointer;
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 24px;
    justify-content: flex-end;
}

/* Form Buttons */
.btn-primary,
.btn-secondary {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
}

.btn-primary {
    background-color: #eb5e28;
    color: #ffffff;
}

.btn-primary:hover {
    background-color: #d14e1f;
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-secondary {
    background-color: #ccc5b9;
    color: #252422;
}

.btn-secondary:hover {
    background-color: #b8b0a4;
}

.btn-secondary:active {
    transform: scale(0.98);
}

/* Shape Selection Components */
.btn-select-shape-modal,
.btn-clear-shape-modal {
    padding: 8px 16px;
    border: 1px solid #ccc5b9;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    background-color: #ffffff;
    color: #252422;
    margin-right: 8px;
}

.btn-select-shape-modal:hover {
    background-color: #f5f5f5;
    border-color: #eb5e28;
}

.btn-clear-shape-modal {
    background-color: #ccc5b9;
}

.btn-clear-shape-modal:hover {
    background-color: #b8b0a4;
}

/* Shape Preview */
.node-shape-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 10px;
    padding: 15px;
    background-color: #f8f8f8;
    border: 1px solid #ccc5b9;
    border-radius: 4px;
    min-height: 80px;
}

.node-shape-preview svg {
    width: 100px;
    height: 60px;
}

/* Color Picker Components */
.color-picker-container {
    display: flex;
    gap: 8px;
    align-items: center;
}

.color-picker-wrapper {
    position: relative;
    width: 60px;
    height: 40px;
}

.color-picker-input {
    width: 100%;
    height: 100%;
    border: 1px solid #ccc5b9;
    border-radius: 4px;
    cursor: pointer;
    padding: 2px;
}

.color-picker-input:hover {
    border-color: #eb5e28;
}

.color-picker-input::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-picker-input::-webkit-color-swatch {
    border: none;
    border-radius: 3px;
}

/* Empty indicator (red diagonal X when no custom color) */
.color-picker-empty {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 4px;
    background: white;
    border: 1px solid #ccc5b9;
    pointer-events: none;
    overflow: hidden;
}

.color-picker-empty::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(
        to bottom right,
        transparent calc(50% - 1px),
        #dc3545 calc(50% - 1px),
        #dc3545 calc(50% + 1px),
        transparent calc(50% + 1px)
    );
}

.color-picker-empty.hidden {
    display: none;
}

.color-hex-input {
    flex: 1;
    height: 40px;
    padding: 0 12px;
    border: 1px solid #ccc5b9;
    border-radius: 4px;
    font-size: 13px;
    font-family: 'Courier New', monospace;
    text-transform: uppercase;
    background: #252422;
    color: #fffcf2;
}

.color-hex-input:focus {
    outline: none;
    border-color: #eb5e28;
}

.btn-clear-color {
    width: 40px;
    height: 40px;
    padding: 0;
    background: #252422;
    border: 1px solid #ccc5b9;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    color: #fffcf2;
}

.btn-clear-color:hover {
    background: #403d39;
}

.btn-clear-color .material-symbols-outlined {
    font-size: 18px;
}

.color-helper-text {
    font-size: 11px;
    color: #403d39;
    opacity: 0.7;
    margin: 6px 0 0 0;
}

/* Pastel Color Palette */
.pastel-palette {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pastel-row {
    display: flex;
    gap: 6px;
}

.pastel-swatch {
    flex: 1;
    aspect-ratio: 1; /* Square boxes */
    border: 1px solid #ccc5b9;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    padding: 0;
    min-width: 0;
    max-width: 40px; /* Limit square size */
}

.pastel-swatch:hover {
    transform: scale(1.1);
    border-color: #eb5e28;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    z-index: 1;
}

.pastel-swatch:active {
    transform: scale(0.95);
}

/* Text Color Picker */
.text-color-selector-wrapper {
    display: flex;
}

.text-color-dropdown {
    width: 100%;
    padding: 10px 35px 10px 12px;
    border: 1px solid #ccc5b9;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    background: white;
    color: #252422;
    cursor: pointer;
    transition: all 0.2s;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23403d39' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
}

.text-color-dropdown:hover {
    border-color: #999;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.text-color-dropdown:focus {
    outline: none;
    border-color: #eb5e28;
    box-shadow: 0 0 0 3px rgba(235, 94, 40, 0.1);
}

.text-color-dropdown option {
    padding: 8px;
    font-size: 14px;
}
