:root {
    --bg-color: #000000;
    --card-bg: #0a0a0a;
    --text-main: #f0f0f0;
    --text-dim: #888888;
    --accent: #e53935;
    --accent-dark: #b71c1c;
    --border: #222222;
    --verified-color: #2196f3;
    --ad-color: #ffd700;
    --ai-border: #7c4dff; 
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

a { text-decoration: none; color: inherit; transition: 0.2s; }
img { max-width: 100%; display: block; }

/* --- HEADER --- */
header {
    padding: 1rem 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo-header {
    height: 40px;
    width: auto;
    object-fit: contain;
    transition: opacity 0.2s;
}
.logo-header:hover { opacity: 0.8; }

/* --- SEARCH INPUT COMPONENTS --- */
.search-wrapper {
    display: flex;
    align-items: center;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 50px;
    padding: 8px 15px 8px 25px;
    width: 100%;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.search-wrapper:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 15px rgba(229, 57, 53, 0.2);
}

.search-input {
    flex-grow: 1;
    background: transparent;
    border: none;
    color: white;
    font-size: 1.1rem;
    outline: none;
    padding-right: 10px;
    font-family: inherit;
}

.search-btn {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}
.search-btn:hover { transform: scale(1.1); }

/* --- HOME PAGE --- */
.home-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    text-align: center;
    width: 100%;
    box-sizing: border-box;
}

.logo-main {
    max-width: 300px;
    width: 80%;
    height: auto;
    margin-bottom: 2rem;
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: none;
}

.home-search-box {
    width: 100%;
    max-width: 650px;
    margin: 0 auto;
}

.home-search-box .search-wrapper {
    padding: 15px 20px 15px 30px;
}

.add-url-btn {
    margin-top: 20px;
    color: var(--text-dim);
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid transparent;
}
.add-url-btn:hover {
    color: var(--accent);
    border-color: var(--border);
    background: var(--card-bg);
}

/* --- RESULTS PAGE --- */
.results-header {
    padding: 1rem 5%;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 2rem;
    background: var(--bg-color);
}

.results-search-form {
    flex-grow: 1;
    max-width: 600px;
}
@media (max-width: 768px) {
    .results-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
        padding: 1rem;
    }
    .logo-header { height: 30px; align-self: flex-start; }
    .results-search-form { max-width: 100%; }
}

.results-container {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 3rem;
    padding: 2rem 5%;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

@media (max-width: 1024px) {
    .results-container { grid-template-columns: 1fr; gap: 2rem; }
    .sidebar { display: none; }
}

/* --- RESULT ITEMS --- */
.result-item {
    margin-bottom: 2.5rem;
    animation: fadeIn 0.4s ease;
    max-width: 800px;
}

.result-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    font-size: 0.85rem;
}

.favicon { width: 16px; height: 16px; border-radius: 2px; }
.site-url { color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.result-title {
    font-size: 1.4rem;
    color: var(--accent);
    margin-bottom: 8px;
    display: block;
    font-weight: 500;
    line-height: 1.3;
}
.result-title:hover { text-decoration: underline; text-decoration-color: rgba(229, 57, 53, 0.5); }

.result-desc {
    color: #cccccc;
    line-height: 1.6;
    font-size: 0.95rem;
    word-wrap: break-word;
}

.ad-label { background: transparent; border: 1px solid var(--ad-color); color: var(--ad-color); font-size: 0.7rem; padding: 0 4px; border-radius: 4px; font-weight: bold; margin-right: 6px; vertical-align: middle; }

/* Wiki Widget */
.wiki-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}
.wiki-header { display: flex; align-items: center; gap: 10px; margin-bottom: 15px; border-bottom: 1px solid var(--border); padding-bottom: 10px; color: var(--text-dim); }
.wiki-link { display: inline-block; margin-top: 15px; color: var(--accent); font-size: 0.9rem; font-weight: 600; }

/* AI Widget */
.ai-card {
    background: var(--card-bg);
    border: 1px solid var(--ai-border); /* Фиолетовая рамка */
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}
.ai-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 1px;
    background: linear-gradient(90deg, transparent, var(--ai-border), transparent);
    opacity: 0.7;
}

.ai-header { 
    display: flex; 
    align-items: center; 
    gap: 10px; 
    margin-bottom: 15px; 
    border-bottom: 1px solid var(--border); 
    padding-bottom: 10px; 
    color: #b388ff; /* Светло-фиолетовый */
}

.ai-badge {
    margin-left: auto;
    font-size: 0.6rem;
    background: #333;
    padding: 2px 6px;
    border-radius: 4px;
    color: #aaa;
    text-transform: uppercase;
}

.ai-content {
    font-size: 0.95rem;
    line-height: 1.6;
    color: #e0e0e0;
}

/* AI Loading Styles (NEW) */
.ai-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px;
    color: var(--text-dim);
    gap: 10px;
    font-size: 0.9rem;
}

.ai-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(124, 77, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--ai-border);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    margin: 4rem 0 2rem;
    font-family: 'Manrope', sans-serif;
    font-weight: 800;
    font-size: 1.8rem;
    letter-spacing: 3px;
    user-select: none;
}
.pag-char { color: var(--text-dim); text-decoration: none; padding: 0 2px; }
.pag-char.active, .pag-char:hover { color: white; text-shadow: 0 0 10px rgba(255,255,255,0.3); transform: translateY(-3px); }
.pag-h, .pag-ve { color: var(--accent); }

/* --- ADD PAGE STYLES --- */
.add-container {
    max-width: 600px;
    margin: 4rem auto;
    padding: 2.5rem;
    background: var(--card-bg);
    border-radius: 16px;
    border: 1px solid var(--border);
    width: 90%;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.form-group { margin-bottom: 1.5rem; }
.form-label { display: block; margin-bottom: 0.6rem; color: var(--text-dim); font-size: 0.9rem; font-weight: 500; }

.form-input {
    width: 100%;
    padding: 14px 16px;
    background: black;
    border: 1px solid var(--border);
    color: white;
    border-radius: 8px;
    box-sizing: border-box;
    outline: none;
    font-size: 1rem;
    font-family: 'Inter', sans-serif;
    transition: 0.2s;
}

.form-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(229, 57, 53, 0.1); }

.captcha-box {
    display: flex;
    gap: 15px;
    align-items: center;
    background: black;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.captcha-val {
    font-family: 'Manrope', sans-serif;
    font-weight: 800;
    font-size: 1.2rem;
    color: var(--accent);
    letter-spacing: 2px;
    background: rgba(229, 57, 53, 0.1);
    padding: 8px 12px;
    border-radius: 6px;
    min-width: 80px;
    text-align: center;
}

.captcha-input { flex-grow: 1; background: transparent; border: none; color: white; font-size: 1rem; outline: none; padding: 5px; }

.btn {
    background: var(--accent);
    color: white;
    padding: 14px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    width: 100%;
    transition: background 0.2s;
    margin-top: 1rem;
}
.btn:hover { background: var(--accent-dark); }

/* Footer */
footer {
    margin-top: auto;
    background: var(--card-bg);
    padding: 2rem;
    text-align: center;
    border-top: 1px solid var(--border);
    color: var(--text-dim);
    font-size: 0.85rem;
}
.lang-switch { position: fixed; bottom: 20px; right: 20px; background: rgba(0,0,0,0.8); padding: 8px 12px; border-radius: 30px; border: 1px solid var(--border); font-size: 0.75rem; z-index: 50; backdrop-filter: blur(5px); }

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