/* Smart Forms – Frontend Styles */

.sf-form-wrap { max-width: 800px; }

/* ── Grid system ── */
.sf-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px 20px;
    align-items: start;
}

/* Column span classes */
.sf-col-full  { grid-column: span 3; }
.sf-col-half  { grid-column: span 2; }  /* ~2/3 in a 3-col grid (closest to "half") */
.sf-col-third { grid-column: span 1; }

/* Layout overrides via wrapper class */
.sf-layout-1col .sf-grid .sf-field-wrap { grid-column: span 3 !important; }

.sf-layout-2col .sf-grid .sf-col-full   { grid-column: span 2 !important; }
.sf-layout-2col .sf-grid .sf-col-half   { grid-column: span 1 !important; }
.sf-layout-2col .sf-grid .sf-col-third  { grid-column: span 1 !important; }
.sf-layout-2col .sf-grid               { grid-template-columns: repeat(2, 1fr); }

.sf-layout-3col .sf-grid .sf-col-full   { grid-column: span 3 !important; }
.sf-layout-3col .sf-grid .sf-col-half   { grid-column: span 1 !important; }
.sf-layout-3col .sf-grid .sf-col-third  { grid-column: span 1 !important; }

/* Submit and messages always span full width */
.sf-submit-wrap  { grid-column: span 3 !important; }
.sf-messages     { grid-column: span 3 !important; }

/* ── Field styling ── */
.sf-field-wrap { display: flex; flex-direction: column; gap: 5px; }

.sf-form label {
    font-weight: 600;
    font-size: 14px;
    color: #3c434a;
    display: block;
}

.sf-form input[type="text"],
.sf-form input[type="email"],
.sf-form input[type="number"],
.sf-form input[type="tel"],
.sf-form input[type="url"],
.sf-form input[type="date"],
.sf-form input[type="time"],
.sf-form select,
.sf-form textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid #d1d5db;
    border-radius: 6px;
    font-size: 15px;
    box-sizing: border-box;
    font-family: inherit;
    background: #fff;
    color: #1a1a1a;
    transition: border-color .2s, box-shadow .2s;
}

.sf-form input:focus,
.sf-form select:focus,
.sf-form textarea:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 3px rgba(34,113,177,.12);
}

.sf-form textarea { resize: vertical; }

/* Radio / checkbox groups */
.sf-radio-group, .sf-checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    padding: 4px 0;
}

.sf-form .sf-inline-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: normal;
    cursor: pointer;
    font-size: 14px;
}

.sf-required { color: #dc2626; margin-left: 2px; }

/* ── Submit button ── */
.sf-submit-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-top: 4px;
}

.sf-submit-btn {
    padding: 11px 32px;
    background: #2271b1;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s, transform .1s;
    font-family: inherit;
}

.sf-submit-btn:hover   { background: #135e96; }
.sf-submit-btn:active  { transform: scale(.98); }
.sf-submit-btn:disabled { opacity: .6; cursor: not-allowed; }

/* ── Spinner ── */
.sf-spinner {
    display: inline-block;
    width: 18px; height: 18px;
    border: 3px solid #ddd;
    border-top-color: #2271b1;
    border-radius: 50%;
    animation: sf-spin .65s linear infinite;
    flex-shrink: 0;
}
@keyframes sf-spin { to { transform: rotate(360deg); } }

/* ── Messages ── */
.sf-messages { margin-top: 4px; font-size: 14px; }

.sf-msg-success {
    color: #166534; background: #dcfce7;
    border: 1px solid #bbf7d0;
    padding: 12px 16px; border-radius: 6px;
}

.sf-msg-error {
    color: #991b1b; background: #fee2e2;
    border: 1px solid #fecaca;
    padding: 12px 16px; border-radius: 6px;
}

/* ── Responsive: stack to 1 column on mobile ── */
@media (max-width: 600px) {
    .sf-grid { grid-template-columns: 1fr !important; }
    .sf-field-wrap { grid-column: span 1 !important; }
    .sf-submit-wrap, .sf-messages { grid-column: span 1 !important; }
}

/* ── File Upload Drop Zone ── */
.sf-file-drop-zone {
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    background: #f9fafb;
    cursor: pointer;
    transition: border-color .2s, background .2s;
    overflow: hidden;
    position: relative;
}
.sf-file-drop-zone:hover,
.sf-file-drop-zone.sf-drag-over {
    border-color: #2271b1;
    background: #f0f6fc;
}
.sf-file-drop-zone.sf-zone-error {
    border-color: #dc2626;
    background: #fef2f2;
}

/* Wrapper that overlays the entire drop zone so the native input captures all clicks */
.sf-file-input-wrap {
    position: absolute;
    inset: 0;
    z-index: 2;
    opacity: 0;
    overflow: hidden;
}

/* The actual file input fills the wrapper completely */
.sf-file-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    font-size: 0; /* hides any text label */
}

.sf-file-ui {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    gap: 6px;
    text-align: center;
    pointer-events: none;
    position: relative;
    z-index: 1;
}
.sf-file-icon { font-size: 28px; line-height: 1; }
.sf-file-text { font-size: 14px; font-weight: 600; color: #374151; }
.sf-file-hint { font-size: 12px; color: #9ca3af; }

/* File preview chips */
.sf-file-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 10px 10px;
}
.sf-file-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #e8f4fd;
    border: 1px solid #b8d9f5;
    border-radius: 20px;
    padding: 4px 10px 4px 8px;
    font-size: 12px;
    max-width: 100%;
}
.sf-file-chip-error {
    background: #fee2e2;
    border-color: #fca5a5;
}
.sf-fc-icon  { font-size: 14px; flex-shrink: 0; }
.sf-fc-name  { font-weight: 600; color: #1e40af; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 160px; }
.sf-file-chip-error .sf-fc-name { color: #991b1b; }
.sf-fc-size  { color: #6b7280; white-space: nowrap; }
.sf-fc-err   { color: #dc2626; font-weight: 600; white-space: nowrap; }
