/* /add capture page — extends style.css tokens (--ink, --paper, --indigo, --radius, fonts). */

/* The page's whole state machine toggles the `hidden` attribute from add.js. Any element
   that also has an author `display` rule (dev-badge, spinners, toasts) would otherwise
   override the UA's [hidden] { display: none } and stay visible — force it globally. */
[hidden] {
    display: none !important;
}

.add-body {
    min-height: 100svh;
    display: flex;
    flex-direction: column;
}

.dev-badge {
    display: inline-flex;
    align-items: center;
    height: 24px;
    padding: 0 8px;
    border-radius: 999px;
    background: var(--purple);
    color: var(--white);
    font-family: var(--type-mono);
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.add-main {
    flex: 1 1 auto;
    padding: calc(var(--header-h) + 36px) 0 64px;
}

.add-shell {
    width: min(560px, calc(100% - (var(--edge) * 2)));
    margin-inline: auto;
    display: grid;
    gap: 20px;
}

.add-card {
    padding: 28px 26px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius);
    background: var(--ink-2);
}

.add-card h1 {
    font-family: var(--type-display);
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1.15;
    color: var(--white);
}

.add-card h2 {
    font-family: var(--type-display);
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--white);
}

.add-lede {
    margin-top: 10px;
    color: rgba(255, 255, 255, 0.68);
    font-size: 0.98rem;
    line-height: 1.55;
}

.add-banner {
    padding: 14px 16px;
    border: 1px solid rgba(180, 156, 255, 0.35);
    border-radius: var(--radius);
    background: rgba(63, 81, 181, 0.14);
    color: var(--white);
    font-size: 0.95rem;
    line-height: 1.5;
}

.add-error {
    margin-top: 12px;
    padding: 12px 14px;
    border: 1px solid rgba(220, 90, 90, 0.4);
    border-radius: var(--radius);
    background: rgba(220, 90, 90, 0.1);
    color: #FFB4B4;
    font-size: 0.88rem;
    line-height: 1.5;
}

.field-hint {
    margin-top: 8px;
    color: rgba(255, 255, 255, 0.56);
    font-size: 0.84rem;
    line-height: 1.5;
}

/* Google sign-in button */
.btn-google {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    min-height: 48px;
    margin-top: 22px;
    padding: 0 18px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: var(--radius);
    background: var(--white);
    color: #1F1F1F;
    font-family: var(--type-sans);
    font-size: 0.98rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 160ms ease, box-shadow 160ms ease;
}

.btn-google:hover,
.btn-google:focus-visible {
    transform: translateY(-1px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
}

.btn-google:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Account row (signed-in) */
.account-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 22px;
    padding-bottom: 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.account-chip {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 7px 12px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.82);
    font-family: var(--type-mono);
    font-size: 0.78rem;
}

.link-btn {
    color: var(--acid);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    background: none;
    border: 0;
    padding: 0;
    text-align: left;
}

.link-btn:hover,
.link-btn:focus-visible {
    text-decoration: underline;
}

/* Form fields */
.field-group {
    margin-top: 18px;
}

.field-group:first-child {
    margin-top: 20px;
}

.field-group label {
    display: block;
    margin-bottom: 8px;
    color: rgba(255, 255, 255, 0.7);
    font-family: var(--type-mono);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.field-row .field-group {
    margin-top: 0;
}

input[type="text"],
input[type="url"],
input[type="number"],
select,
textarea {
    width: 100%;
    min-height: 46px;
    padding: 0 14px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.04);
    color: var(--white);
    font-family: var(--type-sans);
    font-size: 0.95rem;
}

textarea {
    padding: 12px 14px;
    resize: vertical;
    min-height: 84px;
}

input::placeholder,
textarea::placeholder {
    color: rgba(255, 255, 255, 0.36);
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible,
a:focus-visible {
    outline: 2px solid var(--acid);
    outline-offset: 2px;
}

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='%23ffffff' fill-opacity='0.6' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 34px;
}

.url-row {
    display: flex;
    gap: 10px;
}

.url-row input {
    flex: 1 1 auto;
    min-width: 0;
}

.btn-secondary {
    flex: 0 0 auto;
    min-height: 46px;
    padding: 0 16px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.06);
    color: var(--white);
    font-family: var(--type-sans);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 160ms ease, background 160ms ease;
}

.btn-secondary:hover,
.btn-secondary:focus-visible {
    border-color: var(--acid);
    background: rgba(255, 255, 255, 0.1);
}

.btn-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 50px;
    margin-top: 22px;
    padding: 0 18px;
    border: 0;
    border-radius: var(--radius);
    background: var(--acid);
    color: var(--white);
    font-family: var(--type-sans);
    font-size: 0.98rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 160ms ease, transform 160ms ease;
}

.btn-primary:hover,
.btn-primary:focus-visible {
    background: var(--indigo-2);
    transform: translateY(-1px);
}

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

.spinner-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    color: rgba(255, 255, 255, 0.62);
    font-size: 0.86rem;
}

.spinner {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
    border: 2px solid rgba(255, 255, 255, 0.24);
    border-top-color: var(--acid);
    border-radius: 999px;
    animation: add-spin 700ms linear infinite;
}

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

.image-preview-wrap {
    margin-top: 18px;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.03);
}

.image-preview-wrap img {
    width: 100%;
    max-height: 260px;
    object-fit: contain;
    display: block;
}

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

.tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 36px;
    padding: 0 13px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.78);
    font-size: 0.84rem;
    cursor: pointer;
    transition: border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.tag-chip:hover,
.tag-chip:focus-visible {
    border-color: var(--acid);
}

.tag-chip.selected {
    border-color: var(--acid);
    background: rgba(63, 81, 181, 0.28);
    color: var(--white);
}

/* Success view */
#success-view {
    text-align: center;
    padding: 12px 0 4px;
}

.success-check {
    width: 64px;
    height: 64px;
    margin: 0 auto 18px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: var(--acid);
    color: var(--white);
    font-size: 2rem;
    font-weight: 700;
}

.success-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 22px;
}

.success-actions .btn-secondary,
.success-actions .btn-primary {
    margin-top: 0;
    width: 100%;
    text-align: center;
}

.success-actions a.btn-primary {
    text-decoration: none;
}

/* Bookmarklet section */
.bookmarklet-card {
    text-align: left;
}

.bookmarklet-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 20px;
}

.bookmarklet {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 46px;
    padding: 0 18px;
    border-radius: 999px;
    background: var(--hot);
    color: var(--white);
    font-family: var(--type-sans);
    font-size: 0.95rem;
    font-weight: 700;
    cursor: grab;
    user-select: none;
    -webkit-user-drag: element;
}

.bookmarklet:active {
    cursor: grabbing;
}

.bookmarklet-hint {
    color: rgba(255, 255, 255, 0.56);
    font-family: var(--type-mono);
    font-size: 0.78rem;
}

#btn-copy-bookmarklet {
    margin-top: 16px;
}

.bookmarklet-toast {
    margin-top: 12px;
    padding: 10px 13px;
    border: 1px solid rgba(111, 123, 255, 0.34);
    border-radius: var(--radius);
    background: rgba(63, 81, 181, 0.12);
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.84rem;
}

@media (max-width: 480px) {
    .add-card {
        padding: 22px 18px;
    }

    .field-row {
        grid-template-columns: 1fr;
        gap: 18px;
    }

    .success-actions {
        grid-template-columns: 1fr;
    }

    .url-row {
        flex-direction: column;
    }

    .btn-secondary {
        width: 100%;
    }
}
