/* ===== InstaTrack V2 — Mobile-First CSS ===== */
:root {
    --bg: #0a0a0f;
    --bg-card: rgba(255, 255, 255, 0.04);
    --bg-card-hover: rgba(255, 255, 255, 0.07);
    --border: rgba(255, 255, 255, 0.08);
    --text: #f0f0f5;
    --text-dim: #a0a0b0;
    --text-muted: #666680;
    --accent: #e6683c;
    --accent2: #bc1888;
    --gradient: linear-gradient(135deg, #f09433, #e6683c, #bc1888, #833ab4);
    --green: #22c55e;
    --red: #ef4444;
    --yellow: #eab308;
    --radius: 14px;
    --radius-sm: 8px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    padding-bottom: 70px;
}

/* ===== BG Glows ===== */
.bg-glow {
    position: fixed;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.15;
    pointer-events: none;
    z-index: 0;
}

.bg-glow-1 {
    width: 400px;
    height: 400px;
    background: #e6683c;
    top: -100px;
    right: -100px;
}

.bg-glow-2 {
    width: 350px;
    height: 350px;
    background: #833ab4;
    bottom: 100px;
    left: -100px;
}

.container {
    max-width: 480px;
    margin: 0 auto;
    padding: 16px;
    position: relative;
    z-index: 1;
}

/* ===== Header ===== */
.header {
    text-align: center;
    padding: 16px 0 8px;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 800;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ===== Cards ===== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    backdrop-filter: blur(20px);
}

.card-header h2 {
    font-size: 1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-header p {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ===== Inputs ===== */
.input-group {
    margin-top: 12px;
}

.input-group label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-wrapper {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-top: 6px;
    overflow: hidden;
    transition: border-color 0.2s;
}

.input-wrapper:focus-within {
    border-color: var(--accent);
}

.input-prefix {
    padding: 0 10px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.input-wrapper input,
.input-wrapper textarea {
    flex: 1;
    background: none;
    border: none;
    color: var(--text);
    padding: 10px;
    font-size: 0.9rem;
    outline: none;
    font-family: inherit;
}

.input-wrapper textarea {
    min-height: 80px;
    resize: vertical;
}

/* ===== Buttons ===== */
.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.btn:active {
    transform: scale(0.98);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--gradient);
    color: white;
    margin-top: 14px;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
    margin-top: 10px;
    border: 1px solid var(--border);
}

.btn-sm {
    padding: 8px 14px;
    font-size: 0.78rem;
    width: auto;
}

.btn-green {
    background: rgba(34, 197, 94, 0.15);
    color: var(--green);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.btn-ghost {
    background: none;
    color: var(--text-dim);
}

.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===== Tabs ===== */
.tabs {
    display: flex;
    gap: 4px;
    margin: 12px 0;
    background: rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-sm);
    padding: 3px;
}

.tab {
    flex: 1;
    text-align: center;
    padding: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s;
}

.tab.active {
    background: var(--gradient);
    color: white;
}

.tab .tab-count {
    font-size: 0.65rem;
    opacity: 0.7;
}

/* ===== Connected Bar ===== */
.status-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: rgba(34, 197, 94, 0.08);
    border: 1px solid rgba(34, 197, 94, 0.15);
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    font-size: 0.75rem;
    color: var(--green);
}

.status-bar.warn {
    background: rgba(234, 179, 8, 0.08);
    border-color: rgba(234, 179, 8, 0.15);
    color: var(--yellow);
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

/* ===== Profile Card ===== */
.profile-card .profile-header {
    display: flex;
    gap: 14px;
    align-items: center;
}

.profile-pic {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border);
    flex-shrink: 0;
    background: var(--bg-card);
}

.profile-info h2 {
    font-size: 1rem;
    font-weight: 700;
}

.profile-username {
    font-size: 0.8rem;
    color: var(--accent);
}

.profile-bio {
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-top: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.stats-row {
    display: flex;
    gap: 12px;
    margin-top: 14px;
}

.stat {
    flex: 1;
    text-align: center;
    padding: 10px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-sm);
}

.stat-value {
    display: block;
    font-size: 1.1rem;
    font-weight: 800;
}

.stat-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.profile-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.profile-actions .btn {
    flex: 1;
}

/* ===== Saved Profiles ===== */
.profile-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.profile-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.2s;
}

.profile-item:active {
    background: rgba(255, 255, 255, 0.08);
}

.profile-item img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--bg-card);
}

.profile-item-info {
    flex: 1;
    min-width: 0;
}

.profile-item-info .name {
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-item-info .meta {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.profile-item .arrow {
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* ===== Progress ===== */
.progress-section {
    margin-bottom: 12px;
}

.progress-bar-container {
    height: 4px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--gradient);
    border-radius: 4px;
    transition: width 0.3s;
    width: 0%;
}

.progress-text {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 6px;
}

/* ===== Error ===== */
.error-card {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    font-size: 0.8rem;
    color: var(--red);
}

/* ===== Table ===== */
.table-card .table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.badge {
    font-size: 0.65rem;
    padding: 3px 10px;
    border-radius: 20px;
    background: var(--gradient);
    color: white;
    font-weight: 600;
}

.search-bar {
    margin: 10px 0;
}

.search-bar input {
    width: 100%;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    color: var(--text);
    font-size: 0.82rem;
    outline: none;
}

.search-bar input:focus {
    border-color: var(--accent);
}

.table-wrapper {
    overflow-x: auto;
    margin-top: 8px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
}

thead th {
    text-align: left;
    padding: 8px 6px;
    color: var(--text-muted);
    font-size: 0.65rem;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border);
}

tbody td {
    padding: 8px 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    vertical-align: middle;
}

tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.follower-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--bg-card);
}

.follower-username a {
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
}

.follower-username a:hover {
    color: var(--accent);
}

.follower-name {
    color: var(--text-dim);
    font-size: 0.72rem;
}

/* ===== Badges ===== */
.badge-new {
    font-size: 0.6rem;
    padding: 2px 6px;
    border-radius: 10px;
    background: rgba(34, 197, 94, 0.15);
    color: var(--green);
    font-weight: 600;
}

.badge-lost {
    font-size: 0.6rem;
    padding: 2px 6px;
    border-radius: 10px;
    background: rgba(239, 68, 68, 0.15);
    color: var(--red);
    font-weight: 600;
}

.badge-mutual {
    font-size: 0.6rem;
    padding: 2px 6px;
    border-radius: 10px;
    background: rgba(139, 92, 246, 0.15);
    color: #a78bfa;
    font-weight: 600;
}

.badge-private {
    font-size: 0.6rem;
    padding: 2px 6px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-dim);
}

.badge-verified {
    font-size: 0.6rem;
    padding: 2px 6px;
    border-radius: 10px;
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    font-weight: 600;
}

/* ===== Changes Summary ===== */
.changes-summary {
    display: flex;
    gap: 8px;
    margin: 10px 0;
}

.change-box {
    flex: 1;
    text-align: center;
    padding: 10px;
    border-radius: var(--radius-sm);
}

.change-box.new-box {
    background: rgba(34, 197, 94, 0.08);
    border: 1px solid rgba(34, 197, 94, 0.15);
}

.change-box.lost-box {
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.15);
}

.change-box .num {
    font-size: 1.2rem;
    font-weight: 800;
}

.change-box.new-box .num {
    color: var(--green);
}

.change-box.lost-box .num {
    color: var(--red);
}

.change-box .lbl {
    font-size: 0.6rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* ===== Analytics ===== */
.run-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: background 0.2s;
}

.run-item:active {
    background: rgba(255, 255, 255, 0.08);
}

.run-type {
    font-size: 0.6rem;
    padding: 2px 6px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-dim);
    font-weight: 600;
    text-transform: uppercase;
}

.run-date {
    color: var(--text-muted);
    flex: 1;
    text-align: right;
    font-size: 0.7rem;
}

.run-stat {
    font-weight: 700;
}

/* ===== Entry List (run detail) ===== */
.entry-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.entry-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
    font-size: 0.78rem;
}

.entry-num {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 600;
    min-width: 22px;
    text-align: right;
    flex-shrink: 0;
}

.entry-item img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--bg-card);
}

.entry-item .entry-username {
    font-weight: 600;
}

.entry-item .entry-username a {
    color: var(--text);
    text-decoration: none;
}

.entry-item .entry-username a:hover {
    color: var(--accent);
}

.entry-item .entry-name {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.entry-empty {
    font-size: 0.75rem;
    color: var(--text-muted);
    padding: 8px;
    text-align: center;
}

/* ===== Run Item Enhancements ===== */
.run-item .run-changes {
    display: flex;
    gap: 6px;
    margin-left: auto;
}

.run-item .run-change-badge {
    font-size: 0.6rem;
    padding: 1px 5px;
    border-radius: 4px;
    font-weight: 600;
}

.run-change-badge.new-badge {
    background: rgba(34, 197, 94, 0.15);
    color: var(--green);
}

.run-change-badge.lost-badge {
    background: rgba(239, 68, 68, 0.15);
    color: var(--red);
}

/* ===== Run Type Selector ===== */
.run-type-btn {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
    border: 1px solid var(--border);
    font-size: 0.7rem;
    padding: 6px 8px;
    margin-top: 0;
    transition: all 0.2s;
}

.run-type-btn.active {
    background: rgba(230, 104, 60, 0.15);
    color: var(--accent);
    border-color: rgba(230, 104, 60, 0.4);
}

/* ===== Pagination ===== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 12px;
    padding: 8px 0;
}

.pg-btn {
    min-width: 28px;
    height: 28px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-muted);
    border-radius: 6px;
    font-size: 0.72rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.pg-btn:hover:not(.disabled):not(.active) {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text);
}

.pg-btn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    font-weight: 700;
}

.pg-btn.disabled {
    opacity: 0.3;
    cursor: default;
}

.pg-dots {
    font-size: 0.7rem;
    color: var(--text-muted);
    padding: 0 2px;
}

/* ===== Active Account ===== */
.account-active {
    border: 1px solid rgba(34, 197, 94, 0.3);
    background: rgba(34, 197, 94, 0.05);
}

.acc-del-btn {
    background: none;
    border: none;
    font-size: 0.8rem;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    transition: background 0.2s;
    opacity: 0.5;
    flex-shrink: 0;
}

.acc-del-btn:hover {
    opacity: 1;
    background: rgba(239, 68, 68, 0.15);
}

/* ===== Cookie Page ===== */
.divider-text {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.72rem;
    margin: 10px 0;
}

/* ===== Bottom Nav ===== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(10, 10, 15, 0.95);
    border-top: 1px solid var(--border);
    backdrop-filter: blur(20px);
    display: flex;
    z-index: 100;
}

.nav-item {
    flex: 1;
    text-align: center;
    padding: 10px 0 8px;
    font-size: 0.6rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s;
}

.nav-item.active {
    color: var(--accent);
}

.nav-icon {
    font-size: 1.2rem;
    display: block;
    margin-bottom: 2px;
}

/* ===== Page Sections ===== */
.page {
    display: none;
}

.page.active {
    display: block;
}

/* ===== Footer ===== */
.footer {
    text-align: center;
    padding: 16px;
    font-size: 0.65rem;
    color: var(--text-muted);
}

/* ===== Responsive ===== */
@media (min-width: 600px) {
    .container {
        max-width: 560px;
        padding: 20px;
    }

    .profile-pic {
        width: 80px;
        height: 80px;
    }
}