:root {
    --bg-color: #141414;
    --card-bg: rgba(30, 30, 30, 0.6);
    --card-border: rgba(255, 255, 255, 0.1);
    --accent-red: #E50914;
    --accent-red-hover: #b8070f;
    --text-main: #FFFFFF;
    --text-muted: #B3B3B3;
    --font-family: 'Inter', sans-serif;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: var(--font-family);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow-x: hidden;
}

.background-animation {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    background: radial-gradient(circle at 50% 0%, rgba(229, 9, 20, 0.15), transparent 60%);
}

.container {
    width: 100%;
    max-width: 800px;
    padding: 40px 20px;
    z-index: 1;
}

header {
    text-align: center;
    margin-bottom: 40px;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    letter-spacing: -0.5px;
}

.highlight {
    color: var(--accent-red);
}

header p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

main {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.input-section {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.input-section:focus-within {
    transform: translateY(-2px);
    box-shadow: 0 25px 50px rgba(229, 9, 20, 0.15);
}

label {
    display: block;
    margin-bottom: 12px;
    font-weight: 600;
    font-size: 1.05rem;
}

textarea {
    width: 100%;
    height: 150px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 16px;
    color: var(--text-main);
    font-family: monospace;
    font-size: 0.95rem;
    resize: vertical;
    transition: border-color 0.3s ease;
}

textarea:focus {
    outline: none;
    border-color: var(--accent-red);
}

.btn-primary {
    background-color: var(--accent-red);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 14px 24px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    margin-top: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

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

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

.btn-primary svg {
    width: 20px;
    height: 20px;
    transition: transform 0.3s ease;
}

.btn-primary:hover svg {
    transform: translateX(4px);
}

.error-message {
    display: none;
    background: rgba(229, 9, 20, 0.1);
    border: 1px solid var(--accent-red);
    color: #ff4d4d;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    font-weight: 500;
    line-height: 1.5;
    white-space: pre-line;
    word-break: break-word;
    animation: fadeIn 0.3s ease;
}
.results-section {
    display: none;
    flex-direction: column;
    gap: 15px;
    animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.account-info-card {
    background: rgba(229, 9, 20, 0.05);
    border: 1px solid rgba(229, 9, 20, 0.2);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.account-info-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.account-info-item .label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.account-info-item .value {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
    word-break: break-all;
}

.results-section.active {
    display: flex;
}

.results-section h2 {
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.link-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    transition: transform 0.2s ease, background 0.2s ease;
}

.link-card:hover {
    background: rgba(40, 40, 40, 0.8);
    transform: scale(1.01);
}

.link-info {
    flex: 1;
    overflow: hidden;
}

.link-info h3 {
    font-size: 1.1rem;
    margin-bottom: 6px;
    color: #e5e5e5;
}

.truncate-text {
    color: var(--text-muted);
    font-family: monospace;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: rgba(0,0,0,0.2);
    padding: 8px;
    border-radius: 4px;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid var(--card-border);
    border-radius: 6px;
    padding: 10px 20px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 100px;
}

.btn-secondary:hover {
    background: white;
    color: black;
}

.link-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-shrink: 0;
}

.copy-btn svg {
    width: 15px;
    height: 15px;
    vertical-align: middle;
    margin-right: 4px;
}

.btn-secondary.copied {
    background: #4ade80;
    border-color: #4ade80;
    color: #000;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@media (max-width: 600px) {
    .link-card {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    .link-actions {
        flex-direction: column;
        gap: 8px;
    }
    .btn-secondary {
        width: 100%;
    }
    .device-btn {
        flex-direction: column;
        gap: 4px;
        font-size: 0.85rem;
        padding: 10px 6px;
    }
    .profiles-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    .profile-card {
        padding: 12px !important;
    }
    .profile-avatar {
        width: 48px !important;
        height: 48px !important;
    }
}

/* ---------- Profiles grid ---------- */
.profile-count-badge {
    display: inline-block;
    background: var(--accent-red);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 999px;
    vertical-align: middle;
    margin-left: 6px;
}

.profiles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 2rem;
}

.profile-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.profile-card:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.25);
}

.profile-card.pin-locked {
    border-color: rgba(229, 9, 20, 0.5);
    background: rgba(229, 9, 20, 0.08);
}

.profile-avatar {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    object-fit: cover;
    flex-shrink: 0;
    color: transparent;
}

.profile-avatar.placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 1.4rem;
    font-weight: 700;
}

.profile-meta {
    flex: 1;
    min-width: 0;
}

.profile-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

.profile-tag {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
}

.profile-tag.pin {
    background: rgba(229, 9, 20, 0.2);
    color: #ff6b6b;
}

.profile-tag.kids {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
}

.profile-tag.owner {
    background: rgba(250, 204, 21, 0.15);
    color: #fde047;
}

.profile-tag.active {
    background: rgba(34, 197, 94, 0.18);
    color: #86efac;
}

.profile-empty {
    grid-column: 1 / -1;
    color: var(--text-muted);
    font-size: 0.95rem;
    text-align: center;
    padding: 20px;
}

/* ---------- Device selector ---------- */
.device-block {
    margin-top: 20px;
}

.device-label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-main);
}

.device-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    padding: 6px;
}

.device-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 10px;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid transparent;
    border-radius: 8px;
    font-family: var(--font-family);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.device-btn svg {
    width: 18px;
    height: 18px;
}

.device-btn:hover:not(:disabled):not(.active) {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
}

.device-btn.active {
    background: var(--accent-red);
    color: #fff;
    border-color: var(--accent-red);
}

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

.device-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 8px;
}

.link-card[hidden],
.link-empty[hidden],
.account-notice[hidden] {
    display: none !important;
}

.account-notice {
    margin: -1rem 0 1.5rem;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid rgba(250, 204, 21, 0.45);
    background: rgba(250, 204, 21, 0.1);
    color: #fde047;
    font-size: 0.9rem;
    line-height: 1.4;
}

.link-empty {
    color: var(--text-muted);
    font-size: 0.95rem;
    text-align: center;
    padding: 18px;
    border: 1px dashed var(--card-border);
    border-radius: 12px;
}

/* ---------- Cookie format hint ---------- */
.cookie-format-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 8px;
    text-align: right;
}

.cookie-format-hint code {
    background: rgba(255, 255, 255, 0.08);
    padding: 1px 6px;
    border-radius: 4px;
    color: #e5e5e5;
}

/* ---------- Toolbar, Import Summary & Secondary Actions ---------- */
.input-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.input-header-row label {
    margin-bottom: 0;
}

.input-toolbar,
.section-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.btn-compact {
    padding: 7px 12px;
    font-size: 0.82rem;
    min-width: auto;
}

.btn-link-anchor {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

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

.secondary-actions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}

.import-summary {
    margin-top: 12px;
    padding: 12px 14px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--card-border);
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.import-summary[hidden],
.multi-links-panel[hidden],
.token-status-bar[hidden] {
    display: none !important;
}

.import-summary-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* ---------- Extended Account Details, Profiles & Status ---------- */
.results-section h3 {
    font-size: 1.05rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.account-extra-card {
    background: rgba(255, 255, 255, 0.03);
    border-color: var(--card-border);
}

.section-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.section-header-row h2 {
    margin-bottom: 0;
}

.profile-honest-hint,
.panel-hint {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.profile-card {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
}

.profile-card-top {
    display: flex;
    align-items: center;
    gap: 12px;
}

.profile-submeta {
    margin-top: 6px;
    font-size: 0.74rem;
    color: var(--text-muted);
    line-height: 1.35;
    word-break: break-word;
}

.profile-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.profile-actions .btn-secondary {
    padding: 5px 9px;
    font-size: 0.74rem;
    min-width: auto;
    flex: 1 1 auto;
}

.token-status-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.status-pill {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(34, 197, 94, 0.18);
    color: #86efac;
}

.status-pill.dead {
    background: rgba(229, 9, 20, 0.22);
    color: #ff6b6b;
}

.status-pill.error {
    background: rgba(250, 204, 21, 0.18);
    color: #fde047;
}

.token-expiry-text {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.multi-links-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.multi-link-row,
.bulk-item,
.vault-item {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.multi-link-info,
.bulk-item-info,
.vault-item-info {
    flex: 1 1 240px;
    min-width: 0;
}

.multi-link-info h4,
.bulk-item-title,
.vault-item-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 4px;
}

/* ---------- Bulk Check & Vault Panels ---------- */
.panel-section {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.bulk-textarea {
    height: 110px;
}

.bulk-results,
.vault-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.vault-warning {
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid rgba(250, 204, 21, 0.4);
    background: rgba(250, 204, 21, 0.08);
    color: #fde047;
    font-size: 0.82rem;
    line-height: 1.4;
}

.vault-empty {
    color: var(--text-muted);
    font-size: 0.88rem;
    text-align: center;
    padding: 12px;
}

@media (max-width: 600px) {
    .link-actions {
        flex-wrap: wrap;
    }
    .secondary-actions-row .btn-secondary {
        flex: 1 1 100%;
    }
}
