/* ============================================
   tastescrape
   ============================================ */

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

body {
    background: #000;
    color: #fff;
    font-family: 'Roboto', sans-serif;
    font-weight: 400;
    line-height: 1.7;
    text-transform: lowercase;
    min-height: 100vh;
}

a {
    color: #fff;
    text-decoration: none;
    transition: text-decoration 0.2s ease;
}

a:hover {
    text-decoration: line-through;
}

/* container */

.container {
    width: 92%;
    max-width: 960px;
    margin: 0 auto;
    padding: 4vh 0;
}

/* ============================================
   page title
   ============================================ */

.title {
    font-family: "Trebuchet MS", Helvetica, Jamrul, sans-serif;
    font-weight: 300;
    font-size: clamp(2.5rem, 6vw, 4rem);
    letter-spacing: 0.1em;
    text-align: center;
}

/* ============================================
   glitch effect (JS-driven, applied to .btn on hover)
   ============================================ */

.btn {
    position: relative;
    overflow: hidden;
}

.glitch-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    opacity: 0.8;
}

.glitch-layer--red {
    color: #ff0100;
    clip-path: inset(0 0 50% 0);
    transform: translate(-2px, -1px);
    animation: glitch-1 4s linear infinite alternate-reverse;
}

.glitch-layer--blue {
    color: #0116ff;
    clip-path: inset(50% 0 0 0);
    transform: translate(2px, 1px);
    animation: glitch-2 4s linear infinite alternate-reverse;
}

@keyframes glitch-1 {
    0%   { clip-path: inset(8% 0 78% 0); }
    5%   { clip-path: inset(52% 0 12% 0); }
    10%  { clip-path: inset(92% 0 1% 0); }
    15%  { clip-path: inset(18% 0 62% 0); }
    20%  { clip-path: inset(38% 0 42% 0); }
    25%  { clip-path: inset(72% 0 8% 0); }
    30%  { clip-path: inset(5% 0 85% 0); }
    35%  { clip-path: inset(48% 0 32% 0); }
    40%  { clip-path: inset(82% 0 2% 0); }
    45%  { clip-path: inset(22% 0 58% 0); }
    50%  { clip-path: inset(62% 0 18% 0); }
    55%  { clip-path: inset(2% 0 88% 0); }
    60%  { clip-path: inset(42% 0 38% 0); }
    65%  { clip-path: inset(78% 0 5% 0); }
    70%  { clip-path: inset(15% 0 72% 0); }
    75%  { clip-path: inset(58% 0 22% 0); }
    80%  { clip-path: inset(95% 0 0% 0); }
    85%  { clip-path: inset(28% 0 52% 0); }
    90%  { clip-path: inset(68% 0 12% 0); }
    95%  { clip-path: inset(10% 0 80% 0); }
    100% { clip-path: inset(45% 0 35% 0); }
}

@keyframes glitch-2 {
    0%   { clip-path: inset(45% 0 35% 0); }
    5%   { clip-path: inset(10% 0 80% 0); }
    10%  { clip-path: inset(68% 0 12% 0); }
    15%  { clip-path: inset(28% 0 52% 0); }
    20%  { clip-path: inset(95% 0 0% 0); }
    25%  { clip-path: inset(58% 0 22% 0); }
    30%  { clip-path: inset(15% 0 72% 0); }
    35%  { clip-path: inset(78% 0 5% 0); }
    40%  { clip-path: inset(42% 0 38% 0); }
    45%  { clip-path: inset(2% 0 88% 0); }
    50%  { clip-path: inset(62% 0 18% 0); }
    55%  { clip-path: inset(22% 0 58% 0); }
    60%  { clip-path: inset(82% 0 2% 0); }
    65%  { clip-path: inset(48% 0 32% 0); }
    70%  { clip-path: inset(5% 0 85% 0); }
    75%  { clip-path: inset(72% 0 8% 0); }
    80%  { clip-path: inset(38% 0 42% 0); }
    85%  { clip-path: inset(18% 0 62% 0); }
    90%  { clip-path: inset(92% 0 1% 0); }
    95%  { clip-path: inset(52% 0 12% 0); }
    100% { clip-path: inset(8% 0 78% 0); }
}

/* ============================================
   accounts header (persistent)
   ============================================ */

.accounts-header {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin: 1.5rem 0 2rem;
    flex-direction: column;
    align-items: center;
}

.accounts-header__slot {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 300;
}

.accounts-header__label {
    opacity: 0.4;
}

.accounts-header__name {
    font-weight: 400;
}

.accounts-header__name--main {
    color: #1DB954;
}

.accounts-header__name--empty {
    opacity: 0.3;
}

.accounts-header__action {
    font-size: 0.75rem;
    opacity: 0.4;
    transition: opacity 0.2s ease;
}

.accounts-header__action:hover {
    opacity: 0.8;
}

.accounts-header__action--disconnect {
    color: #fff;
}

/* ============================================
   buttons
   ============================================ */

.btn {
    display: inline-block;
    padding: 0.6rem 1.8rem;
    border: 0px solid rgba(255, 255, 255, 0.25);
    font-family: 'Roboto', sans-serif;
    font-weight: 400;
    font-size: 1rem;
    cursor: pointer;
    transition: opacity 0.2s ease, border-color 0.2s ease;
    background: transparent;
    color: #fff;
    text-decoration: none;
    text-transform: uppercase;
}

.btn:hover {
    opacity: 0.8;
    text-decoration: none;
}

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

.btn--accent {
    color: #1DB954;
}

.btn--red {
    border-color: #ff0100;
    color: #ff0100;
}

.btn--small {
    padding: 0.3rem 0.8rem;
    font-size: 0.8rem;
}

/* ============================================
   landing page
   ============================================ */

/* ============================================
   section show/hide (single-page app)
   ============================================ */

.section {
    display: none;
}

.section--active {
    display: block;
}

/* ============================================
   landing page
   ============================================ */

.landing {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
}

#section-landing {
    text-align: center;
}

.landing__description {
    font-weight: 300;
    text-align: center;
}

/* ============================================
   error message
   ============================================ */

.error-message {
    color: #ff0100;
    font-weight: 400;
    font-size: 0.85rem;
}

/* ============================================
   category sections (select page)
   ============================================ */

.category {
    margin-bottom: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.category__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 1rem;
    cursor: pointer;
    transition: opacity 0.2s ease;
    position: sticky;
    top: 0;
    z-index: 10;
    background: #000;
}

.category__header:hover {
    opacity: 0.8;
}

.category__title {
    font-weight: 400;
    font-size: 1rem;
}

.category__count {
    font-weight: 300;
    opacity: 0.5;
    font-size: 0.85rem;
}

.category__dupe-count {
    font-weight: 300;
    color: #1DB954;
    font-size: 0.75rem;
    margin-left: 0.5rem;
}

.category__actions {
    display: flex;
    gap: 0.5rem;
}

.category__toggle {
    font-size: 0.85rem;
    opacity: 0.5;
    transition: transform 0.2s ease;
}

.category--open .category__toggle {
    transform: rotate(180deg);
}

.category__body {
    display: none;
    padding: 0 1rem 1rem;
}

.category--open .category__body {
    display: block;
}

/* ============================================
   item grid (checkboxes)
   ============================================ */

.item-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
}

.item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.6rem;
    opacity: 0.6;
    transition: opacity 0.2s ease;
    cursor: pointer;
    font-size: 0.85rem;
}

.item:hover {
    opacity: 1;
}

.item--duplicate {
    opacity: 0.3;
}

.item input[type="checkbox"] {
    appearance: none;
    width: 1rem;
    height: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: transparent;
    cursor: pointer;
    flex-shrink: 0;
    position: relative;
}

.item input[type="checkbox"]:checked {
    border-color: #1DB954;
}

.item input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    right: 2px;
    bottom: 2px;
    background: #1DB954;
}

.item input[type="checkbox"]:checked ~ .item__name {
    opacity: 1;
}

.item__name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item__detail {
    font-weight: 300;
    opacity: 0.8;
    font-size: 0.75rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-transform: uppercase;
}

.item__dupe-tag {
    font-size: 0.7rem;
    opacity: 0.4;
    color: #1DB954;
    flex-shrink: 0;
}

.show-more {
    margin-top: 0.5rem;
    font-size: 0.8rem;
    opacity: 0.4;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.show-more:hover {
    opacity: 0.8;
}

/* ============================================
   scrape / progress page
   ============================================ */

.scrape {
    padding-top: 2rem;
}

.progress-category {
    margin-bottom: 1.5rem;
}

.progress-category__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.4rem;
}

.progress-category__name {
    font-weight: 400;
    font-size: 0.9rem;
}

.progress-category__count {
    font-weight: 300;
    font-size: 0.8rem;
    opacity: 0.5;
}

.progress-bar {
    width: 100%;
    height: 2px;
    background: rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.progress-bar__fill {
    height: 100%;
    width: 0%;
    background: #fff;
    transition: width 0.3s ease;
}

.progress-bar--active .progress-bar__fill {
    animation: progress-pulse 1.5s ease-in-out infinite;
}

@keyframes progress-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.progress-category__current {
    font-weight: 300;
    font-size: 0.75rem;
    opacity: 0.4;
    margin-top: 0.3rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.progress-category--done .progress-category__name::after {
    content: ' \2713';
    opacity: 0.5;
}

/* scrape complete */

.scrape-complete {
    text-align: center;
    margin-top: 3rem;
    padding: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.scrape-complete__title {
    font-weight: 300;
    font-size: 1.4rem;
    margin-bottom: 1rem;
    color: #fff;
}

.scrape-complete__summary {
    font-weight: 300;
    font-size: 0.85rem;
    opacity: 0.6;
    line-height: 2;
}

.scrape-complete__errors {
    margin-top: 1rem;
    color: #ff0100;
    font-size: 0.8rem;
    line-height: 2;
}

.scrape-complete__hint {
    margin-top: 0.5rem;
    font-size: 0.75rem;
    font-weight: 300;
    opacity: 0.5;
    line-height: 1.8;
}

/* ============================================
   loading
   ============================================ */

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 2rem;
    font-weight: 300;
    opacity: 0.5;
}

.loading__dot {
    width: 4px;
    height: 4px;
    background: #fff;
    animation: loading-blink 1s ease-in-out infinite;
}

.loading__dot:nth-child(2) { animation-delay: 0.2s; }
.loading__dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes loading-blink {
    0%, 100% { opacity: 0.2; }
    50% { opacity: 1; }
}

.loading-overlay {
    text-align: center;
    padding: 4rem 0;
}

.loading-banner {
    text-align: center;
    padding: 0.75rem;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    font-weight: 300;
    opacity: 0.7;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============================================
   tool cards (landing page)
   ============================================ */

.tool-cards {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    margin: 1rem 0;
}

.tool-card {
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 2rem 2.5rem;
    text-align: center;
    transition: border-color 0.2s ease, opacity 0.2s ease;
    text-decoration: none;
    color: #fff;
    min-width: 200px;
}

.tool-card:hover {
    border-color: rgba(255, 255, 255, 0.4);
    text-decoration: none;
    opacity: 0.9;
}

.tool-card__title {
    font-size: 1.2rem;
    font-weight: 400;
    margin-bottom: 0.5rem;
}

.tool-card__desc {
    font-size: 0.8rem;
    font-weight: 300;
    opacity: 0.5;
}

.tool-card__account {
    font-size: 0.75rem;
    color: #1DB954;
    margin-top: 0.5rem;
}

.tool-card--disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

/* ============================================
   profile summary
   ============================================ */

.profile-summary {
    text-align: center;
    font-size: 0.8rem;
    font-weight: 300;
    opacity: 0.5;
    margin: 1.5rem 0;
}

.profile-summary__stats span {
    margin: 0 0.3rem;
}

.profile-summary__items span::after {
    content: ' · ';
}

.profile-summary__items span:last-child::after {
    content: '';
}

/* ============================================
   profile card (apply page)
   ============================================ */

.profile-card {
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 1.5rem 2rem;
    text-align: center;
    margin: 1rem 0;
}

.profile-card__title {
    font-weight: 300;
    font-size: 0.85rem;
    opacity: 0.4;
    margin-bottom: 0.5rem;
}

.profile-card__stats span {
    font-size: 0.85rem;
    font-weight: 300;
    margin: 0 0.3rem;
}

.profile-card__stats span::after {
    content: ' · ';
    opacity: 0.3;
}

.profile-card__stats span:last-child::after {
    content: '';
}

.profile-card__sources {
    font-size: 0.75rem;
    font-weight: 300;
    opacity: 0.4;
    margin-top: 0.5rem;
}

/* ============================================
   capture complete
   ============================================ */

.capture-complete {
    text-align: center;
    padding: 2rem 0;
}

.capture-complete__title {
    font-weight: 300;
    font-size: 1.4rem;
    margin-bottom: 1rem;
}

.capture-complete__stats span {
    font-weight: 300;
    font-size: 0.85rem;
    opacity: 0.6;
    margin: 0 0.3rem;
}

.capture-complete__stats span::after {
    content: ' · ';
    opacity: 0.3;
}

.capture-complete__stats span:last-child::after {
    content: '';
}

.capture-complete__sources {
    font-size: 0.75rem;
    font-weight: 300;
    opacity: 0.4;
    margin-top: 0.5rem;
}

/* ============================================
   api usage tracker
   ============================================ */

.api-usage {
    text-align: center;
    padding: 1rem 0;
    font-size: 0.7rem;
    font-weight: 300;
    opacity: 0.3;
    transition: opacity 0.3s ease;
}

.api-usage--active {
    opacity: 0.6;
    animation: api-pulse 2s ease-in-out infinite;
}

@keyframes api-pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 0.3; }
}

.api-usage__count {
    margin-right: 0.5rem;
}

.api-usage__warn {
    color: #ff0100;
    opacity: 1;
}

/* ============================================
   responsive
   ============================================ */

@media (max-width: 600px) {
    .container {
        width: 94%;
    }

    .tool-cards {
        flex-direction: column;
        align-items: center;
    }

    .tool-card {
        min-width: 0;
        width: 100%;
    }

    .category__actions {
        gap: 0.3rem;
    }
}
