:root {
    color-scheme: dark;
    /* iOS 26 Design System - Pro/Futuristic */
    --primary-color: #007AFF;
    --success-color: #34C759;
    --warning-color: #FF9500;
    --danger-color: #FF3B30;

    /* Dark Theme (Default iOS 26 Pro) */
    --bg-body: #000000;
    --bg-card: rgba(255, 255, 255, 0.08);
    --bg-header: rgba(0, 0, 0, 0.7);
    --text-primary: #FFFFFF;
    --text-secondary: rgba(255, 255, 255, 0.6);
    --border-color: rgba(255, 255, 255, 0.15);
    --input-bg: rgba(255, 255, 255, 0.05);
    --hover-bg: rgba(255, 255, 255, 0.1);
    --card-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    --border-radius: 28px;
    --header-height: 70px;
    --glass-blur: blur(20px);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", sans-serif;
    background-color: var(--bg-body);
    background-image: radial-gradient(circle at 0% 0%, #0c1221 0%, transparent 40%),
        radial-gradient(circle at 100% 100%, #1c1c1e 0%, transparent 40%);
    background-attachment: fixed;
    color: var(--text-primary);
    transition: background 0.8s ease, color 0.5s ease;
    line-height: 1.5;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Ambient background blobs for iOS 26 look globably */
body::before,
body::after {
    content: "";
    position: fixed;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    filter: blur(120px);
    z-index: -1;
    opacity: 0.25;
}

body::before {
    top: -150px;
    left: -150px;
    background: #007AFF;
    animation: flowGlobal 25s infinite alternate;
}

body::after {
    bottom: -150px;
    right: -150px;
    background: #5856D6;
    animation: flowGlobal 30s infinite alternate-reverse;
}

@keyframes flowGlobal {
    from {
        transform: translate(0, 0) scale(1);
    }

    to {
        transform: translate(150px, 150px) scale(1.3);
    }
}

header {
    background-color: var(--bg-header);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--border-color);
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    font-size: 22px;
    color: var(--text-primary);
    text-decoration: none;
    letter-spacing: -0.5px;
}

.brand i {
    color: var(--primary-color);
    font-size: 28px;
    filter: drop-shadow(0 0 10px rgba(0, 122, 255, 0.5));
}

.controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

nav {
    display: flex;
    gap: 8px;
}

.nav-link {
    text-decoration: none;
    color: var(--text-secondary);
    padding: 10px 20px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.6s cubic-bezier(0.19, 1, 0.22, 1);
}

.nav-link:hover {
    color: var(--text-primary);
    background-color: var(--hover-bg);
}

.nav-link.active {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 4px 15px rgba(0, 122, 255, 0.3);
}

/* Form Controls */
.theme-btn,
.lang-select {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    outline: none;
}

.theme-btn:hover {
    background: var(--hover-bg);
}

.lang-select {
    font-size: 20px;
    padding: 4px 8px;
    border: none;
}

.lang-select:hover {
    background: var(--hover-bg);
}

/* Fix dropdown options visibility in some browsers */
.lang-select option {
    background-color: #1c1c1e;
    color: #ffffff;
    padding: 10px;
}

main {
    flex: 1;
    max-width: 1200px;
    width: 100%;
    margin: 40px auto;
    padding: 0 24px;
}

.title-area {
    text-align: center;
    margin-bottom: 30px;
}

h1 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 8px;
}

h2 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.subtitle {
    color: var(--text-secondary);
    font-size: 17px;
    max-width: 600px;
    margin: 0 auto;
}

.card {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-radius: var(--border-radius);
    padding: 32px;
    box-shadow: var(--card-shadow);
    margin-bottom: 32px;
    border: 1px solid var(--border-color);
    transition: transform 0.6s cubic-bezier(0.19, 1, 0.22, 1);
    position: relative;
    overflow: hidden;
}

.card::after {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.03), transparent);
    transform: rotate(30deg);
    pointer-events: none;
}

.card:hover {
    transform: translateY(-2px);
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

@media (max-width: 768px) {
    .grid-2 {
        grid-template-columns: 1fr;
    }

    header {
        padding: 12px;
        height: auto;
        flex-direction: column;
        gap: 12px;
    }

    nav {
        width: 100%;
        overflow-x: auto;
        padding-bottom: 5px;
    }

    .controls {
        width: 100%;
        justify-content: space-between;
        margin-top: 10px;
    }
}

textarea {
    width: 100%;
    min-height: 200px;
    padding: 20px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-family: inherit;
    font-size: 16px;
    resize: vertical;
    background-color: var(--input-bg);
    color: var(--text-primary);
    transition: all 0.5s ease;
    outline: none;
}

textarea:focus {
    border-color: var(--primary-color);
    background-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 20px rgba(0, 122, 255, 0.2);
}

.helper-text {
    background: rgba(0, 122, 255, 0.08);
    /* Light blue tint */
    padding: 12px;
    border-radius: 8px;
    font-size: 13px;
    color: var(--primary-color);
    margin-bottom: 16px;
    display: flex;
    gap: 10px;
}

[data-theme="dark"] .helper-text {
    background: rgba(10, 132, 255, 0.15);
    color: #4da3ff;
}

.helper-link {
    text-decoration: underline;
    font-weight: 600;
    cursor: pointer;
    color: inherit;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 54px;
    padding: 0 30px;
    background: linear-gradient(135deg, #007AFF 0%, #00C6FF 100%);
    color: white;
    border: none;
    border-radius: 16px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.5s cubic-bezier(0.19, 1, 0.22, 1);
    width: 100%;
    box-shadow: 0 10px 20px rgba(0, 122, 255, 0.3);
}

.btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px rgba(0, 122, 255, 0.4);
    filter: brightness(1.1);
}

.btn:active:not(:disabled) {
    transform: scale(0.98);
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: #444;
    box-shadow: none;
}

.btn-danger {
    background-color: var(--danger-color);
    display: none;
    /* hidden default */
}

.btn-danger:hover {
    background-color: #d63a32;
}

.check-group {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

/* Progress Bar */
.progress-container {
    height: 6px;
    width: 100%;
    background: var(--input-bg);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 20px;
    display: none;
    /* hidden by default */
}

.progress-bar {
    height: 100%;
    background: var(--primary-color);
    width: 0%;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-text {
    font-size: 13px;
    color: var(--text-secondary);
    text-align: center;
    margin-top: 8px;
    display: none;
}

/* Stats */
.stats-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    padding: 24px;
    border-radius: 24px;
    text-align: center;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-color);
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    display: block;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
}

/* Upload & Mode */
.file-upload {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 32px;
    text-align: center;
    cursor: pointer;
    background: var(--input-bg);
    margin: 16px 0;
    transition: all 0.2s;
}

.file-upload:hover {
    border-color: var(--primary-color);
}

.file-upload i {
    font-size: 32px;
    color: var(--primary-color);
    margin-bottom: 12px;
}

.mode-selector {
    background: var(--input-bg);
    padding: 4px;
    border-radius: 10px;
    display: flex;
    margin: 16px 0;
    border: 1px solid var(--border-color);
}

.mode-btn {
    flex: 1;
    padding: 10px 16px;
    text-align: center;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-secondary);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.mode-btn:hover:not(.active) {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.mode-btn.active {
    background: #10b981;
    /* Precise Green from image */
    color: white !important;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
    transform: scale(1.02);
    border: none;
}

#slowMode.active,
#fastMode.active {
    background: #10b981;
}

/* Results */
.result-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

.label {
    color: var(--text-primary);
    font-weight: 500;
}

.count-badge {
    padding: 4px 12px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 14px;
}

.actions {
    gap: 8px;
    display: flex;
}

.action-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--input-bg);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-btn:hover {
    background: var(--hover-bg);
}

/* Badges Colors */
.bg-success {
    background: var(--success-color);
    color: white;
}

.bg-warning {
    background: var(--warning-color);
    color: white;
}

.bg-danger {
    background: var(--danger-color);
    color: white;
}

.bg-neutral {
    background: var(--text-secondary);
    color: white;
}

/* Table */
.table-container {
    max-height: 400px;
    overflow-y: auto;
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-top: 16px;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 300px;
}

th,
td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    word-break: break-word;
    max-width: 300px;
}

th {
    background: #1c1c1e;
    /* Solid background to prevent overlap */
    position: sticky;
    top: 0;
    z-index: 10;
    font-weight: 700;
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

footer {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
    font-size: 13px;
}

.social-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    background: rgba(0, 122, 255, 0.1);
    padding: 6px 12px;
    border-radius: 999px;
}

.iframe-wrapper iframe {
    height: calc(100vh - 200px);
    border-radius: var(--border-radius);
    border: none;
    width: 100%;
}

/* Ad Sidebars */
/* Ad sidebars removed - replaced by popup */

/* Advertisement Popup Styles */
.ad-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.6s ease;
    backdrop-filter: blur(5px);
    pointer-events: none;
}

.ad-popup.show {
    opacity: 1;
    pointer-events: auto;
}

.ad-popup-content {
    position: relative;
    width: 90%;
    max-width: 400px;
    /* Square limit */
    aspect-ratio: 1 / 1;
    background: #fff;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    transform: scale(0.9);
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ad-popup.show .ad-popup-content {
    transform: scale(1);
}

.ad-popup img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.close-popup {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.close-popup:hover {
    background: rgba(0, 0, 0, 0.8);
}

/* Mobile UI Optimizations for Results */
@media (max-width: 480px) {
    .result-row {
        padding: 12px 8px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .result-row .label {
        font-size: 14px;
        flex: 1;
        min-width: 80px;
    }

    .result-row .actions {
        width: 100%;
        justify-content: flex-end;
    }

    .count-badge {
        font-size: 12px;
        padding: 2px 8px;
    }

    .action-btn {
        width: 28px;
        height: 28px;
    }
}

/* Toast Notifications */
#toastContainer {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--card-bg);
    color: var(--text-primary);
    padding: 12px 24px;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
    border-left: 4px solid var(--primary-color);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: toast-in 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    min-width: 280px;
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.toast.success {
    border-left-color: #22c55e;
}

.toast.error {
    border-left-color: #ef4444;
}

.toast.warning {
    border-left-color: #f59e0b;
}

.toast.info {
    border-left-color: #3b82f6;
}

.toast.hide {
    opacity: 0;
    transform: translateX(50px);
    transition: all 0.6s ease;
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateX(50px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}