/*
 * veyra-forms.css
 * Shared design system for all modal forms in frontend tenant.
 * Class prefix: vf-  (veyra-forms)
 */

/* ── Container ── */
.vf-container {
    font-family: "Plus Jakarta Sans", sans-serif;
}

/* ── Form Labels ── */
.vf-container .form-label {
    font-weight: 600;
    font-size: 12px;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 5px;
}

/* ── Form Controls ── */
.vf-container .form-control {
    border-radius: 10px;
    border: 1.5px solid #e2e8f0;
    background: #f8fafc;
    padding: 10px 14px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.vf-container .form-control:focus {
    background: #fff;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.vf-container .form-control::placeholder {
    color: #a0aec0;
    font-weight: 400;
}

/* ── Input Group Addons ── */
.vf-container .input-group-text {
    background: #f1f5f9;
    border: 1.5px solid #e2e8f0;
    border-right: none;
    color: #6366f1;
    font-size: 14px;
    padding: 10px 12px;
    border-radius: 10px 0 0 10px;
}

.vf-container .input-group .form-control {
    border-left: none;
    border-radius: 0 10px 10px 0;
}

.vf-container .input-group .form-control:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

/* ── Quill Editor Styles ── */
.vf-container .ql-toolbar.ql-snow {
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
    border: 1.5px solid #e2e8f0;
    background: #f8fafc;
}

.vf-container .ql-container.ql-snow {
    border-bottom-left-radius: 10px;
    border-bottom-right-radius: 10px;
    border: 1.5px solid #e2e8f0 !important;
    background: #fff;
}

/* ── Section Cards ── */
.vf-section-card {
    background: #ffffff;
    border: 1px solid #e8edf8;
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.02);
    margin-bottom: 16px;
    overflow: hidden;
    animation: vf-slideUp 0.4s ease both;
}

.vf-section-card:nth-child(1) { animation-delay: 0s; }
.vf-section-card:nth-child(2) { animation-delay: 0.08s; }
.vf-section-card:nth-child(3) { animation-delay: 0.16s; }

@keyframes vf-slideUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.vf-section-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 22px;
    background: linear-gradient(135deg, #fafbff 0%, #f5f3ff 100%);
    border-bottom: 1px solid #eef2ff;
}

.vf-section-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.vf-icon-indigo {
    background: #eef2ff;
    color: #6366f1;
    border: 1px solid #c7d2fe;
}

.vf-icon-emerald {
    background: #ecfdf5;
    color: #10b981;
    border: 1px solid #a7f3d0;
}

.vf-icon-amber {
    background: #fffbeb;
    color: #f59e0b;
    border: 1px solid #fde68a;
}

.vf-icon-rose {
    background: #fff1f2;
    color: #f43f5e;
    border: 1px solid #fecdd3;
}

.vf-icon-sky {
    background: #f0f9ff;
    color: #0ea5e9;
    border: 1px solid #bae6fd;
}

.vf-section-header .vf-section-title {
    font-size: 14px;
    font-weight: 800;
    color: #1e293b;
    letter-spacing: -0.01em;
}

.vf-section-header .vf-section-subtitle {
    font-size: 11.5px;
    color: #94a3b8;
    margin-top: 2px;
    font-weight: 500;
}

.vf-section-body {
    padding: 20px 22px 22px;
}

/* Legacy section title style (used by h6.vf-section-title in older forms) */
h6.vf-section-title {
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #6366f1;
    border-bottom: 1px solid #eef2ff;
    padding-bottom: 8px;
    margin-top: 20px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ── Identity Row (Avatar + Fields) ── */
.vf-identity-row {
    display: flex;
    gap: 24px;
    align-items: flex-start;
    padding-bottom: 12px;
    margin-bottom: 4px;
    border-bottom: 1px solid #f1f5f9;
}

.vf-avatar-upload {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.vf-avatar-preview {
    width: 96px;
    height: 96px;
    border-radius: 20px;
    overflow: hidden;
    position: relative;
    background: linear-gradient(135deg, #eef2ff, #f5f3ff);
    border: 2px solid #c7d2fe;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.vf-avatar-preview:hover .vf-avatar-overlay {
    opacity: 1;
}

.vf-avatar-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.vf-avatar-initials {
    font-size: 28px;
    font-weight: 800;
    color: #6366f1;
    font-family: "DM Sans", sans-serif;
    line-height: 1;
    user-select: none;
}

.vf-avatar-overlay {
    position: absolute;
    inset: 0;
    background: rgba(99, 102, 241, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
    border-radius: 18px;
}

.vf-avatar-overlay i {
    color: #fff;
    font-size: 24px;
}

.vf-avatar-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.vf-avatar-info .form-group {
    margin-bottom: 0;
}

.vf-avatar-info .file-input {
    display: flex;
    justify-content: center;
}

.vf-avatar-hint {
    font-size: 10px;
    color: #94a3b8;
    font-weight: 500;
    margin-top: -2px;
}

.vf-identity-fields {
    flex: 1;
    min-width: 0;
}

/* ── Bootstrap Switch Override ── */
.vf-container .bootstrap-switch {
    border-radius: 10px;
    border-color: #e2e8f0;
}

.vf-container .bootstrap-switch .bootstrap-switch-handle-on,
.vf-container .bootstrap-switch .bootstrap-switch-handle-off {
    font-size: 11px;
    font-weight: 700;
}

/* ── Select2 Dropdown Override ── */
.vf-container .select2-container--krajee .select2-selection {
    border-radius: 10px !important;
    border: 1.5px solid #e2e8f0 !important;
    background: #f8fafc !important;
    min-height: 42px;
    padding: 4px 12px;
    transition: all 0.2s ease;
}

.vf-container .select2-container--krajee.select2-container--focus .select2-selection {
    border-color: #6366f1 !important;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12) !important;
    background: #fff !important;
}

.vf-container .select2-container--krajee .select2-selection__placeholder {
    color: #a0aec0;
    font-weight: 400;
}

.vf-container .select2-container--krajee .select2-selection__rendered {
    font-size: 14px;
    font-weight: 500;
    color: #1e293b;
    padding-left: 0;
}

/* ── DateControl Override ── */
.vf-container .form-control[date-control] {
    border-radius: 10px;
}

.vf-container .input-group.date .input-group-addon {
    background: #f1f5f9;
    border: 1.5px solid #e2e8f0;
    color: #6366f1;
}

/* ── FileInput Override ── */
.vf-container .file-input .btn-soft-primary {
    background: #eef2ff;
    color: #6366f1;
    border: 1px solid #c7d2fe;
    border-radius: 10px;
    font-weight: 600;
    font-size: 12px;
    padding: 6px 14px;
    transition: all 0.15s;
}

.vf-container .file-input .btn-soft-primary:hover {
    background: #e0e7ff;
    border-color: #a5b4fc;
}

.vf-container .file-input .kv-fileinput-caption {
    display: none;
}

/* ── Dropdown Override ── */
.vf-container .form-select,
.vf-container select.form-control {
    border-radius: 10px;
    border: 1.5px solid #e2e8f0;
    background: #f8fafc;
    padding: 10px 14px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.vf-container .form-select:focus,
.vf-container select.form-control:focus {
    background: #fff;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

/* ── Modal Footer in Forms ── */
.vf-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid #f1f5f9;
}

.vf-btn-cancel {
    border-radius: 10px;
    font-weight: 600;
    font-size: 13px;
    padding: 9px 22px;
    border: 1px solid #e2e8f0;
    color: #64748b;
    transition: all 0.15s;
}

.vf-btn-cancel:hover {
    background: #f1f5f9;
    color: #334155;
    border-color: #cbd5e1;
}

.vf-btn-save {
    border-radius: 10px;
    font-weight: 700;
    font-size: 13px;
    padding: 9px 24px;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    border: none;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
    transition: all 0.2s;
    letter-spacing: -0.01em;
}

.vf-btn-save:hover {
    background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
    transform: translateY(-1px);
}

.vf-btn-save:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

/* ── Custom Toggle Switch ── */
.vf-toggle {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
    cursor: pointer;
}
.vf-toggle input,
.vf-toggle-input {
    opacity: 0;
    width: 0;
    height: 0;
}
.vf-toggle-slider {
    position: absolute;
    inset: 0;
    background: #e2e8f0;
    border-radius: 26px;
    transition: .25s;
}
.vf-toggle-slider::before {
    content: '';
    position: absolute;
    left: 3px;
    bottom: 3px;
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 50%;
    transition: .25s;
    box-shadow: 0 1px 3px rgba(0,0,0,.15);
}
.vf-toggle input:checked + .vf-toggle-slider,
.vf-toggle-input:checked + .vf-toggle-slider {
    background: #10b981;
}
.vf-toggle input:checked + .vf-toggle-slider::before,
.vf-toggle-input:checked + .vf-toggle-slider::before {
    transform: translateX(22px);
}

/* ── Field Validation States ── */
.vf-container .has-success .form-control,
.vf-container .has-success .form-control:focus {
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.vf-container .has-error .form-control,
.vf-container .has-error .form-control:focus {
    border-color: #f43f5e;
    box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.1);
}

.vf-container .has-error .help-block {
    font-size: 11px;
    color: #f43f5e;
    font-weight: 600;
    margin-top: 4px;
}

/* ── Textarea Override ── */
.vf-container textarea.form-control {
    border-radius: 10px;
    resize: vertical;
    min-height: 60px;
}

/* ── Debug Toolbar Safety Padding ── */
/* Prevents Yii debug toolbar from obscuring modal footer on short viewports */
.modal-dialog-scrollable .modal-body {
    padding-bottom: 60px;
}

/* ── Responsive ── */
@media (max-width: 576px) {
    .vf-identity-row {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .vf-identity-fields {
        width: 100%;
    }

    .vf-section-header {
        padding: 14px 16px;
    }

    .vf-section-body {
        padding: 16px;
    }

    .vf-section-header .vf-section-title {
        font-size: 13px;
    }
}