/**
 * Neatbase Forms — Stylesheet
 *
 * Clean, minimal, mobile-first design. No framework dependencies.
 * System font stack for native feel across platforms.
 */

/* Reset & Base */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 Helvetica, Arial, sans-serif, "Apple Color Emoji",
                 "Segoe UI Emoji";
    color: #1a1a1a;
    background: #f5f5f7;
    line-height: 1.5;
    min-height: 100vh;
}

/* Layout */

.form-container {
    max-width: 560px;
    margin: 0 auto;
    padding: 40px 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.form-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 4px 16px rgba(0, 0, 0, 0.04);
    overflow: hidden;
    flex: 1 0 auto;
}

/* Header */

.form-header {
    padding: 32px 28px 24px;
    text-align: center;
    border-bottom: 1px solid #f0f0f0;
}

.form-logo {
    max-width: 80px;
    max-height: 80px;
    border-radius: 12px;
    margin-bottom: 16px;
    object-fit: contain;
}

.form-title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #111;
}

.form-description {
    margin-top: 8px;
    color: #666;
    font-size: 0.938rem;
    line-height: 1.6;
}

/* Error state */

.form-error {
    padding: 28px;
    text-align: center;
    color: #666;
    font-size: 0.938rem;
}

/* Form body */

.form-body {
    padding: 24px 28px 28px;
}

/* Form fields */

.form-field {
    margin-bottom: 20px;
}

.form-field label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 6px;
}

.form-field input[type="text"],
.form-field input[type="email"],
.form-field input[type="tel"],
.form-field input[type="url"],
.form-field input[type="number"],
.form-field input[type="date"],
.form-field textarea {
    width: 100%;
    padding: 10px 14px;
    font-size: 0.938rem;
    font-family: inherit;
    border: 1.5px solid #ddd;
    border-radius: 10px;
    background: #fafafa;
    color: #1a1a1a;
    transition: border-color 0.15s, box-shadow 0.15s;
    outline: none;
}

.form-field input:focus,
.form-field textarea:focus {
    border-color: #007aff;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.12);
    background: #fff;
}

.form-field textarea {
    resize: vertical;
    min-height: 80px;
}

.form-field input::placeholder,
.form-field textarea::placeholder {
    color: #aaa;
}

/* Currency input with prefix */

.input-with-prefix {
    display: flex;
    align-items: stretch;
}

.input-prefix {
    display: flex;
    align-items: center;
    padding: 0 12px;
    font-size: 0.938rem;
    font-weight: 600;
    color: #666;
    background: #f0f0f0;
    border: 1.5px solid #ddd;
    border-right: none;
    border-radius: 10px 0 0 10px;
}

.input-with-prefix input {
    border-radius: 0 10px 10px 0 !important;
    flex: 1;
}

/* Star rating */

.star-rating {
    display: flex;
    gap: 4px;
}

.star-rating .star {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: #ddd;
    transition: color 0.1s, transform 0.1s;
    border-radius: 4px;
}

.star-rating .star:hover,
.star-rating .star.active {
    color: #f5a623;
}

.star-rating .star:active {
    transform: scale(0.9);
}

.star-rating .star svg {
    display: block;
    fill: currentColor;
}

/* Toggle switch */

.form-field--toggle {
    margin-bottom: 20px;
}

.toggle-label {
    display: flex !important;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-weight: 500 !important;
}

.toggle-switch {
    position: relative;
    width: 44px;
    height: 26px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: #ddd;
    border-radius: 26px;
    transition: background 0.2s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    left: 3px;
    top: 3px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s;
}

.toggle-switch input:checked + .toggle-slider {
    background: #34c759;
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(18px);
}

.toggle-switch input:focus-visible + .toggle-slider {
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.25);
}

/* Tags */

.tag-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-option {
    cursor: pointer;
}

.tag-option input {
    display: none;
}

.tag-chip {
    display: inline-block;
    padding: 6px 14px;
    font-size: 0.875rem;
    border: 1.5px solid #ddd;
    border-radius: 20px;
    color: #555;
    background: #fafafa;
    transition: all 0.15s;
    user-select: none;
}

.tag-option input:checked + .tag-chip {
    background: #007aff;
    border-color: #007aff;
    color: #fff;
}

.tag-chip:hover {
    border-color: #bbb;
}

/* Image upload */

.image-upload input[type="file"] {
    width: 100%;
    padding: 10px 14px;
    font-size: 0.875rem;
    font-family: inherit;
    border: 1.5px dashed #ddd;
    border-radius: 10px;
    background: #fafafa;
    cursor: pointer;
}

.image-upload input[type="file"]:hover {
    border-color: #bbb;
}

.image-preview {
    margin-top: 10px;
    position: relative;
    display: inline-block;
}

.image-preview img {
    max-width: 100%;
    max-height: 200px;
    border-radius: 8px;
    object-fit: contain;
}

.remove-image {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    background: #ff3b30;
    color: #fff;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Section divider & description */

.section-divider {
    border: none;
    border-top: 1px solid #e5e5e5;
    margin: 24px 0;
}

.section-description {
    color: #888;
    font-size: 0.875rem;
    line-height: 1.6;
    margin-bottom: 16px;
    padding: 0 2px;
}

/* Submit button */

.submit-button {
    display: block;
    width: 100%;
    padding: 14px;
    margin-top: 8px;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    color: #fff;
    background: #007aff;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}

.submit-button:hover {
    background: #0066d6;
}

.submit-button:active {
    transform: scale(0.99);
}

/* Success page */

.success-card {
    text-align: center;
    padding: 48px 28px;
}

.success-icon {
    color: #34c759;
    margin-bottom: 20px;
}

.success-card h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.success-card p {
    color: #666;
    font-size: 0.938rem;
    margin-bottom: 24px;
}

.submit-another-link {
    display: inline-block;
    color: #007aff;
    text-decoration: none;
    font-size: 0.938rem;
    font-weight: 500;
}

.submit-another-link:hover {
    text-decoration: underline;
}

/* Footer */

.form-footer {
    text-align: center;
    padding: 20px 0 8px;
    flex-shrink: 0;
}

.form-footer a {
    color: #999;
    text-decoration: none;
    font-size: 0.813rem;
}

.form-footer a:hover {
    color: #666;
}

/* Dark mode */

@media (prefers-color-scheme: dark) {
    body {
        color: #e5e5e7;
        background: #1c1c1e;
    }

    .form-card {
        background: #2c2c2e;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.2);
    }

    .form-header {
        border-bottom-color: #3a3a3c;
    }

    .form-title {
        color: #f5f5f7;
    }

    .form-description {
        color: #98989d;
    }

    .form-error {
        color: #98989d;
    }

    .form-field label {
        color: #e5e5e7;
    }

    .form-field input[type="text"],
    .form-field input[type="email"],
    .form-field input[type="tel"],
    .form-field input[type="url"],
    .form-field input[type="number"],
    .form-field input[type="date"],
    .form-field textarea {
        border-color: #48484a;
        background: #1c1c1e;
        color: #e5e5e7;
    }

    .form-field input:focus,
    .form-field textarea:focus {
        border-color: #0a84ff;
        box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.2);
        background: #1c1c1e;
    }

    .form-field input::placeholder,
    .form-field textarea::placeholder {
        color: #636366;
    }

    .input-prefix {
        color: #98989d;
        background: #3a3a3c;
        border-color: #48484a;
    }

    .star-rating .star {
        color: #48484a;
    }

    .toggle-slider {
        background: #48484a;
    }

    .tag-chip {
        border-color: #48484a;
        color: #98989d;
        background: #1c1c1e;
    }

    .tag-option input:checked + .tag-chip {
        background: #0a84ff;
        border-color: #0a84ff;
        color: #fff;
    }

    .tag-chip:hover {
        border-color: #636366;
    }

    .image-upload input[type="file"] {
        border-color: #48484a;
        background: #1c1c1e;
        color: #e5e5e7;
    }

    .image-upload input[type="file"]:hover {
        border-color: #636366;
    }

    .section-divider {
        border-top-color: #3a3a3c;
    }

    .section-description {
        color: #636366;
    }

    .success-card p {
        color: #98989d;
    }

    .submit-another-link {
        color: #0a84ff;
    }

    .form-footer a {
        color: #636366;
    }

    .form-footer a:hover {
        color: #98989d;
    }
}

/* Responsive */

@media (max-width: 600px) {
    .form-container {
        padding: 16px 12px;
    }

    .form-header {
        padding: 24px 20px 20px;
    }

    .form-body {
        padding: 20px;
    }

    .form-title {
        font-size: 1.25rem;
    }

    .success-card {
        padding: 36px 20px;
    }
}
