/*
 * ARTISAN IMAGE PROCESSOR - FORM CONTROL STYLES
 * 
 * This file contains all CSS for form elements including buttons, inputs, 
 * selects, checkboxes, and radio buttons. These styles ensure consistent
 * appearance and behavior across all form controls in the application.
 * 
 * Form Control Categories:
 * - Universal button styling and states
 * - Input fields (text, number, color)
 * - Select dropdowns with custom styling
 * - Checkbox and radio button styling
 * - Form validation and focus states
 */

/* ===== UNIVERSAL BUTTON STYLING ===== */
/* General button styling - base appearance for all buttons - matches original Artisan */
.button {
    padding: var(--button-padding);
    border: 1px solid rgba(232, 249, 255, 0.5);
    border-radius: var(--button-radius); /* 20px - more rounded like original */
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.08);
    background-color: rgba(250, 251, 255, 0.3);
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    user-select: none;
}

/* Enhanced button hover effect - matches original */
.button:hover:not(:disabled) {
    box-shadow: 3px 3px 8px rgba(0, 0, 0, 0.12);
    transform: translateY(-1px);
}

/* Primary button - dark background for main actions like "Process Images" */
.primary-button {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Primary button hover effect - darker shade on hover */
.primary-button:hover:not(:disabled) {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 3px 3px 8px rgba(0, 0, 0, 0.12);
}

/* Primary button active state - no transform on click */
.primary-button:active {
    transform: translateY(0);
}

/* Primary button disabled state - grayed out and non-interactive */
.primary-button:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.05);
    opacity: 0.7;
}

/* Secondary button - light background for secondary actions like "Reset" */
.secondary-button {
    background-color: #eee;
    color: var(--text-primary);
    border-color: rgba(232, 249, 255, 0.7);
}

/* Secondary button hover effect - darker background on hover */
.secondary-button:hover:not(:disabled) {
    background-color: #ddd;
    border-color: rgba(232, 249, 255, 0.9);
    transform: translateY(-1px);
}

/* Danger button - red background for removal actions */
.danger-button {
    background: var(--danger-color);
    color: white;
    border-color: var(--danger-color);
}

/* Danger button hover effect - darker shade on hover */
.danger-button:hover:not(:disabled) {
    background: var(--danger-hover);
    border-color: var(--danger-hover);
}

/* Small remove button - circular × button */
.remove-btn {
    background: var(--danger-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

/* Remove button hover effect - scale on hover */
.remove-btn:hover {
    background: var(--danger-hover);
    transform: scale(1.1);
}

/* Disabled button styling - grayed out and non-interactive */
.button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    opacity: 0.7;
    transform: none !important;
    box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.05) !important;
}

/* Button focus state for accessibility - keyboard navigation */
.button:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* ===== INPUT FIELD STYLING ===== */
/* Number inputs and text inputs - consistent padding and borders */
input[type="number"], 
input[type="text"],
input[type="email"],
input[type="url"],
textarea {
    width: 100%;
    padding: var(--input-padding);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background: white;
}

/* Input focus state - enhanced border for visual feedback */
input[type="number"]:focus,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="url"]:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Input placeholder styling - subtle gray text */
input[type="number"]::placeholder,
input[type="text"]::placeholder,
input[type="email"]::placeholder,
input[type="url"]::placeholder,
textarea::placeholder {
    color: #999;
    font-style: italic;
}

/* File input styling */
input[type="file"] {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    background: white;
    cursor: pointer;
}

/* File input hover effect */
input[type="file"]:hover {
    border-color: var(--primary-color);
}

/* Color input styling */
input[type="color"] {
    width: 50px;
    height: 35px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    background: none;
    padding: 0;
}

/* Color input styles for WebKit */
input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

/* ===== SELECT DROPDOWN STYLING ===== */
/* All select elements styling - consistent appearance across dropdowns */
select {
    width: 100%;
    padding: var(--input-padding);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 8px center;
    background-repeat: no-repeat;
    background-size: 16px;
    padding-right: 32px;
}

/* Custom focus styling for dropdowns - matches input focus style */
select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Style dropdown options - consistent padding and colors */
select option {
    padding: 8px;
    background-color: white;
    color: #333;
}

/* Custom hover effect for dropdown options - light gray background */
select option:hover {
    background-color: #f5f5f5 !important;
    color: #333 !important;
}

/* Selected option styling - dark background for active selection */
select option:checked {
    background-color: #333 !important;
    color: white !important;
}

/* Flex container selects - equal width distribution in flex layouts */
.flex.gap-6 select {
    flex: 1;
    width: 100%;
}

/* Background select specific spacing - margin for color picker alignment */
#background-select {
    flex: 1;
    margin-right: 12px;
}

/* Aspect ratio select - full width within its container */
#aspect-ratio {
    flex: 1;
    width: 100%;
}

/* ===== CHECKBOX STYLING ===== */
/* Checkbox styling - custom accent color and consistent sizing */
input[type="checkbox"] {
    accent-color: #333;
    width: 15px;
    height: 15px;
    cursor: pointer;
    margin: 0;
}

/* Checked checkbox colors - dark background when selected */
input[type="checkbox"]:checked {
    background-color: #333;
    border-color: #333;
}

/* Checkbox focus state - using subtle palette color instead of distracting black */
input[type="checkbox"]:focus {
    outline: 2px solid #fbfbfb; /* Subtle color from our palette */
    outline-offset: 2px;
}

/* ===== RADIO BUTTON STYLING ===== */
/* Radio button styling - custom accent color and consistent sizing */
input[type="radio"] {
    accent-color: #333;
    width: 12px;
    height: 12px;
    cursor: pointer;
    margin: 0;
}

/* Checked radio button colors - dark background when selected */
input[type="radio"]:checked {
    background-color: #333;
    border-color: #333;
}

/* Radio button focus state - also using subtle palette color */
input[type="radio"]:focus {
    outline: 2px solid #fbfbfb; /* Matches checkbox styling */
    outline-offset: 2px;
}

/* ===== RANGE SLIDERS - EXACT ORIGINAL MATCH ===== */

.slider-container {
    display: flex;
    align-items: center;
    gap: 15px; /* Original: 15px (was 12px) */
    margin-top: 5px; /* Original: 5px (was 8px) */
}

.slider {
    flex: 1;
    height: 3px;
    border-radius: 3px;
    background: var(--gray-200);
    outline: none;
    appearance: none;
    cursor: pointer;
}

/* WebKit slider thumb (Chrome/Safari) - exact original size and effects */
.slider::-webkit-slider-thumb {
    appearance: none;
    width: 16px; /* Original: 16px (was 18px) */
    height: 16px; /* Original: 16px (was 18px) */
    border-radius: 50%;
    background: #333 !important;
    cursor: pointer;
    transition: transform 0.1s; /* Original: 0.1s (was 0.2s ease) */
}

/* WebKit slider thumb hover/focus effects - exact original */
.slider::-webkit-slider-thumb:hover,
.slider:focus::-webkit-slider-thumb {
    transform: scale(1.25); /* Original: 1.25 (was 1.1) */
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.3); /* Original shadow effect */
}

/* Firefox slider thumb - exact original size and effects */
.slider::-moz-range-thumb {
    width: 16px; /* Original: 16px (was 18px) */
    height: 16px; /* Original: 16px (was 18px) */
    border-radius: 50%;
    background: #333 !important;
    cursor: pointer;
    border: none;
    transition: transform 0.1s; /* Original: 0.1s (was missing) */
}

/* Firefox slider thumb hover/focus effects - exact original */
.slider::-moz-range-thumb:hover,
.slider:focus::-moz-range-thumb {
    transform: scale(1.25); /* Original: 1.25 (was 1.1) */
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.3); /* Original shadow effect */
}

/* Slider track styling - unchanged */
.slider::-webkit-slider-track {
    background: var(--gray-200);
    height: 6px;
    border-radius: 3px;
}

.slider::-moz-range-track {
    background: var(--gray-200);
    height: 6px;
    border-radius: 3px;
    border: none;
}

/* Internet Explorer slider thumb - exact original (from components.css) */
.slider::-ms-thumb {
    height: 16px; /* Original: 16px */
    width: 16px; /* Original: 16px */
    background: #333;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.1s; /* Original: 0.1s */
}

/* IE slider thumb hover/focus effects - exact original */
.slider:focus::-ms-thumb,
.slider:hover::-ms-thumb {
    transform: scale(1.25); /* Original: 1.25 */
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.3); /* Original shadow */
}

/* Slider value display - unchanged */
.slider-container span {
    min-width: 50px;
    text-align: center;
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ===== FORM VALIDATION STATES ===== */
/* Invalid input styling - red border for validation errors */
input:invalid {
    border-color: #ff4d4d;
}

/* Valid input styling - green border for successful validation */
input:valid {
    border-color: #fbfbfb;
}

/* Required field indicator - can be used with ::after pseudo-element */
.required::after {
    content: " *";
    color: #ff4d4d;
}

/* ===== FORM LAYOUT HELPERS ===== */
/* Form group - consistent spacing for related form elements */
.form-group {
    margin-bottom: 15px;
}

/* Form row - horizontal layout for side-by-side form elements */
.form-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Form label - consistent styling for all form labels */
.form-label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #333;
}

/* Inline form elements - for checkboxes and radio buttons with labels */
.form-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.form-inline input[type="checkbox"] {
    margin: 0;
}

.form-inline label {
    margin: 0;
    cursor: pointer;
    font-size: 14px;
    font-weight: 400;
    color: var(--text-primary);
}

/* ===== ACCESSIBILITY ENHANCEMENTS ===== */
/* High contrast mode support */
@media (prefers-contrast: high) {
    .button {
        border: 2px solid currentColor;
    }
    
    input,
    select,
    textarea {
        border-width: 2px;
    }
}

/* Reduced motion support - disable transitions for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    .button,
    input,
    select,
    .slider,
    .collapsible-header i,
    .collapsible-content {
        transition: none;
    }
    
    .button:hover {
        transform: none;
    }
}

/* ===== FORM LABELS ===== */

label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 6px;
}

/* Labels inside radio/checkbox groups */
.radio-group label,
.checkbox-group label {
    display: flex;
    align-items: center;
    margin-bottom: 0;
    font-weight: 400;
}

/* ===== FORM VALIDATION ===== */

.error {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1) !important;
}

.error-message {
    color: #ef4444;
    font-size: 12px;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.success {
    border-color: #10b981 !important;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1) !important;
}

/* ===== OPTION GROUPS ===== */

.option-group {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-light);
}

.option-group:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.option-group label {
    color: var(--text-primary);
    font-weight: 500;
}

/* ===== DISPLAY OPTIONS GROUPS - NO INDIVIDUAL BORDERS ===== */
/* Remove individual borders since the entire Display Options section is now bordered */
.more-tweaks-group {
    margin-bottom: 20px !important;
    padding-bottom: 15px !important;
    border-bottom: 1px solid var(--border-light) !important;
    /* Remove all the individual border styling */
}

.more-tweaks-group:last-child {
    border-bottom: none !important;
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

/* ===== DISPLAY OPTIONS CARDS - INDIVIDUAL BORDERED SECTIONS ===== */
/* Each section in Display Options gets its own bordered card, matching main option groups */
.more-tweaks-card {
    padding: 15px !important;
    border: 1px solid #f2f2f2 !important;
    border-radius: 16px !important;
    background-color: #ffffff !important; /* Pure white for better contrast */
    margin-bottom: 18px !important;
    box-shadow: 1px 1px 4px #fafbff !important;
    transition: all 0.2s ease !important;
}

/* Add hover effect for Display Options cards - same as main option groups */
.more-tweaks-card:hover {
    box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.12) !important;
    transform: translateY(-1px) !important;
}

/* Sub-group styling for nested options within Enhanced Options */
.option-subgroup {
    margin-top: 10px;
}

.option-subgroup label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

/* ===== COLLAPSIBLE SECTIONS - EXACT ORIGINAL STYLING ===== */

.collapsible {
    /* Apply same styling as main option groups - bordered card appearance */
    padding: 12px;
    border: 1px solid #f2f2f2;
    border-radius: 16px;
    background-color: #fbfbfb;
    margin-bottom: 18px;
    box-shadow: 1px 1px 4px #fafbff;
    transition: all 0.2s ease;
    overflow: hidden;
}

/* Hover effect for Display Options - same as main option groups */
.collapsible:hover {
    box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.12);
    transform: translateY(-1px);
}

.collapsible-header {
    padding: 10px 15px; /* Original: 10px 15px (was 12px 15px) */
    background-color: #ecfae5; /* Original light green background */
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 500;
    color: var(--text-primary);
    user-select: none;
    transition: background-color 0.2s ease;
    margin: 3px -3px 0 -3px; /* CHANGED: 10px top margin (was -15px) to move header down */
    border-radius: 16px 16px 16px 16px; /* Round top corners to match container */
}

.collapsible-header:hover {
    background-color: #e4efe7; /* Original darker green on hover */
}

.collapsible-header i {
    transition: transform 0.3s ease;
    color: var(--text-secondary);
}

.collapsible.active .collapsible-header i {
    transform: rotate(180deg);
}

/* Active collapsible header styling - when section is expanded */
.collapsible.active .collapsible-header {
    background-color: #ecfae5; /* Stay same green when active */
    transition: none;
    border-radius: 16px 16px 0 0; /* Keep rounded top corners */
}

/* Active collapsible header hover */
.collapsible.active .collapsible-header:hover {
    background-color: #ecfae5; /* Stay same green when active and hovering */
}

.collapsible-content {
    padding: 15px 0 0 0; /* Top padding only, sides handled by container */
    max-height: 0;
    overflow: hidden; /* Original: hidden (was visible) */
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.collapsible.active .collapsible-content {
    padding: 15px 0 0 0; /* Top padding only when expanded */
    max-height: 2000px; /* Original: 2000px (was 500px) - for all content */
    border-top: 1px solid #eee; /* Original border separator */
    overflow: hidden; /* Original: hidden (was visible) */
}

/* ===== CUSTOM SIZE INPUTS - FIXED TO MATCH ORIGINAL ===== */
/* Custom size input container - matches original horizontal layout */
.custom-size-inputs {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

/* Custom size input row - horizontal layout like original */
.custom-size-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.custom-size-row label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0;
}

.custom-size-row input {
    flex: 1;
    padding: var(--input-padding);
    border: 1px solid var(--border-color);
    border-radius: var(--input-radius);
    font-size: 14px;
}

.custom-size-row:last-of-type {
    margin-top: 15px;
}

/* Utility classes for width control */
.w-full {
    width: 100%;
}

.w-1\/2 {
    width: 50%;
}

.w-1\/3 {
    width: 33.333%;
}

.w-2\/3 {
    width: 66.667%;
}

.mt-3 {
    margin-top: 15px;
}

.mt-4 {
    margin-top: 20px;
}

.mb-3 {
    margin-bottom: 15px;
}

.mb-4 {
    margin-bottom: 20px;
}

.ml-2 {
    margin-left: 10px;
}

.mr-2 {
    margin-right: 10px;
}

.mx-2 {
    margin-left: 10px;
    margin-right: 10px;
}

.hidden {
    display: none;
}

.text-center {
    text-align: center;
}

/* ===== WATERMARK INPUT FIELDS - ALWAYS VISIBLE BORDERS ===== */
/* Watermark text input - always visible with subtle border */
#watermark-text {
    border: 0.5px solid #f2f2f2 !important;
    background-color: #ffffff !important;
    padding: 8px 12px !important;
    border-radius: 16px !important;
    font-size: 14px !important;
    width: 100% !important;
    box-sizing: border-box !important;
    transition: border-color 0.2s ease !important;
}

#watermark-text:focus {
    border-color: #d1d5db !important;
    outline: none !important;
    box-shadow: 0 0 0 2px rgba(209, 213, 219, 0.2) !important;
}

#watermark-text:hover {
    border-color: #e5e7eb !important;
}

/* Watermark color picker - always visible with subtle border */
#watermark-color {
    border: 0.5px solid #c0cbe7 !important;
    background-color: #ffffff !important;
    padding: 4px !important;
    border-radius: 16px !important;
    width: 50px !important;
    height: 40px !important;
    cursor: pointer !important;
    transition: border-color 0.2s ease !important;
}

#watermark-color:focus {
    border-color: #d1d5db !important;
    outline: none !important;
    box-shadow: 0 0 0 2px rgba(209, 213, 219, 0.2) !important;
}

#watermark-color:hover {
    border-color: #8fade9 !important;
}

/* Background color picker - same styling for consistency */
#background-color {
    border: 0.5px solid #c0cbe7 !important;
    background-color: #ffffff !important;
    padding: 4px !important;
    border-radius: 16px !important;
    width: 50px !important;
    height: 40px !important;
    cursor: pointer !important;
    transition: border-color 0.2s ease !important;
}

#background-color:focus {
    border-color: #d1d5db !important;
    outline: none !important;
    box-shadow: 0 0 0 2px rgba(209, 213, 219, 0.2) !important;
}

#background-color:hover {
    border-color: #8fade9 !important;
}

/* ===== DISPLAY OPTIONS INPUT FIELDS - CONSISTENT VISIBLE BORDERS ===== */
/* All input fields within Display Options cards should have visible borders */
.more-tweaks-card input[type="text"],
.more-tweaks-card input[type="number"],
.more-tweaks-card input[type="file"],
.more-tweaks-card select {
    border: 0.5px solid #f2f2f2 !important;
    background-color: #ffffff !important;
    padding: 8px 12px !important;
    border-radius: 16px !important;
    font-size: 14px !important;
    transition: border-color 0.2s ease !important;
}

.more-tweaks-card input[type="text"]:focus,
.more-tweaks-card input[type="number"]:focus,
.more-tweaks-card input[type="file"]:focus,
.more-tweaks-card select:focus {
    border-color: #d1d5db !important;
    outline: none !important;
    box-shadow: 0 0 0 2px rgba(209, 213, 219, 0.2) !important;
}

.more-tweaks-card input[type="text"]:hover,
.more-tweaks-card input[type="number"]:hover,
.more-tweaks-card input[type="file"]:hover,
.more-tweaks-card select:hover {
    border-color: #e5e7eb !important;
}

/* Custom pattern input field - ensure it's visible when shown */
#custom-pattern {
    border: 0.5px solid #f2f2f2 !important;
    background-color: #ffffff !important;
    padding: 8px 12px !important;
    border-radius: 16px !important;
    font-size: 14px !important;
    width: 100% !important;
    box-sizing: border-box !important;
    transition: border-color 0.2s ease !important;
}

#custom-pattern:focus {
    border-color: #d1d5db !important;
    outline: none !important;
    box-shadow: 0 0 0 2px rgba(209, 213, 219, 0.2) !important;
}

#custom-pattern:hover {
    border-color: #8fade9 !important;
}

/* ===== TOGGLE SWITCH FOR KEEP ORIGINAL SIZE ===== */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: #4d82d6;
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(26px);
} 