/* ===== CSS Variables & Reset ===== */
:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a25;
    --bg-hover: #22222f;
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --text-muted: #606070;
    --accent-blue: #4285f4;
    --accent-red: #ea4335;
    --accent-yellow: #fbbc05;
    --accent-green: #34a853;
    --accent-purple: #a855f7;
    --border-color: #2a2a3a;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --gradient-1: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-2: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-3: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ===== Views ===== */
.view {
    display: none;
    min-height: 100vh;
}

.view.active {
    display: block;
}

/* ===== Home View ===== */
.home-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    background: 
        radial-gradient(ellipse at top, rgba(102, 126, 234, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at bottom right, rgba(168, 85, 247, 0.1) 0%, transparent 50%),
        var(--bg-primary);
}

/* ===== Logo ===== */
.logo-container {
    text-align: center;
    margin-bottom: 40px;
    animation: fadeInDown 0.6s ease-out;
}

.logo {
    font-size: 4.5rem;
    font-weight: 700;
    letter-spacing: -2px;
    margin-bottom: 8px;
}

.logo-x { color: var(--accent-blue); }
.logo-e { color: var(--accent-red); }
.logo-a { color: var(--accent-yellow); }
.logo-y { color: var(--accent-green); }
.logo-u { color: var(--accent-purple); }

.tagline {
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-weight: 300;
    letter-spacing: 3px;
    text-transform: uppercase;
}

/* ===== Search Box ===== */
.search-container {
    width: 100%;
    max-width: 640px;
    animation: fadeInUp 0.6s ease-out 0.2s both;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 50px;
    padding: 0 20px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px var(--shadow-color);
}

.search-box:hover,
.search-box:focus-within {
    background: var(--bg-tertiary);
    border-color: var(--accent-blue);
    box-shadow: 0 8px 40px rgba(66, 133, 244, 0.15);
    transform: translateY(-2px);
}

.search-icon {
    width: 22px;
    height: 22px;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.search-box input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    padding: 18px 16px;
    font-size: 1.1rem;
    color: var(--text-primary);
    font-family: inherit;
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.clear-btn {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.clear-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.clear-btn svg {
    width: 18px;
    height: 18px;
}

/* ===== Search Buttons ===== */
.search-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 28px;
}

.search-btn,
.lucky-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.search-btn {
    background: var(--gradient-1);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.search-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(102, 126, 234, 0.4);
}

.lucky-btn {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.lucky-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    transform: translateY(-2px);
}

/* ===== Stats ===== */
.stats-container {
    margin-top: 40px;
    animation: fadeIn 0.6s ease-out 0.4s both;
}

.stats-container p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ===== Results Header ===== */
.results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 24px;
    flex: 1;
}

.header-logo {
    font-size: 1.8rem;
    font-weight: 700;
    text-decoration: none;
    letter-spacing: -1px;
    transition: transform 0.2s ease;
}

.header-logo:hover {
    transform: scale(1.05);
}

.results-search-box {
    max-width: 600px;
    flex: 1;
}

.results-search-box input {
    padding: 14px 16px;
}

.header-right {
    margin-left: 20px;
}

#result-count {
    color: var(--text-secondary);
    font-size: 0.9rem;
    white-space: nowrap;
}

/* ===== Results Main ===== */
.results-main {
    max-width: 800px;
    margin: 0 auto;
    padding: 24px;
}

.results-info {
    margin-bottom: 20px;
}

#search-time {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ===== Result Cards ===== */
.result-card {
    padding: 20px 0;
    border-bottom: 1px solid var(--border-color);
    animation: fadeInUp 0.4s ease-out;
    transition: all 0.2s ease;
}

.result-card:hover {
    background: linear-gradient(90deg, var(--bg-tertiary), transparent);
    margin: 0 -24px;
    padding: 20px 24px;
    border-radius: 12px;
}

.result-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.result-logo {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--bg-tertiary);
    flex-shrink: 0;
}

.result-logo-placeholder {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--gradient-1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: white;
    flex-shrink: 0;
}

.result-url {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 6px;
}

.result-url:hover {
    color: var(--text-secondary);
}

.result-title {
    font-size: 1.25rem;
    color: var(--accent-blue);
    text-decoration: none;
    font-weight: 500;
    display: block;
    margin-bottom: 8px;
    transition: color 0.2s ease;
    line-height: 1.4;
}

.result-title:hover {
    color: #6ba3ff;
    text-decoration: underline;
}

.result-description {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
}

.result-keywords {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.keyword-tag {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    border: 1px solid var(--border-color);
}

/* ===== No Results ===== */
.no-results {
    text-align: center;
    padding: 80px 20px;
    animation: fadeIn 0.4s ease-out;
}

.no-results svg {
    width: 80px;
    height: 80px;
    color: var(--text-muted);
    margin-bottom: 24px;
}

.no-results h3 {
    font-size: 1.5rem;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.no-results p {
    color: var(--text-secondary);
}

/* ===== Animations ===== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--bg-hover);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .logo {
        font-size: 3rem;
    }
    
    .tagline {
        font-size: 0.9rem;
        letter-spacing: 2px;
    }
    
    .search-box {
        padding: 0 16px;
    }
    
    .search-box input {
        padding: 14px 12px;
        font-size: 1rem;
    }
    
    .search-buttons {
        flex-direction: column;
    }
    
    .search-btn,
    .lucky-btn {
        width: 100%;
    }
    
    .results-header {
        flex-direction: column;
        gap: 16px;
        padding: 16px;
    }
    
    .header-left {
        flex-direction: column;
        width: 100%;
    }
    
    .results-search-box {
        width: 100%;
        max-width: none;
    }
    
    .header-right {
        margin-left: 0;
        align-self: flex-start;
    }
    
    .results-main {
        padding: 16px;
    }
    
    .result-card:hover {
        margin: 0 -16px;
        padding: 20px 16px;
    }
}
