/* aform — warm editorial aesthetic */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=DM+Serif+Display&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    --stone-950: #0c0a09;
    --stone-900: #1c1917;
    --stone-800: #292524;
    --stone-700: #44403c;
    --stone-600: #57534e;
    --stone-500: #78716c;
    --stone-400: #a8a29e;
    --stone-300: #d6d3d1;
    --stone-200: #e7e5e4;
    --stone-100: #f5f5f4;
    --stone-50: #fafaf9;
    --cream: #fdfcfa;

    --coral-600: #e54d2e;
    --coral-500: #f76b4a;
    --coral-100: #fff1ee;
    --coral-50: #fff8f6;

    --teal-700: #0f766e;
    --teal-600: #0d9488;
    --teal-100: #ccfbf1;
    --teal-50: #f0fdfa;

    --amber-600: #d97706;
    --amber-100: #fef3c7;

    --red-600: #dc2626;
    --red-100: #fee2e2;
    --red-50: #fef2f2;

    --blue-700: #1d4ed8;
    --blue-100: #dbeafe;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;

    --shadow-sm: 0 1px 2px rgba(28, 25, 23, 0.04);
    --shadow-md: 0 2px 8px rgba(28, 25, 23, 0.06), 0 1px 2px rgba(28, 25, 23, 0.04);
    --shadow-lg: 0 8px 24px rgba(28, 25, 23, 0.08), 0 2px 6px rgba(28, 25, 23, 0.04);
    --shadow-xl: 0 16px 48px rgba(28, 25, 23, 0.1), 0 4px 12px rgba(28, 25, 23, 0.05);
}

/* ── Reset ── */

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

/* ── Base ── */

body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 15px;
    line-height: 1.65;
    color: var(--stone-800);
    background: var(--stone-100);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4 {
    font-family: 'DM Serif Display', Georgia, serif;
    font-weight: 400;
    line-height: 1.25;
    color: var(--stone-900);
}

/* ── Animations ── */

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

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.97); }
    to { opacity: 1; transform: scale(1); }
}

.anim-fade-up {
    animation: fadeUp 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.anim-delay-1 { animation-delay: 0.06s; }
.anim-delay-2 { animation-delay: 0.12s; }
.anim-delay-3 { animation-delay: 0.18s; }
.anim-delay-4 { animation-delay: 0.24s; }

/* ── Container ── */

.container {
    max-width: 880px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem 4rem;
}

/* ── Navigation ── */

.admin-nav {
    background: var(--stone-900);
    padding: 0 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 56px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 0 rgba(255,255,255,0.04);
}

.nav-brand {
    font-family: 'DM Serif Display', Georgia, serif;
    color: #fff;
    text-decoration: none;
    font-size: 1.3rem;
    letter-spacing: -0.01em;
    transition: opacity 0.2s;
}

.nav-brand:hover {
    opacity: 0.8;
}

.nav-accent {
    color: var(--coral-500);
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-email {
    color: var(--stone-400);
    font-size: 0.8rem;
    font-weight: 400;
    letter-spacing: 0.01em;
}

.nav-btn {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.75rem;
    background: rgba(255,255,255,0.08);
    color: var(--stone-300);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 500;
    transition: all 0.15s;
    text-decoration: none;
}

.nav-btn:hover {
    background: rgba(255,255,255,0.14);
    color: #fff;
}

/* ── Buttons ── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.55rem 1.1rem;
    background: #fff;
    color: var(--stone-700);
    border: 1px solid var(--stone-200);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.15s ease;
    box-shadow: var(--shadow-sm);
    line-height: 1.4;
}

.btn:hover {
    background: var(--stone-50);
    border-color: var(--stone-300);
    box-shadow: var(--shadow-md);
}

.btn-primary {
    background: var(--coral-600);
    color: #fff;
    border-color: var(--coral-600);
    box-shadow: var(--shadow-sm), 0 1px 2px rgba(229, 77, 46, 0.15);
}

.btn-primary:hover {
    background: #d4442a;
    border-color: #d4442a;
    box-shadow: var(--shadow-md), 0 2px 8px rgba(229, 77, 46, 0.2);
    transform: translateY(-1px);
}

.btn-danger {
    background: #fff;
    color: var(--red-600);
    border-color: var(--red-100);
}

.btn-danger:hover {
    background: var(--red-50);
    border-color: var(--red-600);
}

.btn-warning {
    background: var(--amber-600);
    color: #fff;
    border-color: var(--amber-600);
}

.btn-warning:hover {
    background: #c2690b;
    border-color: #c2690b;
    transform: translateY(-1px);
}

.btn-sm {
    padding: 0.3rem 0.65rem;
    font-size: 0.78rem;
    font-weight: 500;
}

.btn-full {
    width: 100%;
    padding: 0.7rem 1rem;
}

.btn-ghost {
    background: transparent;
    border-color: transparent;
    box-shadow: none;
    color: var(--stone-500);
}

.btn-ghost:hover {
    background: var(--stone-100);
    color: var(--stone-700);
    box-shadow: none;
}

/* ── Form Controls ── */

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--stone-700);
    letter-spacing: 0.01em;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.6rem 0.8rem;
    background: #fff;
    border: 1px solid var(--stone-200);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--stone-800);
    transition: all 0.15s;
    box-shadow: var(--shadow-sm);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--coral-500);
    box-shadow: 0 0 0 3px rgba(229, 77, 46, 0.08);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--stone-400);
}

.form-group textarea {
    resize: vertical;
    line-height: 1.6;
}

.form-group select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2378716c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.2rem;
}

.form-row {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.form-row .form-group { flex: 1; }

.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: 400;
    font-size: 0.85rem;
    color: var(--stone-600);
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--coral-600);
    cursor: pointer;
}

/* ── Cards ── */

.card {
    background: #fff;
    border: 1px solid var(--stone-200);
    border-radius: var(--radius-md);
    padding: 1.75rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
    position: relative;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--stone-200);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.card h3 {
    font-size: 1.15rem;
    margin-bottom: 1.25rem;
    color: var(--stone-900);
}

.card-accent::before {
    background: var(--coral-600);
}

.card-danger {
    border-color: rgba(220, 38, 38, 0.15);
}

.card-danger::before {
    background: var(--red-600);
}

.card-danger h3 {
    color: var(--red-600);
}

.card-danger p {
    color: var(--stone-500);
    font-size: 0.87rem;
    margin-bottom: 1rem;
}

/* ── Tables ── */

.table-wrap {
    background: #fff;
    border: 1px solid var(--stone-200);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 0.8rem 1.1rem;
    text-align: left;
    border-bottom: 1px solid var(--stone-100);
}

.table th {
    background: var(--stone-50);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--stone-500);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--stone-200);
}

.table tbody tr {
    transition: background 0.1s;
}

.table tbody tr:hover {
    background: var(--stone-50);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table td {
    font-size: 0.88rem;
    color: var(--stone-700);
}

.table .actions-cell {
    display: flex;
    gap: 0.4rem;
}

/* ── Badges ── */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.6rem;
    border-radius: 100px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    border: 1px solid transparent;
}

.badge-green {
    background: var(--teal-50);
    color: var(--teal-700);
    border-color: var(--teal-100);
}

.badge-gray {
    background: var(--stone-100);
    color: var(--stone-500);
    border-color: var(--stone-200);
}

.badge-blue {
    background: var(--blue-100);
    color: var(--blue-700);
    border-color: rgba(29, 78, 216, 0.15);
}

.badge-red {
    background: var(--coral-100);
    color: var(--coral-600);
    border-color: rgba(229, 77, 46, 0.15);
}

.badge-amber {
    background: var(--amber-100);
    color: var(--amber-600);
}

/* ── Alerts ── */

.alert {
    padding: 0.8rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.25rem;
    font-size: 0.87rem;
    font-weight: 500;
}

.alert-error {
    background: var(--red-50);
    color: var(--red-600);
    border: 1px solid var(--red-100);
}

/* ── Layout Helpers ── */

.header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.header-row h2 {
    font-size: 1.6rem;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--stone-400);
    font-size: 0.92rem;
}

.empty-state-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    opacity: 0.5;
    display: block;
}

hr {
    border: none;
    border-top: 1px solid var(--stone-200);
    margin: 1.75rem 0;
}

code {
    font-family: 'JetBrains Mono', monospace;
    background: var(--stone-100);
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    font-size: 0.8rem;
    color: var(--stone-600);
    border: 1px solid var(--stone-200);
}

/* ── Login Page ── */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--cream);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    top: -200px;
    right: -200px;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(229, 77, 46, 0.04) 0%, transparent 70%);
    pointer-events: none;
}

.login-page::after {
    content: '';
    position: absolute;
    bottom: -150px;
    left: -150px;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(15, 118, 110, 0.03) 0%, transparent 70%);
    pointer-events: none;
}

.login-card {
    width: 100%;
    max-width: 420px;
    padding: 2.75rem;
    background: #fff;
    border-radius: var(--radius-lg);
    border: 1px solid var(--stone-200);
    box-shadow: var(--shadow-lg);
    position: relative;
    animation: scaleIn 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.login-brand {
    text-align: center;
    margin-bottom: 2.25rem;
}

.login-brand h1 {
    font-family: 'DM Serif Display', Georgia, serif;
    font-size: 2.2rem;
    color: var(--stone-900);
    letter-spacing: -0.02em;
}

.login-brand h1 span {
    color: var(--coral-600);
}

.login-brand p {
    color: var(--stone-400);
    font-size: 0.87rem;
    margin-top: 0.25rem;
}

.login-card .btn-primary {
    margin-top: 0.5rem;
    padding: 0.7rem;
    font-size: 0.92rem;
}

/* ── Dashboard ── */

.form-card-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* ── Form Builder ── */

.page-title {
    font-size: 1.6rem;
    color: var(--stone-900);
}

.page-subtitle {
    font-size: 0.9rem;
    color: var(--stone-400);
    margin-top: 0.15rem;
    font-family: 'DM Sans', sans-serif;
    font-weight: 400;
}

/* ── Questions ── */

.question-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-bottom: 1.5rem;
}

.question-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0.85rem 1rem;
    background: var(--stone-50);
    border-radius: var(--radius-sm);
    border: 1px solid var(--stone-200);
    transition: all 0.15s;
}

.question-item:hover {
    border-color: var(--stone-300);
    box-shadow: var(--shadow-sm);
}

.question-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    flex: 1;
}

.question-info strong {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--stone-800);
}

.question-options {
    width: 100%;
    font-size: 0.78rem;
    color: var(--stone-400);
    margin-top: 0.3rem;
    font-style: italic;
}

.question-number {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    color: var(--stone-400);
    min-width: 1.5rem;
    height: 1.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--stone-200);
    border-radius: 4px;
    font-weight: 500;
}

.add-question-section {
    padding-top: 1.25rem;
}

.add-question-section h4 {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--stone-600);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 1rem;
}

/* ── Public Form ── */

.public-page {
    min-height: 100vh;
    background: var(--cream);
    padding: 2rem 1rem 4rem;
}

.public-form-container {
    max-width: 620px;
    margin: 0 auto;
    animation: fadeUp 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.public-form-header {
    margin-bottom: 2rem;
}

.public-form-header h1 {
    font-size: 2rem;
    color: var(--stone-900);
    letter-spacing: -0.01em;
}

.form-description {
    color: var(--stone-500);
    font-size: 0.92rem;
    margin-top: 0.4rem;
    line-height: 1.6;
}

.public-form-card {
    background: #fff;
    border: 1px solid var(--stone-200);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-md);
}

.public-form-card .form-group {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--stone-100);
}

.public-form-card .form-group:last-of-type {
    border-bottom: none;
    padding-bottom: 0;
}

.public-form-card .form-group > label {
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--stone-800);
    margin-bottom: 0.6rem;
}

.required {
    color: var(--coral-600);
    margin-left: 2px;
}

.options-group {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.option-label {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 400;
    cursor: pointer;
    padding: 0.5rem 0.7rem;
    border-radius: var(--radius-sm);
    transition: background 0.1s;
    color: var(--stone-700);
    font-size: 0.9rem;
}

.option-label:hover {
    background: var(--stone-50);
}

.option-label input[type="radio"],
.option-label input[type="checkbox"] {
    width: 17px;
    height: 17px;
    accent-color: var(--coral-600);
    cursor: pointer;
}

.public-form-card .btn-primary {
    margin-top: 0.75rem;
    padding: 0.75rem;
    font-size: 0.95rem;
    border-radius: var(--radius-sm);
}

.powered-by {
    text-align: center;
    margin-top: 1.75rem;
    font-size: 0.75rem;
    color: var(--stone-400);
}

.powered-by a {
    color: var(--stone-500);
    text-decoration: none;
    font-weight: 500;
}

/* ── Thank You Page ── */

.thankyou-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--cream);
}

.thankyou-card {
    text-align: center;
    padding: 3.5rem;
    background: #fff;
    border-radius: var(--radius-lg);
    border: 1px solid var(--stone-200);
    box-shadow: var(--shadow-lg);
    max-width: 460px;
    animation: scaleIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.thankyou-icon {
    width: 56px;
    height: 56px;
    background: var(--teal-50);
    border: 2px solid var(--teal-100);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.25rem;
    font-size: 1.5rem;
}

.thankyou-card h1 {
    font-size: 1.8rem;
    color: var(--stone-900);
    margin-bottom: 0.5rem;
}

.thankyou-card p {
    color: var(--stone-500);
    font-size: 0.92rem;
    line-height: 1.6;
}

/* ── Submissions ── */

.submissions-page .table td {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.85rem;
}

.submissions-page .table td:first-child {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    color: var(--stone-400);
}

/* ── Responsive ── */

@media (max-width: 640px) {
    .container {
        padding: 1.5rem 1rem 3rem;
    }

    .header-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .login-card {
        margin: 1rem;
        padding: 2rem;
    }

    .public-form-card {
        padding: 1.5rem;
    }
}

.field-hint {
    font-size: 0.8rem;
    color: #8b8b8b;
    margin-top: 0.25rem;
}

input[type="file"] {
    padding: 0.6rem;
    border: 2px dashed #d4d4d4;
    border-radius: 6px;
    width: 100%;
    cursor: pointer;
    background: #fafafa;
}

input[type="file"]:hover {
    border-color: #a3a3a3;
    background: #f5f5f5;
}
