:root {
    --bg-dark: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.7);
    --border-light: rgba(255, 255, 255, 0.1);
    --primary: #38bdf8;
    --primary-glow: rgba(56, 189, 248, 0.4);
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --font-family: 'Outfit', sans-serif;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-dark);
    font-family: var(--font-family);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    position: relative;
}

/* Background Animations */
.background-globes {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: -1;
}

.globe {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
}

.globe-1 {
    top: -10%;
    left: -10%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, #4f46e5, transparent 70%);
    animation: float 20s infinite alternate;
}

.globe-2 {
    bottom: -10%;
    right: -10%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, #06b6d4, transparent 70%);
    animation: float 15s infinite alternate-reverse;
}

@keyframes float {
    0% {
        transform: translate(0, 0);
    }

    100% {
        transform: translate(30px, 30px);
    }
}

/* Main Container */
.app-container {
    width: 90%;
    max-width: 1000px;
    padding: 2rem;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-light);
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: slideIn 0.6s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Header */
.app-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.logo {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.logo i {
    color: var(--primary);
}

.highlight {
    background: linear-gradient(135deg, #fff, #94a3b8);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.tagline {
    color: var(--text-muted);
    font-weight: 300;
}

/* Input Section */
.input-section {
    margin-bottom: 2rem;
}

.input-group {
    display: flex;
    gap: 10px;
    background: rgba(15, 23, 42, 0.6);
    padding: 8px;
    border-radius: 16px;
    border: 1px solid var(--border-light);
    transition: var(--transition);
}

.input-group:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.input-icon {
    padding: 12px 0 12px 16px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
}

input {
    flex: 1;
    background: transparent;
    border: none;
    color: #fff;
    padding: 12px;
    font-size: 1rem;
    outline: none;
    font-family: inherit;
}

.btn-primary {
    background: var(--primary);
    color: #0f172a;
    border: none;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-primary:hover {
    background: #7dd3fc;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--primary-glow);
}

.options {
    margin-top: 1rem;
    display: flex;
    justify-content: center;
}

.checkbox-container {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.9rem;
    user-select: none;
}

.checkbox-container input {
    display: none;
}

.checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-light);
    border-radius: 6px;
    position: relative;
    transition: var(--transition);
}

.checkbox-container input:checked~.checkmark {
    background: var(--primary);
    border-color: var(--primary);
}

.checkmark::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid #0f172a;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    opacity: 0;
}

.checkbox-container input:checked~.checkmark::after {
    opacity: 1;
}

/* Results Section */
.results-section {
    opacity: 1;
    transition: opacity 0.5s ease;
}

.results-section.hidden {
    display: none;
    opacity: 0;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-light);
}

.results-header h2 {
    font-size: 1.25rem;
    font-weight: 500;
}

.badge {
    background: rgba(56, 189, 248, 0.1);
    color: var(--primary);
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.85rem;
    margin-left: 8px;
}

.actions {
    display: flex;
    gap: 8px;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-light);
    color: var(--text-muted);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.2);
}

.results-container {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 5px;
}

/* Custom Scrollbar */
.results-container::-webkit-scrollbar {
    width: 6px;
}

.results-container::-webkit-scrollbar-track {
    background: transparent;
}

.results-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.results-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

#urlList {
    list-style: none;
}

.url-item {
    padding: 12px;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.95rem;
    color: var(--text-muted);
    word-break: break-all;
    display: flex;
    align-items: center;
    justify-content: space-between;
    /* Changed to space-between */
    gap: 15px;
    animation: fadeInItem 0.3s forwards;
}

.url-item:last-child {
    border-bottom: none;
}

.url-text {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.url-text i {
    font-size: 0.8rem;
    color: var(--primary);
    opacity: 0.7;
    flex-shrink: 0;
}

.url-actions {
    display: flex;
    gap: 8px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.url-item:hover .url-actions {
    opacity: 1;
}

.action-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-light);
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.action-btn:hover {
    background: var(--primary);
    color: #0f172a;
    border-color: var(--primary);
    transform: scale(1.05);
}

.action-btn.google-btn:hover {
    background: #4285F4;
    border-color: #4285F4;
    color: white;
}

@keyframes fadeInItem {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Loader */
.loader {
    text-align: center;
    padding: 2rem;
}

.loader.hidden {
    display: none;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(56, 189, 248, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Notifications */
.notification {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(10px);
    padding: 12px 24px;
    border-radius: 50px;
    border: 1px solid var(--border-light);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    font-size: 0.9rem;
    z-index: 100;
    animation: popUp 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.notification.hidden {
    display: none;
}

.notification.error {
    border-color: rgba(220, 38, 38, 0.5);
    color: #fca5a5;
}

.notification.success {
    border-color: rgba(34, 197, 94, 0.5);
    color: #86efac;
}

@keyframes popUp {
    from {
        transform: translate(-50%, 20px);
        opacity: 0;
    }

    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

/* Settings Panel */
.settings-panel {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--border-light);
    border-radius: 16px;
    padding: 1.5rem;
    margin-top: 1rem;
    animation: slideDown 0.3s ease-out;
}

.settings-panel.hidden {
    display: none;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.api-input-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-main);
    font-size: 0.9rem;
}

.api-input-group input {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 10px;
    color: #fff;
    margin-bottom: 0.5rem;
}

.api-input-group input:focus {
    border-color: var(--primary);
    outline: none;
}

.hint {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.btn-text {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.9rem;
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 5px;
}

.btn-text:hover {
    color: var(--primary);
}

.options {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Status Badges */
.status-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.status-badge.pending {
    background: rgba(148, 163, 184, 0.2);
    color: #94a3b8;
}

.status-badge.indexed {
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.status-badge.not-indexed {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}


/* Counter Badges */
.badge-success {
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.badge-error {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}


/* Filter Buttons */
.header-top {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    flex: 1;
}

.filter-group {
    display: flex;
    gap: 8px;
    margin-top: 5px;
}

.filter-btn {
    background: transparent;
    border: 1px solid var(--border-light);
    color: var(--text-muted);
    padding: 6px 12px;
    font-size: 0.85rem;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-btn:hover {
    border-color: var(--primary);
    color: #fff;
}

.filter-btn.active {
    background: rgba(56, 189, 248, 0.1);
    border-color: var(--primary);
    color: var(--primary);
}

/* API Save Button Group */
.input-with-btn {
    display: flex;
    gap: 8px;
}

.input-with-btn input {
    margin-bottom: 0;
    /* Reset */
}

.input-with-btn .btn-secondary {
    height: 42px;
    /* Match input height roughly */
    width: 42px;
}

@media (min-width: 600px) {
    .results-header {
        align-items: flex-start;
    }

    .header-top {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    /* Audit Tool Styles */
    .card-audit::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 100%;
        background: radial-gradient(circle at top right, rgba(16, 185, 129, 0.1), transparent 60%);
        opacity: 0;
        transition: opacity 0.4s;
    }

    .card-audit .card-icon {
        color: #10b981;
    }

    .card-audit:hover .card-action {
        color: #10b981;
    }

    .audit-list {
        display: flex;
        flex-direction: column;
        gap: 1rem;
        padding: 1rem 0;
    }

    .audit-item {
        background: rgba(255, 255, 255, 0.03);
        border: 1px solid var(--border-light);
        border-radius: 12px;
        padding: 1.25rem;
        display: flex;
        align-items: flex-start;
        gap: 15px;
        transition: transform 0.2s;
    }

    .audit-item:hover {
        background: rgba(255, 255, 255, 0.05);
    }

    .audit-icon {
        font-size: 1.5rem;
        padding-top: 2px;
    }

    .audit-icon.pass {
        color: #4ade80;
    }

    .audit-icon.fail {
        color: #f87171;
    }

    .audit-icon.warn {
        color: #fbbf24;
    }

    .audit-content h4 {
        margin-bottom: 0.25rem;
        color: var(--text-main);
    }

    .audit-content p {
        font-size: 0.9rem;
        color: var(--text-muted);
        line-height: 1.4;
    }

    .audit-score-badge {
        font-size: 0.9rem;
        font-weight: 600;
        padding: 5px 12px;
        border-radius: 20px;
    }

    .score-good {
        background: rgba(74, 222, 128, 0.2);
        color: #4ade80;
        border: 1px solid rgba(74, 222, 128, 0.3);
    }

    .score-bad {
        background: rgba(248, 113, 113, 0.2);
        color: #f87171;
        border: 1px solid rgba(248, 113, 113, 0.3);
    }

    a {
        text-decoration: none;
        color: inherit;
    }

    .tool-card-link {
        display: block;
        text-decoration: none;
        color: inherit;
    }

    .nav-back-link {
        color: var(--text-secondary);
        font-size: 0.95rem;
        transition: color 0.2s;
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .nav-back-link:hover {
        color: var(--primary);
    }

    .small-settings {
        font-size: 0.85rem;
        margin-top: 5px;
    }

    .help-text {
        text-align: center;
        margin-bottom: 2rem;
    }

    .help-text h2 {
        font-size: 1.8rem;
        margin-bottom: 0.5rem;
        background: linear-gradient(135deg, #fff 0%, #94a3b8 100%);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
    }

    .help-text p {
        color: var(--text-secondary);
    }


    /* --- Home Page Specific Styles --- */
    .home-container {
        max-width: 1200px;
        margin: 0 auto;
        display: flex;
        flex-direction: column;
        justify-content: center;
        min-height: 100vh;
        padding: 2rem;

        /* Remove Card Styles for Home */
        background: transparent;
        border: none;
        box-shadow: none;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }

    .home-hero {
        text-align: center;
        margin-bottom: 4rem;
        position: relative;
        z-index: 10;
    }

    .logo-large {
        font-size: 3rem;
        font-weight: 700;
        color: var(--text-main);
        margin-bottom: 1rem;
        letter-spacing: -1px;
        display: inline-flex;
        align-items: center;
        gap: 15px;
    }

    .logo-large i {
        color: var(--accent-color);
    }

    .hero-title {
        font-size: 3.5rem;
        font-weight: 800;
        line-height: 1.2;
        margin-bottom: 1.5rem;
        background: linear-gradient(to right, #fff, #94a3b8);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
    }

    .hero-subtitle {
        font-size: 1.2rem;
        color: var(--text-secondary);
        max-width: 600px;
        margin: 0 auto;
    }

    /* Tools Grid Home */
    .tools-grid-home {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
        gap: 2.5rem;
        padding: 0 1rem;
    }

    .tool-card-home {
        position: relative;
        display: flex;
        flex-direction: column;
        padding: 2.5rem;
        border-radius: 24px;
        background: rgba(255, 255, 255, 0.03);
        /* Default Glass */
        border: 1px solid rgba(255, 255, 255, 0.08);
        /* Subtle border */
        text-decoration: none;
        transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        overflow: hidden;
        backdrop-filter: blur(10px);
    }

    /* Specific Card Themes */
    .card-sitemap::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 100%;
        background: radial-gradient(circle at top right, rgba(56, 189, 248, 0.1), transparent 60%);
        opacity: 0;
        transition: opacity 0.4s;
    }

    .card-backlink::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 100%;
        background: radial-gradient(circle at top right, rgba(168, 85, 247, 0.1), transparent 60%);
        opacity: 0;
        transition: opacity 0.4s;
    }

    .tool-card-home:hover {
        transform: translateY(-8px);
        border-color: rgba(255, 255, 255, 0.2);
        box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.5);
    }

    .tool-card-home:hover::before {
        opacity: 1;
    }

    .card-icon {
        width: 70px;
        height: 70px;
        border-radius: 20px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 2rem;
        margin-bottom: 2rem;
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid rgba(255, 255, 255, 0.1);
        transition: transform 0.4s ease;
    }

    .card-sitemap .card-icon {
        color: #38bdf8;
    }

    .card-backlink .card-icon {
        color: #a855f7;
    }

    .tool-card-home:hover .card-icon {
        transform: scale(1.1) rotate(5deg);
        background: rgba(255, 255, 255, 0.1);
    }

    .card-content h3 {
        font-size: 1.8rem;
        color: #fff;
        margin-bottom: 1rem;
        font-weight: 600;
    }

    .card-content p {
        color: var(--text-secondary);
        font-size: 1.05rem;
        line-height: 1.6;
        margin-bottom: 2rem;
        flex-grow: 1;
    }

    .card-action {
        display: inline-flex;
        align-items: center;
        gap: 10px;
        color: #fff;
        font-weight: 500;
        font-size: 1rem;
        opacity: 0.8;
        transition: all 0.3s;
    }

    .tool-card-home:hover .card-action {
        opacity: 1;
        transform: translateX(5px);
        color: var(--accent-color);
    }

    .card-backlink:hover .card-action {
        color: #a855f7;
    }

    .home-footer {
        text-align: center;
        margin-top: 4rem;
        color: rgba(255, 255, 255, 0.2);
        font-size: 0.9rem;
    }
}

/* Link Analyzer Styles */
.card-links::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    background: radial-gradient(circle at top right, rgba(251, 146, 60, 0.1), transparent 60%);
    opacity: 0;
    transition: opacity 0.4s;
}

.card-links .card-icon {
    color: #fb923c;
}

.card-links:hover .card-action {
    color: #fb923c;
}

.stats-row {
    display: flex;
    justify-content: space-around;
    width: 100%;
    margin-bottom: 1.5rem;
}

.stat-box {
    text-align: center;
    background: rgba(255, 255, 255, 0.03);
    padding: 15px;
    border-radius: 12px;
    border: 1px solid var(--border-light);
    flex: 1;
    margin: 0 10px;
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: #fff;
}

.text-accent {
    color: var(--primary);
}

.text-warn {
    color: #fbbf24;
}

.center-filters {
    justify-content: center;
    margin-bottom: 1rem;
}

.link-list {
    display: flex;
    flex-direction: column;
}

.link-item-row {
    padding: 12px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.link-info {
    flex: 1;
    overflow: hidden;
}

.link-anchor {
    font-weight: 500;
    color: var(--text-main);
    display: block;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.link-url {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.link-type-badge {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    min-width: 80px;
    text-align: center;
}

.badge-internal {
    background: rgba(56, 189, 248, 0.1);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.2);
}

.badge-external {
    background: rgba(251, 146, 60, 0.1);
    color: #fb923c;
    border: 1px solid rgba(251, 146, 60, 0.2);
}

.text-purple {
    color: #c084fc;
}

.badge-resource {
    background: rgba(192, 132, 252, 0.1);
    color: #c084fc;
    border: 1px solid rgba(192, 132, 252, 0.2);
}