﻿/* ==========================================================
   VALIDATION STYLES - Tooltip Only with Color Options
   ========================================================== */

/* ===== ROOT VARIABLES - CHANGE COLOR HERE ===== */
:root {
    /* Tooltip Colors - Change these to customize */
    --tooltip-bg: #dc3545; /* Background color */
    --tooltip-text: #ffffff; /* Text color */
    --tooltip-border: #dc3545; /* Border color */
    --tooltip-shadow: rgba(220, 53, 69, 0.35); /* Shadow color */
    /* Field Colors */
    --field-valid: #28a745; /* Green for valid */
    --field-invalid: #dc3545; /* Red for invalid */
    --field-warning: #ffc107; /* Yellow for warning */
}

/* ==========================================================
   FIELD STATES
   ========================================================== */

.validation-field {
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

    /* Valid State - Green Tick */
    .validation-field.is-valid {
        border-color: var(--field-valid) !important;
        box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25) !important;
        background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%2328a745' d='M2.3 6.73L.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e") !important;
        background-repeat: no-repeat !important;
        background-position: right calc(0.375em + 0.1875rem) center !important;
        background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem) !important;
        padding-right: calc(1.5em + 0.75rem) !important;
    }

    /* Invalid State - Red Border */
    .validation-field.is-invalid {
        border-color: var(--field-invalid) !important;
        box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25) !important;
        background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='%23dc3545' viewBox='-2 -2 7 7'%3e%3cpath stroke='%23dc3545' d='M0 0l3 3m0-3L0 3'/%3e%3ccircle r='.5'/%3e%3ccircle cx='3' r='.5'/%3e%3ccircle cy='3' r='.5'/%3e%3ccircle cx='3' cy='3' r='.5'/%3e%3c/svg%3E") !important;
        background-repeat: no-repeat !important;
        background-position: right calc(0.375em + 0.1875rem) center !important;
        background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem) !important;
        padding-right: calc(1.5em + 0.75rem) !important;
    }

    /* Warning State */
    .validation-field.is-warning {
        border-color: var(--field-warning) !important;
        box-shadow: 0 0 0 0.2rem rgba(255, 193, 7, 0.25) !important;
    }

/* ==========================================================
   TOOLTIP - CENTERED ABOVE INPUT
   ========================================================== */

.validation-tooltip {
    background: var(--tooltip-bg);
    color: var(--tooltip-text);
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    box-shadow: 0 4px 15px var(--tooltip-shadow);
    max-width: 350px;
    min-width: 180px;
    word-wrap: break-word;
    position: absolute;
    z-index: 99999;
    animation: tooltipSlideDown 0.3s ease;
    pointer-events: auto;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid var(--tooltip-border);
}

    /* Tooltip Arrow - Points down to input */
    .validation-tooltip::after {
        content: '';
        position: absolute;
        bottom: -8px;
        left: 50%;
        transform: translateX(-50%);
        border: 8px solid transparent;
        border-top-color: var(--tooltip-bg);
    }

    /* Tooltip Icon */
    .validation-tooltip .tooltip-icon {
        font-size: 16px;
        flex-shrink: 0;
    }

    /* Tooltip Text */
    .validation-tooltip .tooltip-text {
        flex: 1;
    }

    /* Tooltip Close Button */
    .validation-tooltip .tooltip-close {
        background: none;
        border: none;
        color: rgba(255, 255, 255, 0.8);
        cursor: pointer;
        padding: 0 0 0 8px;
        font-size: 18px;
        line-height: 1;
        transition: color 0.2s, transform 0.2s;
        flex-shrink: 0;
        font-weight: 300;
    }

        .validation-tooltip .tooltip-close:hover {
            color: #ffffff;
            transform: scale(1.2);
        }

/* ==========================================================
   ANIMATIONS
   ========================================================== */

@keyframes tooltipSlideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-100%) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(-100%) scale(1);
    }
}

@keyframes tooltipSlideUp {
    from {
        opacity: 1;
        transform: translateX(-50%) translateY(-100%) scale(1);
    }

    to {
        opacity: 0;
        transform: translateX(-50%) translateY(-100%) scale(0.95);
    }
}

.validation-tooltip.hiding {
    animation: tooltipSlideUp 0.3s ease forwards;
}

/* ==========================================================
   RESPONSIVE
   ========================================================== */

@media (max-width: 768px) {
    .validation-tooltip {
        max-width: 280px;
        min-width: 150px;
        font-size: 12px;
        padding: 6px 12px;
    }

        .validation-tooltip::after {
            bottom: -6px;
            border-width: 6px;
        }
}

@media (max-width: 576px) {
    .validation-tooltip {
        max-width: 220px;
        min-width: 120px;
        font-size: 11px;
        padding: 5px 10px;
        left: 50% !important;
        transform: translateX(-50%) translateY(-100%) !important;
    }

        .validation-tooltip::after {
            bottom: -5px;
            border-width: 5px;
        }

        .validation-tooltip .tooltip-close {
            font-size: 16px;
            padding-left: 6px;
        }
}

/* ==========================================================
   DARK MODE SUPPORT
   ========================================================== */

@media (prefers-color-scheme: dark) {
    :root {
        --tooltip-shadow: rgba(0, 0, 0, 0.5);
    }
}
