/* ================= MODAL ================= */
.form-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.55);
    z-index: 1000;
}

.form-modal.hidden {
    display: none;
}

body.modal-open {
    overflow: hidden;
}

/* ================= CONTAINER ================= */
.form-container {
    width: min(520px, 100%);
    margin: 0 auto;

    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18) !important;

    display: flex;
    flex-direction: column;

    max-height: 90vh;   /* THIS is what triggers scrolling */
    overflow-y: auto;   /* Enables vertical scroll */

    flex-shrink: 0;
}

/* ================= HEADER ================= */
.form-header {
    background: #1d3c78;
    color: #fff;
    padding: 14px;
    text-align: center;
    position: relative;
}

.form-header h2 {
    margin: 0;
    font-size: 1.2rem;
}

/* ================= CLOSE BUTTON ================= */
.form-close-btn {
    position: absolute;
    right: 10px;
    top: 10px;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 4px;
    background: #e74c3c;
    color: #fff;
    cursor: pointer;
}

/* ================= FORM ================= */
.form-container form {
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 20px;
}

/* ================= INPUT GROUP ================= */
.form-group {
    position: relative;
    width: 100%;
}

.form-group input {
    width: 100%;
    padding: 14px 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    outline: none;
    box-sizing: border-box;
    transition: 0.2s;

    background-color: #fff;
}

/* FOCUS STATE */
.form-group input:focus {
    border-color: #1d3c78;
    background-color: #eef4ff;
}

/* FILLED STATE (THIS WAS MISSING) */
.form-group input:not(:placeholder-shown) {
    background-color: #eef4ff;
    border-color: #1d3c78;
}

/* AUTOFILL FIX (Chrome) */
.form-group input:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 1000px #eef4ff inset !important;
    -webkit-text-fill-color: #000 !important;
}

/* AUTOFILL + FOCUS */
.form-group input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px #eef4ff inset !important;
}

/* ================= FLOAT LABEL ================= */
.form-group label {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.9rem;
    color: #666;
    pointer-events: none;
    transition: 0.2s;
}

.form-group input:focus + label,
.form-group input:not(:placeholder-shown) + label {
    top: -8px;
    font-size: 0.75rem;
    padding: 0 4px;
    color: #1d3c78;
}

/* ================= BRANDING TYPE DROPDOWN ================= */
.branding-type-selector select {
    width: 100%;
    padding: 14px 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: #fff;
    font-size: 1rem;
    color: #333;
    outline: none;
    box-sizing: border-box;
    transition: 0.2s;

    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

.branding-type-selector {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* focus state */
.branding-type-selector select:focus {
    border-color: #1d3c78;
}


/* ================= BUTTON ================= */
.button-group {
    display: flex;
    justify-content: center;
}

.button.primary {
    width: 100%;
    padding: 12px;
    border: 2px solid #1d3c78;
    border-radius: 8px;
    background: #1d3c78;
    color: #fff;
    cursor: pointer;
    font-weight: 600;
    transition: 0.2s ease;
}

.button.primary:hover {
    background: white;
    color: #1d3c78;
}
/* ================= FLASH ================= */
.flash-message-container {
    padding: 10px 20px 0;
    margin-bottom: 8px;     /* space above first input field for msg */
}

.flash-message {
    padding: 14px 18px;
    border-radius: 6px;
    font-size: 15px;
    color: #fff;
    margin-bottom: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    transition: 0.4s;
}

.flash-success { background: #28a745; }
.flash-error { background: #dc3545; }
.flash-info { background: #007bff; }

.flash-fade-out {
    opacity: 0;
    transform: translateY(-6px);
}


/* ================= RESPONSIVE ================= */
@media (max-width: 576px) {
    .form-container {
        margin: 0;
    }
}

/* =========================================================================
   WIDGET VARIANTS
   These rules ONLY trigger when the 'widget' class is added.
   They allow forms and tables to sit naturally in the dashboard.
   ========================================================================= */

/* For Forms */
.form-container.widget {
    margin: 20px auto !important;
    position: relative !important;
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: min(600px, 95%);
}

/* For Tables/Workspaces */
.table-block.widget {
    margin: 20px auto !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: min(600px, 95%);
}
