/* ── TomFit Issue Report Form — Mobile-First Styles ── */

:root {
    --accent: #50c878;
    --accent-dark: #3fa564;
    --bg: #1a1d23;
    --bg-card: #23272e;
    --bg-input: #2a2f38;
    --border: #373b48;
    --border-focus: #50c878;
    --text-primary: #f3f4f6;
    --text-secondary: #adb5c1;
    --text-muted: #82899a;
    --error: #EF476F;
    --warning: #FFD166;
    --success: #06D6A0;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 24px rgba(0,0,0,0.3);
    --transition: 0.2s ease;
}

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

/* ── Header ── */
.form-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.form-logo {
    height: 28px;
    width: auto;
}

.form-header h1 {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* ── Auth Gate ── */
.auth-gate {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 20px;
}

.auth-card {
    text-align: center;
    max-width: 340px;
    width: 100%;
}

.auth-icon {
    font-size: 56px;
    color: var(--accent);
    margin-bottom: 16px;
}

.auth-card h2 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.auth-card p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 28px;
    line-height: 1.5;
}

/* ── Buttons ── */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    background: var(--accent);
    color: #fff;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background var(--transition), transform var(--transition);
    -webkit-tap-highlight-color: transparent;
}

.btn-primary:hover {
    background: var(--accent-dark);
}

.btn-primary:active {
    transform: scale(0.97);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-full {
    width: 100%;
}

.btn-text {
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: color var(--transition);
}

.btn-text:hover {
    color: var(--error);
}

/* ── User Bar ── */
.user-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 0;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
}

.user-bar .material-symbols-rounded {
    font-size: 20px;
    color: var(--accent);
}

.user-bar span:nth-child(2) {
    flex: 1;
}

/* ── Form Container ── */
.form-container {
    flex: 1;
    max-width: 520px;
    width: 100%;
    margin: 0 auto;
    padding: 16px 20px 40px;
}

/* ── Form Groups ── */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-group label .material-symbols-rounded {
    font-size: 18px;
    color: var(--accent);
}

.required {
    color: var(--error);
    font-weight: 700;
}

/* ── Inputs ── */
input[type="text"],
textarea,
select {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    transition: border-color var(--transition), box-shadow var(--transition);
    appearance: none;
    -webkit-appearance: none;
}

input[type="text"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(80, 200, 120, 0.15);
}

textarea {
    resize: vertical;
    min-height: 100px;
}

select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M6 8L1 3h10z' fill='%2382899a'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

/* ── People Search / In Charge ── */
.people-suggestions {
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    max-height: 200px;
    overflow-y: auto;
}

.people-suggestion {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background var(--transition);
}

.people-suggestion:hover {
    background: rgba(80, 200, 120, 0.08);
}

.people-suggestion .suggestion-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
}

.people-suggestion .suggestion-email {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.people-suggestion .suggestion-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    flex-shrink: 0;
}

.field-hint {
    display: block;
    margin-top: 4px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.selected-person {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    margin-top: 6px;
    background: rgba(80, 200, 120, 0.1);
    border: 1px solid rgba(80, 200, 120, 0.25);
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--accent);
}

.selected-person .remove-person {
    cursor: pointer;
    font-size: 16px;
    opacity: 0.7;
    transition: opacity var(--transition);
}

.selected-person .remove-person:hover {
    opacity: 1;
}

/* ── Media Upload (multi photos/videos) ── */
.media-upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 12px;
    transition: border-color var(--transition);
}

.media-upload-area:hover {
    border-color: var(--accent);
}

.media-previews {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 8px;
    margin-bottom: 8px;
}

.media-previews:empty {
    margin-bottom: 0;
}

.media-preview-item {
    position: relative;
    border-radius: var(--radius-sm);
    overflow: hidden;
    aspect-ratio: 1;
    background: var(--bg-input);
}

.media-preview-item img,
.media-preview-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.media-preview-item .remove-media {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(0,0,0,0.7);
    border: none;
    color: #fff;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    z-index: 2;
}

.media-preview-item .media-type-badge {
    position: absolute;
    bottom: 4px;
    left: 4px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 500;
}

.media-btn-row {
    display: flex;
    gap: 4px;
}

.media-btn-row .add-media-btn {
    flex: 1;
}

.add-media-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 16px 12px;
    color: var(--text-muted);
    font-size: 0.8rem;
    cursor: pointer;
    transition: color var(--transition);
    -webkit-tap-highlight-color: transparent;
    border-radius: var(--radius-sm);
}

.add-media-btn:hover {
    color: var(--accent);
    background: var(--bg-input);
}

.add-media-btn .material-symbols-rounded {
    font-size: 28px;
}

/* ── Submit Button ── */
.btn-submit {
    margin-top: 12px;
    padding: 16px;
    font-size: 1.05rem;
}

.btn-submit.loading {
    pointer-events: none;
    opacity: 0.7;
}

.btn-submit.loading::after {
    content: '';
    width: 18px;
    height: 18px;
    border: 2.5px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-left: 8px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.spin-icon {
    display: inline-block;
    animation: spin 1.2s linear infinite;
}

/* ── Form Status ── */
.form-status {
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    text-align: center;
}

.form-status.error {
    background: rgba(239, 71, 111, 0.12);
    color: var(--error);
    border: 1px solid rgba(239, 71, 111, 0.25);
}

.form-status.success {
    background: rgba(6, 214, 160, 0.12);
    color: var(--success);
    border: 1px solid rgba(6, 214, 160, 0.25);
}

/* ── Success Screen ── */
.success-screen {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 20px;
}

.success-card {
    text-align: center;
    max-width: 360px;
    width: 100%;
}

.success-icon {
    font-size: 72px;
    color: var(--success);
    margin-bottom: 16px;
    animation: pop 0.4s ease;
}

@keyframes pop {
    0% { transform: scale(0.5); opacity: 0; }
    80% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

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

.success-card p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 28px;
    line-height: 1.5;
}

/* ── Machine Banner (from QR code) ── */
.machine-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: rgba(80, 200, 120, 0.08);
    border: 1px solid rgba(80, 200, 120, 0.2);
    border-radius: var(--radius-sm);
    color: var(--accent);
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 20px;
}

.machine-banner .material-symbols-rounded {
    font-size: 22px;
}

/* ── SN Multi-select ── */
.sn-multiselect {
    position: relative;
}

.sn-selected-chips {
    width: 100%;
    min-height: 46px;
    padding: 8px 12px;
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.sn-selected-chips:hover,
.sn-multiselect.open .sn-selected-chips {
    border-color: var(--border-focus);
}

.sn-multiselect.open .sn-selected-chips {
    box-shadow: 0 0 0 3px rgba(80, 200, 120, 0.15);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.sn-placeholder {
    color: var(--text-muted);
    font-size: 1rem;
    pointer-events: none;
}

.sn-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--accent);
    color: #fff;
    font-size: 0.82rem;
    font-weight: 500;
    padding: 3px 8px;
    border-radius: 12px;
    white-space: nowrap;
}

.sn-chip .sn-chip-remove {
    cursor: pointer;
    font-size: 14px;
    opacity: 0.8;
    line-height: 1;
}

.sn-chip .sn-chip-remove:hover {
    opacity: 1;
}

.sn-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 20;
    background: var(--bg-card);
    border: 1.5px solid var(--border-focus);
    border-top: none;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    max-height: 260px;
    overflow-y: auto;
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
}

.sn-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    cursor: pointer;
    font-size: 0.92rem;
    color: var(--text-primary);
    transition: background var(--transition);
}

.sn-option:hover {
    background: rgba(80, 200, 120, 0.08);
}

.sn-option input[type="checkbox"] {
    accent-color: var(--accent);
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.sn-option small {
    color: var(--text-muted);
    margin-left: 2px;
}

.sn-other-row {
    flex-wrap: wrap;
    gap: 6px;
    border-top: 1px solid var(--border);
}

.sn-other-row label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.sn-other-input {
    flex: 1;
    min-width: 120px;
    padding: 6px 10px;
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.88rem;
}

.sn-other-input:focus {
    outline: none;
    border-color: var(--border-focus);
}

.sn-other-input:disabled {
    opacity: 0.4;
}

/* ── Utilities ── */
.hidden {
    display: none !important;
}

/* ── Responsive ── */
@media (min-width: 600px) {
    .form-container {
        padding: 24px 32px 48px;
    }
}
