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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #0f0f23;
    color: #e2e8f0;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 2rem 1rem;
}

.page-wrapper {
    display: flex;
    align-items: flex-start;
    gap: 8rem;
    max-width: 900px;
    width: 100%;
    justify-content: center;
    transform: translateX(-8rem);
}

.logo-section {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    padding-top: 3rem;
}

.logo {
    width: 280px;
    height: auto;
    opacity: 0.9;
    filter: drop-shadow(0 0 20px rgba(200, 170, 80, 0.15));
}

.container {
    width: 100%;
    max-width: 480px;
}

/* Responsive: stack on narrow screens */
@media (max-width: 768px) {
    .page-wrapper {
        flex-direction: column;
        align-items: center;
        gap: 1.5rem;
        transform: none;
    }
    .logo-section {
        padding-top: 0;
    }
    .logo {
        width: 160px;
    }
}

h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #a78bfa;
    margin-bottom: 0.25rem;
}

.subtitle {
    color: #94a3b8;
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
}

.field {
    margin-bottom: 1rem;
    position: relative;
}

label {
    display: block;
    font-size: 0.8125rem;
    color: #94a3b8;
    margin-bottom: 0.375rem;
}

.optional {
    color: #64748b;
    font-weight: 400;
}

input[type="url"],
input[type="text"],
input[type="date"],
input[type="password"],
textarea,
select {
    width: 100%;
    padding: 0.625rem 0.75rem;
    background: #1a1b2e;
    border: 1px solid #2d2e4a;
    border-radius: 6px;
    color: #e2e8f0;
    font-size: 0.9375rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

input:focus, textarea:focus, select:focus {
    border-color: #a78bfa;
}

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

select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2394a3b8' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2rem;
}

/* Topic checkbox chips */
.topic-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.topic-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    background: #1a1b2e;
    border: 1px solid #2d2e4a;
    border-radius: 20px;
    font-size: 0.8125rem;
    color: #e2e8f0;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, color 0.2s;
    user-select: none;
}

.topic-chip:hover {
    border-color: #a78bfa;
    color: #fff;
}

.topic-chip:has(input:checked) {
    border-color: #a78bfa;
    background: #a78bfa22;
    color: #fff;
}

.topic-chip input[type="checkbox"] {
    width: 0.875rem;
    height: 0.875rem;
    accent-color: #a78bfa;
    margin: 0;
}

/* Notebook source count (B98) */
.notebook-count {
    font-size: 0.7em;
    color: #94a3b8;
    margin-left: 0.125rem;
}

/* Toggle links row (paste + file upload) */
.toggle-links {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 1rem;
}

.toggle-sep {
    color: #2d2e4a;
    font-size: 0.8125rem;
}

.toggle-links .paste-toggle {
    margin-bottom: 0;
}

/* File drop zone */
.file-drop-zone {
    border: 2px dashed #2d2e4a;
    border-radius: 6px;
    background: #1a1b2e;
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.file-drop-zone:hover,
.file-drop-zone.dragover {
    border-color: #a78bfa;
    background: #252640;
}

.file-drop-zone .drop-text {
    color: #94a3b8;
    font-size: 0.875rem;
}

.file-drop-zone .drop-icon {
    font-size: 1.25rem;
    margin-right: 0.375rem;
    vertical-align: middle;
}

.file-drop-zone .drop-text a {
    color: #a78bfa;
    text-decoration: none;
}

.file-drop-zone .drop-text a:hover {
    text-decoration: underline;
}

.file-selected {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    font-size: 0.875rem;
    color: #e2e8f0;
}

.file-selected #file-name {
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-selected #file-remove {
    color: #ef4444;
    text-decoration: none;
    font-size: 1rem;
    line-height: 1;
}

.file-selected #file-remove:hover {
    color: #ef4444;
}

/* Source badge — file types */
.source-badge.pdf {
    display: inline;
    background: #ef444422;
    color: #ef4444;
}

.source-badge.file {
    display: inline;
    background: #94a3b822;
    color: #94a3b8;
}

/* Paste toggle link */
.paste-toggle {
    display: inline-block;
    color: #a78bfa;
    font-size: 0.8125rem;
    text-decoration: none;
    margin-bottom: 1rem;
    cursor: pointer;
}

.paste-toggle:hover {
    color: #c4b5fd;
    text-decoration: underline;
}

/* Date row with Today button */
.date-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.date-row input[type="date"] {
    flex: 1;
}

.today-btn {
    padding: 0.625rem 1rem;
    background: #a78bfa;
    border: 1px solid #a78bfa;
    border-radius: 6px;
    color: #fff;
    font-size: 0.8125rem;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s, border-color 0.2s;
}

.today-btn:hover {
    background: #9070e0;
    border-color: #9070e0;
    color: #fff;
}

/* Checkbox */
.checkbox-field label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: #e2e8f0;
}

.checkbox-field input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    accent-color: #a78bfa;
}

/* Source badge */
.source-badge {
    position: absolute;
    right: 0.625rem;
    top: 2rem;
    font-size: 0.75rem;
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    font-weight: 500;
    display: none;
}

.source-badge.youtube {
    display: inline;
    background: #ef444422;
    color: #ef4444;
}

.source-badge.twitter {
    display: inline;
    background: #1da1f222;
    color: #1da1f2;
}

.source-badge.web {
    display: inline;
    background: #a78bfa22;
    color: #a78bfa;
}

/* Submit button */
button[type="submit"] {
    width: 100%;
    padding: 0.75rem;
    background: #a78bfa;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

button[type="submit"]:hover {
    background: #9070e0;
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.spinner {
    display: none;
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

button.loading .btn-text { display: none; }
button.loading .spinner { display: block; }

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

/* Result messages */
.result {
    margin-top: 1rem;
    padding: 0.875rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    line-height: 1.5;
}

.result.success {
    background: #22c55e22;
    border: 1px solid #22c55e44;
    color: #22c55e;
}

.result.error {
    background: #ef444422;
    border: 1px solid #ef444444;
    color: #ef4444;
}

.result.duplicate {
    background: #eab30822;
    border: 1px solid #eab30844;
    color: #eab308;
}
