/* ============================================
   common-form.css — Inputs, Textarea, Checkbox & Radio
   ============================================ */

/* ------------------------------
   Root variables (reuse from common.css)
------------------------------ */
:root {
    --color-primary: #ff751f;
    --color-success: #00bf63;
    --color-error: #ff3131;
    --color-warning: #ffcc00;
    --color-info: #38b6ff;
    --color-dark: #192850;
    --color-white: #fff;
    --color-black: #000;

    --radius: 8px;
    --transition: all 0.25s ease;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
}

/* ------------------------------
   Form Container
------------------------------ */
.form-group {
    position: relative;
    margin-bottom: var(--space-lg);
    width: 100%;
}

/* ------------------------------
   Inputs & Textarea Base
------------------------------ */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="url"],
textarea,
select {
    width: 100%;
    padding: 14px 12px;
    border: 1px solid #ccc;
    border-radius: var(--radius);
    outline: none;
    font-size: 1rem;
    background-color: var(--color-white);
    transition: all 0.25s ease;
}

/* ------------------------------
   Floating Labels
------------------------------ */
input:focus+label,
textarea:focus+label,
input:not(:placeholder-shown)+label,
textarea:not(:placeholder-shown)+label {
    top: -8px;
    left: 12px;
    font-size: 0.8rem;
    color: var(--color-primary);
    background-color: var(--color-white);
    padding: 0 4px;
}

.form-group label {
    position: absolute;
    top: 14px;
    left: 12px;
    font-size: 1rem;
    color: #999;
    pointer-events: none;
    transition: all 0.25s ease;
    background-color: transparent;
}

/* ------------------------------
   Focus & Hover
------------------------------ */
input:focus,
textarea:focus,
select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

/* ------------------------------
   Disabled / Readonly
------------------------------ */
input:disabled,
textarea:disabled,
select:disabled {
    background-color: #f4f4f4;
    cursor: not-allowed;
}

/* ------------------------------
   Error & Success States
------------------------------ */
input.error,
textarea.error,
select.error {
    border-color: var(--color-error);
}

input.success,
textarea.success,
select.success {
    border-color: var(--color-success);
}

/* ------------------------------
   Textarea specific
------------------------------ */
textarea {
    min-height: 100px;
    resize: vertical;
}

/* ------------------------------
   Select Styling
------------------------------ */
select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 30px;
    background-image: url("data:image/svg+xml;utf8,<svg fill='%23999' height='24' viewBox='0 0 24 24' width='24' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px 16px;
}

/* ------------------------------
   Form Utility
------------------------------ */
.form-group .helper-text {
    font-size: 0.85rem;
    color: #666;
    margin-top: 4px;
}

/* ------------------------------
   Placeholder support for floating label
------------------------------ */
input::placeholder,
textarea::placeholder {
    color: transparent;
}

/* ------------------------------
   Checkbox Styling
------------------------------ */
.checkbox-group {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.checkbox-group input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid #ccc;
    border-radius: 4px;
    position: relative;
    cursor: pointer;
    transition: all 0.25s ease;
}

.checkbox-group input[type="checkbox"]:checked {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
}

.checkbox-group input[type="checkbox"]:checked::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 6px;
    width: 4px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* ------------------------------
   Radio Button Styling
------------------------------ */
.radio-group {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.radio-group input[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid #ccc;
    border-radius: 50%;
    position: relative;
    cursor: pointer;
    transition: all 0.25s ease;
}

.radio-group input[type="radio"]:checked {
    border-color: var(--color-primary);
    background-color: var(--color-primary);
}

.radio-group input[type="radio"]:checked::after {
    content: "";
    position: absolute;
    top: 5px;
    left: 5px;
    width: 8px;
    height: 8px;
    background-color: #fff;
    border-radius: 50%;
}
