@import url("assets/home.css");
@import url("assets/news.css");
@import url("assets/greet.css");

/* --- Root Variables & Reset --- */
:root {
    --bg-color: #0f0f13;
    --card-bg: rgba(255, 255, 255, 0.03);
    --card-border: rgba(255, 255, 255, 0.08);
    --text-primary: #e2e2e7;
    --text-secondary: #a0a0b0;
    --accent-color: #4a90e2;
    --nav-bg: rgba(30, 30, 46, 0.95);
    /* Fallback for blur */
    --danger: #ef4444;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    /* UX-Finishing: No blue flash */
}

/* --- Global & Layout --- */
body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family:
        "Inter",
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        sans-serif;
    margin: 0;
    line-height: 1.5;
    display: flex;
    justify-content: center;
    min-height: 100vh;
    overflow-x: hidden;
    /* Performance: Prevent horizontal scroll */
    -webkit-tap-highlight-color: transparent;
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

.feed-container {
    width: 100%;
    max-width: 600px;
    /* Safe Areas: Top inset and mobile-friendly padding */
    padding: calc(20px + env(safe-area-inset-top)) 16px
        calc(120px + env(safe-area-inset-bottom)) 16px;
}

@media (min-width: 768px) {
    .feed-container {
        padding: 40px 20px 150px 20px;
    }
}

/* --- Navigation Dock --- */
.navbar-dock {
    position: fixed;
    /* Safe Areas: Bottom inset */
    bottom: calc(20px + env(safe-area-inset-bottom));
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--nav-bg);
    padding: 12px 24px;
    border-radius: 50px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    gap: 20px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    width: max-content;
    max-width: 90%;
}

@supports (backdrop-filter: blur(12px)) or (-webkit-backdrop-filter: blur(12px)) {
    .navbar-dock {
        background-color: rgba(30, 30, 46, 0.85);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
    }
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    /* Touch-Ergonomie: Min 44px effective height */
    padding: 10px 12px;
    user-select: none;
    /* UX-Finishing */
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
}

.nav-link:hover {
    color: #ffffff;
    transform: translateY(-3px);
}

.nav-link.active {
    color: var(--accent-color);
}

/* --- Header & Navigation --- */
.feed-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.header-main h1 {
    margin: 0;
    font-size: 1.5rem;
}

.mode-toggle {
    display: flex;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 3px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.toggle-btn {
    border: none;
    background: transparent;
    color: #8e8e93;
    padding: 8px 16px;
    border-radius: 9px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 700;
    user-select: none;
    min-height: 36px;
}

.toggle-btn.active {
    background: var(--accent-color);
    color: white;
}

.action-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 12px;
    cursor: pointer;
    font-size: 1.1rem;
    user-select: none;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- Config Panel --- */
.config-panel {
    background: rgba(30, 30, 46, 0.6);
    border: 1px solid rgba(74, 144, 226, 0.3);
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
    animation: slideIn 0.3s ease-out;
}

@supports (backdrop-filter: blur(20px)) {
    .config-panel {
        backdrop-filter: blur(20px);
    }
}

.config-input {
    flex: 1;
    padding: 14px 16px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 12px;
    /* Input-Fix: Prevent Android Auto-Zoom */
    font-size: 16px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.config-input:focus {
    outline: none;
    border-color: var(--accent-color);
}

.rss-input-row {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.add-btn {
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 12px;
    width: 50px;
    min-width: 50px;
    cursor: pointer;
    font-weight: 700;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.add-btn:active {
    transform: scale(0.9);
}

.rss-list-scroll {
    max-height: 180px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 16px;
}

.rss-url-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    margin-bottom: 6px;
    font-size: 0.85rem;
    border: 1px solid transparent;
    transition: all 0.2s;
}

.rss-url-entry:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

.url-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 12px;
    color: var(--text-secondary);
}

.delete-btn {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--danger);
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.8rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 36px;
}

.delete-btn:active {
    transform: scale(0.95);
}

.delete-btn:hover {
    background: var(--danger);
    color: white;
}

.save-master-btn {
    background: linear-gradient(135deg, #4a90e2, #357abd);
    color: white;
    border: none;
    padding: 16px;
    border-radius: 12px;
    cursor: pointer;
    width: 100%;
    font-weight: 700;
    font-size: 1rem;
    user-select: none;
    min-height: 48px;
    margin-top: 10px;
}

/* --- Post Cards --- */
.post-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 18px;
    padding: 16px;
    margin-bottom: 16px;
    word-wrap: break-word;
}

.post-author {
    color: var(--accent-color);
    font-weight: 800;
    font-size: 0.85rem;
}

/* --- Greet Page --- */
.robot-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin: 40px auto;
    width: 100%;
    user-select: none;
}

.robot-icon {
    font-size: 5rem;
    filter: drop-shadow(0 0 20px rgba(74, 144, 226, 0.3));
    animation: float 3s ease-in-out infinite;
}

.bubble {
    margin-top: 20px;
    padding: 16px 24px;
    background: rgba(30, 30, 46, 0.8);
    border-radius: 20px;
    border: 1px solid rgba(255, 173, 210, 0.3);
    color: #ffffff;
    font-weight: 600;
    font-size: 1rem;
    text-align: center;
    max-width: 90%;
}

@supports (backdrop-filter: blur(12px)) {
    .bubble {
        backdrop-filter: blur(12px);
    }
}

/* --- Animations --- */
@keyframes float {
    0%,
    100% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-15px);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

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

/* --- Utilities --- */
.reload-btn-large {
    cursor: pointer;
    background: linear-gradient(
        135deg,
        rgba(74, 144, 226, 0.15),
        rgba(74, 144, 226, 0.05)
    );
    color: var(--accent-color);
    padding: 16px;
    border-radius: 16px;
    width: 100%;
    font-weight: 700;
    border: 1px solid rgba(74, 144, 226, 0.3);
    user-select: none;
    min-height: 52px;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.reload-btn-large:hover {
    background: rgba(74, 144, 226, 0.2);
    border-color: var(--accent-color);
    box-shadow: 0 6px 20px rgba(74, 144, 226, 0.2);
    transform: translateY(-2px);
}

.reload-btn-large:active {
    transform: scale(0.96) translateY(0);
}

/* Optional: Add a subtle pulse animation when content is old */
@keyframes pulse-subtle {
    0% {
        box-shadow: 0 0 0 0 rgba(74, 144, 226, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(74, 144, 226, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(74, 144, 226, 0);
    }
}

.error-box {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--danger);
    padding: 15px;
    border-radius: 12px;
    text-align: center;
}

/* --- AI Provider Switch (Neu) --- */
.provider-switch {
    display: flex;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 3px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    /* Zwischen h1 und den Icons positionieren */
    margin: 0 10px;
}

.prov-btn {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    padding: 6px 14px;
    border-radius: 9px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 700;
    transition: all 0.2s ease;
}

.prov-btn.active {
    background: var(--accent-color);
    color: white;
}

/* --- Config Section Refinement --- */
.config-section {
    margin-bottom: 20px;
}

.config-section label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* --- Markdown Content Styling --- */
.markdown-body {
    font-size: 0.95rem;
    color: var(--text-primary);
    line-height: 1.6;
}

.markdown-body h3 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1.15rem;
    color: #ffffff;
    font-weight: 700;
}

.markdown-body p {
    margin: 0;
}

/* --- Status Indicators --- */
.loading-spinner {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
    font-style: italic;
    animation: pulse-subtle 2s infinite;
}

.empty-msg {
    text-align: center;
    color: var(--text-secondary);
    margin-top: 40px;
    font-size: 0.9rem;
    opacity: 0.8;
}

/* --- Hashtag Section --- */
.hashtag-section {
    margin-bottom: 24px;
}

.hashtag-input-row {
    display: flex;
    gap: 10px;
}

.hashtag-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 12px 16px;
    color: white;
    font-size: 0.95rem;
    outline: none;
    transition: all 0.2s;
}

.hashtag-input:focus {
    border-color: var(--accent-color);
    background: rgba(255, 255, 255, 0.08);
}

.tag-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.tag-chip {
    background: rgba(74, 144, 226, 0.15);
    color: var(--accent-color);
    border: 1px solid rgba(74, 144, 226, 0.3);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.tag-chip:hover {
    background: rgba(74, 144, 226, 0.25);
    transform: scale(1.05);
}

.tag-remove {
    font-size: 1.1rem;
    line-height: 1;
    opacity: 0.6;
}

.tag-chip:hover .tag-remove {
    opacity: 1;
}

/* --- Layout Adjustment für Provider Switch --- */
.header-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

/* --- Category filter --- */
/* ── Kategorie-Filterleiste ── */
.category-bar {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 12px;
    margin-bottom: 20px;
    scrollbar-width: none;
}
.category-bar::-webkit-scrollbar {
    display: none;
}

.cat-btn {
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    transition: all 0.2s ease;
}
.cat-btn.active {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
}
.cat-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

/* ── Kategorie-Badge im Feed-Eintrag ── */
.cat-badge {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--accent-color);
    background: rgba(74, 144, 226, 0.12);
    border: 1px solid rgba(74, 144, 226, 0.25);
    padding: 2px 8px;
    border-radius: 10px;
    white-space: nowrap;
    margin: 0 8px;
    flex-shrink: 0;
}

/* ── Kategorie-Badge auf NewsCard ── */
.post-meta {
    display: flex;
    align-items: center;
    gap: 8px;
}
.post-category-badge {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--accent-color);
    background: rgba(74, 144, 226, 0.12);
    border: 1px solid rgba(74, 144, 226, 0.25);
    padding: 2px 8px;
    border-radius: 10px;
}

/* ── Neue URL-Zeile mit Kategorie-Dropdown ── */
.rss-add-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 16px;
}
.cat-select {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 12px;
    padding: 14px 10px;
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
    flex-shrink: 0;
    width: 130px;
    transition: border-color 0.2s;
}
.cat-select:focus {
    outline: none;
    border-color: var(--accent-color);
}
.cat-select option {
    background: #1e1e2e;
    color: white;
}
