/* === COLLAPSIBLE FIELD CATEGORIES === */

.field-category {
    margin-bottom: 8px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: white;
    overflow: hidden;
}

.category-header {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    cursor: pointer;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    transition: background-color 0.2s;
}

.category-header:hover {
    background: #f1f5f9;
}

.category-icon {
    font-size: 16px;
    margin-right: 8px;
}

.category-title {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
}

.category-toggle {
    font-size: 12px;
    color: #6b7280;
    transition: transform 0.2s;
}

.category-header.collapsed .category-toggle {
    transform: rotate(-90deg);
}

.category-content {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px 12px 12px 12px;
    background: white;
    max-height: none;
    overflow: visible;
    transition: all 0.3s ease-in-out;
}

.category-content.collapsed {
    display: none;
}

/* Update field-block for single column layout */
.field-block {
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    cursor: grab;
    transition: all 0.2s;
    background: white;
    gap: 10px;
    min-height: 44px;
}

.field-block:hover {
    border-color: #3b82f6;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.15);
    transform: translateY(-1px);
}

.field-block:active {
    cursor: grabbing;
    transform: scale(0.98);
}

.field-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.field-block span:last-child {
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    line-height: 1.2;
    flex: 1;
}

/* Building Blocks Section Scrollable Container */
#buildingBlocks .section-content {
    max-height: calc(100vh - 200px); /* Leave space for header and tier indicator */
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e0 #f7fafc;
    padding-right: 4px;
}

/* Ensure field-palette takes full width */
#buildingBlocks .field-palette {
    display: flex;
    flex-direction: column;
    gap: 0;
    width: 100%;
}

#buildingBlocks .section-content::-webkit-scrollbar {
    width: 6px;
}

#buildingBlocks .section-content::-webkit-scrollbar-track {
    background: #f7fafc;
    border-radius: 3px;
}

#buildingBlocks .section-content::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 3px;
}

#buildingBlocks .section-content::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #buildingBlocks .section-content {
        max-height: calc(100vh - 250px);
    }
    
    .field-block {
        padding: 8px 10px;
        min-height: 40px;
    }
    
    .field-icon {
        font-size: 16px;
    }
    
    .field-block span:last-child {
        font-size: 12px;
    }
}

/* === NEW FIELD TYPES STYLES === */

/* Range/Slider Field */
.range-field-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.range-input-wrapper {
    position: relative;
}

.range-input {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: #e5e7eb;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.range-input::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #3b82f6;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.range-input::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #3b82f6;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.range-labels {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 4px;
    font-size: 12px;
    color: #6b7280;
}

.range-value {
    font-weight: 500;
    color: #374151;
}

.range-display {
    text-align: center;
    font-size: 18px;
    font-weight: 600;
    color: #3b82f6;
    padding: 8px;
    background: #f8fafc;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

/* Date Range Field */
.date-range-container {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.date-input-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 120px;
}

.date-sub-label {
    font-size: 12px;
    font-weight: 500;
    color: #6b7280;
}

.date-input {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.date-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.date-separator {
    font-size: 14px;
    color: #6b7280;
    margin: 0 8px;
    align-self: flex-end;
    padding-bottom: 8px;
}

/* Time Field */
.time-field-container {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.time-input {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
    width: 150px;
}

.time-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.time-format-note {
    font-size: 12px;
    color: #6b7280;
    margin-top: 4px;
}

/* Password Field */
.password-field-container {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input {
    padding: 8px 40px 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
    width: 100%;
}

.password-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.password-toggle {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.password-toggle:hover {
    background-color: #f3f4f6;
}

.toggle-icon {
    font-size: 16px;
}

.password-strength {
    margin-top: 4px;
    font-size: 12px;
    font-weight: 500;
}

/* Country Field */
.country-field-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.country-select-group,
.state-select-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.country-sub-label,
.state-sub-label {
    font-size: 12px;
    font-weight: 500;
    color: #6b7280;
}

.country-select,
.state-select {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    background-color: white;
    transition: border-color 0.2s;
}

.country-select:focus,
.state-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Divider Field */
.divider-container {
    position: relative;
    text-align: center;
    margin: 20px 0;
}

.divider-text {
    background-color: white;
    padding: 0 16px;
    font-size: 14px;
    color: #6b7280;
    position: relative;
    z-index: 1;
}

.divider-line {
    border: none;
    height: 1px;
    background-color: #e5e7eb;
    margin: 0;
}

/* Image Field */
.image-field-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.form-image {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.image-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    background-color: #f9fafb;
    color: #6b7280;
    gap: 8px;
}

.image-icon {
    font-size: 32px;
    opacity: 0.5;
}

.image-text {
    font-size: 14px;
}

.image-caption {
    font-size: 14px;
    color: #6b7280;
    text-align: center;
    font-style: italic;
}

/* Color Field */
.color-field-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.color-input-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.color-input {
    width: 60px;
    height: 40px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
    background: none;
    padding: 0;
}

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

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

.color-display {
    display: flex;
    align-items: center;
    gap: 8px;
}

.color-swatch {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    border: 1px solid #d1d5db;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

.color-value {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 14px;
    color: #374151;
    background-color: #f3f4f6;
    padding: 2px 6px;
    border-radius: 4px;
}

.color-presets {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.color-preset {
    width: 32px;
    height: 32px;
    border: 2px solid white;
    border-radius: 6px;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.color-preset:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

/* Responsive design for smaller screens */
@media (max-width: 768px) {
    .date-range-container {
        flex-direction: column;
        align-items: stretch;
    }
    
    .date-separator {
        align-self: center;
        padding: 8px 0;
    }
    
    .country-field-container {
        gap: 8px;
    }
    
    .color-input-wrapper {
        flex-wrap: wrap;
    }
    
    .color-presets {
        justify-content: center;
    }
}