/* OpenRSVP - Styles */
:root {
    --primary: #4f46e5;
    --primary-dark: #3730a3;
    --primary-light: #818cf8;
    --color-bg: #f5f5f5;
    --color-surface: #ffffff;
    --color-text: #1f2937;
    --color-text-light: #6b7280;
    --color-text-muted: #9ca3af;
    --color-border: #e5e7eb;
    --color-border-light: #f3f4f6;
    --color-success: #059669;
    --color-success-bg: #d1fae5;
    --color-warning: #d97706;
    --color-warning-bg: #fef3c7;
    --color-error: #dc2626;
    --color-error-bg: #fee2e2;
    --color-info: #2563eb;
    --color-info-bg: #dbeafe;
    --color-danger: #b91c1c;
    --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --radius: 6px;
    --radius-lg: 10px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.12);
    --transition: 0.2s ease;
}

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

body {
    font-family: var(--font-stack);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    min-height: 100vh;
}

/* ---- Header ---- */
.app-header {
    background: var(--primary);
    color: #fff;
    padding: 0 24px;
    height: 56px;
    display: flex;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 760px;
    margin: 0 auto;
}
.brand {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    letter-spacing: -0.5px;
}
.header-link {
    font-size: 13px;
    color: rgba(255,255,255,0.75);
    text-decoration: none;
}
.header-link:hover { color: #fff; }

/* ---- Container ---- */
.container {
    max-width: 720px;
    margin: 0 auto;
    padding: 28px 16px;
}

/* ---- Card ---- */
.card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 20px;
}
.card-title {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--color-border-light);
    color: var(--color-text);
}

/* ---- Landing ---- */
.landing-hero {
    text-align: center;
    margin-bottom: 24px;
}
.landing-hero h2 {
    font-size: 28px;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 10px;
}
.landing-hero p {
    font-size: 15px;
    color: var(--color-text-light);
    max-width: 520px;
    margin: 0 auto;
}

/* ---- Event header ---- */
.event-header {
    text-align: center;
    margin-bottom: 24px;
}
.event-header h2 {
    font-size: 26px;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 10px;
}
.event-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
    font-size: 14px;
    color: var(--color-text-light);
}
.event-meta-item {
    display: flex;
    align-items: center;
    gap: 5px;
}
.event-description {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 24px;
    font-size: 15px;
    white-space: pre-wrap;
    color: var(--color-text);
}
.deadline-notice {
    background: var(--color-info-bg);
    border-radius: var(--radius);
    padding: 10px 16px;
    margin-bottom: 16px;
    font-size: 14px;
    color: var(--color-info);
}

/* ---- Forms ---- */
.form-group { margin-bottom: 18px; }
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--color-text);
}
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.hint-inline {
    font-weight: 400;
    color: var(--color-text-muted);
    font-size: 12px;
}
.required { color: var(--color-error); margin-left: 2px; }
.muted { color: var(--color-text-muted); }

input[type="text"], input[type="email"], input[type="tel"],
input[type="number"], input[type="datetime-local"], textarea, select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: var(--font-stack);
    transition: var(--transition);
    background: #fff;
    color: var(--color-text);
}
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}
textarea { resize: vertical; min-height: 90px; }

input.error, textarea.error, select.error { border-color: var(--color-error); }
.error-text {
    color: var(--color-error);
    font-size: 12px;
    margin-top: 4px;
}

.readonly-value {
    padding: 8px 0;
    color: var(--color-text-light);
    font-size: 14px;
}

/* ---- Choice groups (radio/checkbox) ---- */
.choice-group { display: flex; flex-direction: column; gap: 0; }
.choice-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border: 1px solid var(--color-border);
    margin-top: -1px;
    cursor: pointer;
    font-size: 14px;
    transition: var(--transition);
}
.choice-item:first-child { border-radius: var(--radius) var(--radius) 0 0; margin-top: 0; }
.choice-item:last-child { border-radius: 0 0 var(--radius) var(--radius); }
.choice-item:only-child { border-radius: var(--radius); }
.choice-item:hover { border-color: var(--primary-light); z-index: 1; }
.choice-item input[type="radio"],
.choice-item input[type="checkbox"] {
    width: 18px; height: 18px; min-width: 18px;
    accent-color: var(--primary);
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    line-height: 1.4;
    font-family: var(--font-stack);
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
    background: var(--primary);
    color: #fff;
    width: 100%;
    padding: 12px;
    font-size: 15px;
}
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-secondary { background: #e5e7eb; color: var(--color-text); }
.btn-secondary:hover:not(:disabled) { background: #d1d5db; }
.btn-danger { background: var(--color-danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #991b1b; }
.btn-sm { padding: 6px 14px; font-size: 13px; width: auto; }

/* Icon button */
.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    font-size: 14px;
    color: var(--color-text-light);
    transition: var(--transition);
    line-height: 1;
}
.btn-icon:hover { background: var(--color-border-light); color: var(--color-text); }

/* ---- Badges ---- */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}
.badge-success { background: var(--color-success-bg); color: var(--color-success); }
.badge-warning { background: var(--color-warning-bg); color: var(--color-warning); }
.badge-error { background: var(--color-error-bg); color: var(--color-error); }
.badge-info { background: var(--color-info-bg); color: var(--color-info); }

/* ---- URL boxes ---- */
.url-box {
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    margin-bottom: 16px;
}
.url-box-creator {
    background: #ede9fe;
    border: 1px solid #c4b5fd;
}
.url-box-public {
    background: var(--color-success-bg);
    border: 1px solid #6ee7b7;
}
.url-box-registrant {
    background: var(--color-info-bg);
    border: 1px solid #93c5fd;
}
.url-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
    color: var(--color-text);
}
.url-row {
    display: flex;
    gap: 8px;
    align-items: center;
}
.url-input {
    font-size: 13px;
    font-family: monospace;
    background: rgba(255,255,255,0.7);
    border-color: rgba(0,0,0,0.1) !important;
    padding: 8px 12px !important;
    flex: 1;
    cursor: text;
}
.url-input:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12) !important;
}
.btn-copy {
    white-space: nowrap;
    flex-shrink: 0;
    padding: 8px 14px;
    font-size: 13px;
}

/* ---- Success card ---- */
.success-card {
    text-align: center;
    padding: 32px 24px;
}
.success-icon {
    font-size: 48px;
    color: var(--color-success);
    margin-bottom: 12px;
    line-height: 1;
}
.success-card h2 { font-size: 22px; margin-bottom: 8px; }
.success-card p { color: var(--color-text-light); margin-bottom: 8px; }

/* ---- Closed / full / not-found ---- */
.closed-notice {
    text-align: center;
    padding: 40px 20px;
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}
.closed-notice h2 { font-size: 20px; margin-bottom: 8px; }
.closed-notice p { color: var(--color-text-light); }

.not-found { text-align: center; padding: 60px 20px; }
.not-found h2 { font-size: 22px; margin-bottom: 8px; color: var(--color-text-light); }
.not-found p { color: var(--color-text-muted); margin-bottom: 8px; }

/* ---- Registration info ---- */
.reg-info {
    background: var(--color-bg);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 4px;
    font-size: 14px;
}
.reg-info dl { display: grid; grid-template-columns: 100px 1fr; row-gap: 8px; column-gap: 12px; }
.reg-info dt { font-weight: 600; color: var(--color-text-light); }
.reg-info dd { margin: 0; }

/* ---- Creator header ---- */
.creator-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.creator-title { font-size: 22px; font-weight: 700; }

/* ---- Tabs ---- */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--color-border);
    margin-bottom: 24px;
}
.tab-btn {
    background: none;
    border: none;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-light);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: var(--transition);
    font-family: var(--font-stack);
}
.tab-btn:hover { color: var(--primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ---- Fields builder ---- */
.fields-section { }
.section-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    margin-bottom: 10px;
}
.builtin-fields { display: flex; flex-direction: column; gap: 1px; }
.builtin-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--color-bg);
    border-radius: var(--radius);
    margin-bottom: 2px;
}
.toggle-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
}
.toggle-label input[type="checkbox"] {
    width: 16px; height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}
.required-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--color-text-light);
    cursor: pointer;
    white-space: nowrap;
}
.required-label input[type="checkbox"] {
    width: 14px; height: 14px;
    accent-color: var(--primary);
}

/* Custom fields */
.custom-field-row {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 8px;
}
.custom-field-header {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.drag-handle {
    color: var(--color-text-muted);
    cursor: grab;
    font-size: 16px;
    padding: 0 2px;
    flex-shrink: 0;
}
.cf-label {
    flex: 1;
    min-width: 150px;
    padding: 7px 10px !important;
    font-size: 13px !important;
}
.cf-type {
    width: auto;
    min-width: 140px;
    padding: 7px 10px !important;
    font-size: 13px !important;
    flex-shrink: 0;
}
.cf-actions { display: flex; gap: 2px; flex-shrink: 0; }
.cf-options-wrap {
    margin-top: 10px;
}
.cf-options-wrap label {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-light);
    margin-bottom: 4px;
    display: block;
}
.cf-options {
    width: 100%;
    font-size: 13px !important;
    min-height: 70px !important;
    resize: vertical;
}

/* ---- Registrant table ---- */
.reg-table-wrap { overflow-x: auto; }
.reg-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.reg-table th {
    text-align: left;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-muted);
    border-bottom: 1px solid var(--color-border);
}
.reg-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--color-border-light);
    vertical-align: middle;
}
.reg-table tr:last-child td { border-bottom: none; }
.reg-table tr:hover td { background: var(--color-bg); }

/* ---- Danger zone ---- */
.danger-zone {
    border: 1px solid #fca5a5;
    background: #fff5f5;
}
.danger-zone .card-title { color: var(--color-danger); }

/* ---- Toast ---- */
.toast-container {
    position: fixed;
    top: 66px;
    right: 16px;
    z-index: 999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.toast {
    padding: 12px 20px;
    border-radius: var(--radius);
    font-size: 14px;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.25s ease;
    max-width: 380px;
}
.toast-success { background: var(--color-success); color: #fff; }
.toast-error { background: var(--color-error); color: #fff; }
@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ---- Loading ---- */
.loading { text-align: center; padding: 48px; color: var(--color-text-muted); font-size: 15px; }

/* ---- Footer ---- */
.app-footer {
    text-align: center;
    padding: 24px;
    font-size: 12px;
    color: var(--color-text-muted);
}
.app-footer a { color: var(--color-text-muted); text-decoration: none; }
.app-footer a:hover { color: var(--primary); }

/* ---- Utility ---- */
.hidden { display: none !important; }

/* ---- Responsive ---- */
@media (max-width: 600px) {
    .container { padding: 16px 12px; }
    .card { padding: 16px; }
    .event-header h2 { font-size: 22px; }
    .form-row { grid-template-columns: 1fr; gap: 0; }
    .creator-header { flex-direction: column; }
    .custom-field-header { flex-wrap: wrap; }
    .cf-label { min-width: 100%; }
    .cf-type { width: 100%; min-width: unset; }
}
