/**
 * Cool FormKit Pro - Frontend Styles
 * All Pro Fields and Interactions
 */

/* ==========================================================================
   1. Range Slider
   ========================================================================== */
.cfl-range-slider-wrap {
    position: relative;
    width: 100%;
    padding: 18px 0 10px 0;
    box-sizing: border-box;
}

.cfl-range-slider-bubble {
    position: absolute;
    top: -12px;
    transform: translateX(-50%);
    background: #0d6efd;
    color: #ffffff;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
    pointer-events: none;
    white-space: nowrap;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: opacity 0.15s ease;
}

.cfl-range-slider-bubble::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 4px 4px 0 4px;
    border-style: solid;
    border-color: #0d6efd transparent transparent transparent;
}

.cfl-range-slider-input {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: #e2e8f0;
    outline: none;
    margin: 10px 0;
    cursor: pointer;
    transition: background 0.2s;
}

.cfl-range-slider-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #0d6efd;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(13, 110, 253, 0.4);
    border: 2px solid #ffffff;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.cfl-range-slider-input::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 3px 8px rgba(13, 110, 253, 0.6);
}

.cfl-range-slider-input::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #0d6efd;
    cursor: pointer;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 6px rgba(13, 110, 253, 0.4);
}

.cfl-range-slider-limits {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #64748b;
    margin-top: 4px;
}

/* ==========================================================================
   2. Star Rating Field
   ========================================================================== */
.cfl-rating-wrap {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    user-select: none;
    padding: 6px 0;
}

.cfl-star-item {
    font-size: 26px;
    color: #cbd5e1;
    transition: color 0.15s ease, transform 0.15s ease;
    cursor: pointer;
    line-height: 1;
}

.cfl-star-item.active,
.cfl-star-item.hovered {
    color: #f59e0b;
}

.cfl-star-item:hover {
    transform: scale(1.2);
}

.cfl-rating-text {
    margin-left: 10px;
    font-size: 14px;
    font-weight: 600;
    color: #475569;
}

/* ==========================================================================
   3. Signature Field
   ========================================================================== */
.cfl-signature-wrap {
    position: relative;
    width: 100%;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    overflow: hidden;
}

.cfl-signature-canvas {
    display: block;
    width: 100%;
    height: 160px;
    cursor: crosshair;
    touch-action: none;
    background: #ffffff;
}

.cfl-signature-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 12px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    font-size: 12px;
    color: #64748b;
}

.cfl-signature-clear {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #475569;
    border-radius: 4px;
    padding: 3px 10px;
    font-size: 11px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.cfl-signature-clear:hover {
    background: #fee2e2;
    border-color: #ef4444;
    color: #b91c1c;
}

/* ==========================================================================
   4. Image Radio & Checkbox
   ========================================================================== */
.cfl-image-choice-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
    width: 100%;
}

.cfl-image-choice-item {
    position: relative;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    background: #ffffff;
    text-align: center;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px;
}

.cfl-image-choice-item:hover {
    border-color: #94a3b8;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.cfl-image-choice-item.is-selected {
    border-color: #0d6efd;
    box-shadow: 0 0 0 1px #0d6efd, 0 4px 12px rgba(13, 110, 253, 0.15);
    background: #f0f7ff;
}

.cfl-image-choice-item input[type="radio"],
.cfl-image-choice-item input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.cfl-image-choice-img {
    width: 100%;
    max-height: 90px;
    object-fit: contain;
    margin-bottom: 8px;
    border-radius: 4px;
}

.cfl-image-choice-label {
    font-size: 13px;
    font-weight: 500;
    color: #1e293b;
    line-height: 1.3;
}

.cfl-image-choice-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 18px;
    height: 18px;
    background: #0d6efd;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 11px;
}

.cfl-image-choice-item.is-selected .cfl-image-choice-badge {
    display: flex;
}

/* ==========================================================================
   5. Radio & Checkbox Stylers (Buttons & Pills)
   ========================================================================== */
.cfl-styled-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.cfl-styled-option {
    position: relative;
    cursor: pointer;
    user-select: none;
}

.cfl-styled-option input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.cfl-style-button-box {
    display: inline-block;
    padding: 8px 16px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #ffffff;
    color: #334155;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.cfl-style-pills .cfl-style-button-box {
    border-radius: 9999px;
    padding: 6px 18px;
}

.cfl-styled-option:hover .cfl-style-button-box {
    border-color: #94a3b8;
    background: #f8fafc;
}

.cfl-styled-option input:checked + .cfl-style-button-box {
    background: #0d6efd;
    color: #ffffff;
    border-color: #0d6efd;
    box-shadow: 0 2px 6px rgba(13, 110, 253, 0.3);
}

/* ==========================================================================
   6. Toggle Switch Field
   ========================================================================== */
.cfl-toggle-wrap {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

.cfl-toggle-switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 24px;
}

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

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

.cfl-toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.cfl-toggle-switch input:checked + .cfl-toggle-slider {
    background-color: #0d6efd;
}

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

.cfl-toggle-label {
    font-size: 14px;
    color: #334155;
    font-weight: 500;
}

/* ==========================================================================
   7. Calculator Field
   ========================================================================== */
.cfl-calc-wrap {
    position: relative;
    width: 100%;
}

.cfl-calc-display {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 10px 14px;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
    min-height: 44px;
    box-sizing: border-box;
}

.cfl-calc-prefix {
    margin-right: 6px;
    color: #64748b;
    font-size: 15px;
}

.cfl-calc-suffix {
    margin-left: 6px;
    color: #64748b;
    font-size: 15px;
}

/* ==========================================================================
   8. Currency Field
   ========================================================================== */
.cfl-currency-wrap {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.cfl-currency-symbol {
    position: absolute;
    left: 12px;
    font-weight: 600;
    color: #64748b;
    pointer-events: none;
    z-index: 2;
}

.cfl-currency-wrap input {
    padding-left: 32px !important;
}

/* ==========================================================================
   9. Confirm Dialog Modal
   ========================================================================== */
.cfl-confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.cfl-confirm-overlay.is-active {
    opacity: 1;
    visibility: visible;
}

.cfl-confirm-dialog {
    background: #ffffff;
    border-radius: 12px;
    width: 90%;
    max-width: 440px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    transform: translateY(20px) scale(0.95);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
    border: 1px solid #f1f5f9;
}

.cfl-confirm-overlay.is-active .cfl-confirm-dialog {
    transform: translateY(0) scale(1);
}

.cfl-confirm-header {
    padding: 20px 24px 12px;
}

.cfl-confirm-title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.3;
}

.cfl-confirm-body {
    padding: 0 24px 20px;
    font-size: 14px;
    color: #64748b;
    line-height: 1.5;
}

.cfl-confirm-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 14px 24px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
}

.cfl-confirm-btn {
    padding: 9px 18px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.cfl-confirm-btn-cancel {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #475569;
}

.cfl-confirm-btn-cancel:hover {
    background: #f1f5f9;
    color: #1e293b;
}

.cfl-confirm-btn-confirm {
    background: #0d6efd;
    color: #ffffff;
}

.cfl-confirm-btn-confirm:hover {
    background: #0b5ed7;
}

/* ==========================================================================
   10. Conditional Submit Button
   ========================================================================== */
.cfl-submit-disabled {
    opacity: 0.5 !important;
    pointer-events: none !important;
    cursor: not-allowed !important;
}

/* ==========================================================================
   11. WYSIWYG Editor Field
   ========================================================================== */
.cfl-wysiwyg-wrap {
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    overflow: hidden;
    background: #ffffff;
}

.cfl-wysiwyg-toolbar {
    display: flex;
    gap: 4px;
    padding: 6px 8px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.cfl-wysiwyg-btn {
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
}

.cfl-wysiwyg-btn:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.cfl-wysiwyg-editor {
    min-height: 120px;
    padding: 10px;
    outline: none;
    font-size: 14px;
    line-height: 1.5;
    color: #1e293b;
}
