/* --- 1. VARIABLES AND RESET --- */
:root {
    --google-blue: #4285F4;
    --google-red: #EA4335;
    --google-yellow: #FBBC05;
    --google-green: #34A853;
    --ton-blue: #0088cc;
    --bg-color: #ffffff;
    --text-color: #202124;
    --gray-text: #70757a;
    --border-color: #dfe1e5;
    --link-color: #1a0dab;
    --result-url-color: #202124;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Roboto, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

a { text-decoration: none; color: var(--link-color); }
a:hover { text-decoration: underline; }
a:visited { color: var(--link-color); }

/* Logo Colors */
.t-b { color: var(--google-blue); }
.o-r { color: var(--google-red); }
.o-y { color: var(--google-yellow); }
.g-b { color: var(--google-blue); }
.l-g { color: var(--google-green); }
.e-r { color: var(--google-red); }

.search-icon {
    width: 20px;
    height: 20px;
    fill: #9aa0a6;
}

/* --- 2. COMMON FOOTER --- */
footer {
    background: #f2f2f2;
    color: var(--gray-text);
    margin-top: auto;
    width: 100%;
}

.footer-location {
    padding: 15px 30px;
    border-bottom: 1px solid #dadce0;
    font-size: 15px;
}

.footer-links {
    display: flex;
    justify-content: space-between;
    padding: 15px 30px;
    flex-wrap: wrap;
}

.footer-links div {
    display: flex;
    gap: 25px;
}

footer a {
    color: var(--gray-text);
    font-size: 14px;
}

footer a:visited {
    color: var(--gray-text);
}

/* --- 3. HOME PAGE (INDEX) STYLES --- */
/* Target header when it doesn't have a logo inside (Home page) */
header:not(:has(.logo-small)) {
    display: flex;
    justify-content: flex-end;
    padding: 12px 20px;
    font-size: 13px;
}

header:not(:has(.logo-small)) a {
    color: rgba(0,0,0,0.87);
    margin-left: 15px;
}

/* Home main centering */
main:not(.results-main):has(.logo) {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0 20px;
    margin-top: -60px;
}

.logo {
    font-size: clamp(60px, 10vw, 92px);
    font-weight: 500;
    letter-spacing: -4px;
    margin-bottom: 25px;
    user-select: none;
}

.search-wrapper {
    width: 100%;
    max-width: 584px;
    position: relative;
}

.search-box {
    width: 100%;
    height: 46px;
    padding: 0 45px;
    border: 1px solid var(--border-color);
    border-radius: 24px;
    font-size: 16px;
    outline: none;
    transition: box-shadow 0.1s;
}

.search-box:hover, .search-box:focus {
    box-shadow: 0 1px 6px rgba(32,33,36,0.28);
    border-color: rgba(223,225,229,0);
}

.search-wrapper .search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
}

.actions {
    margin-top: 28px;
    display: flex;
    gap: 12px;
}

.btn-search {
    background-color: #f8f9fa;
    border: 1px solid #f8f9fa;
    border-radius: 4px;
    color: #3c4043;
    cursor: pointer;
    font-size: 14px;
    padding: 0 16px;
    height: 36px;
    transition: border 0.2s;
}

.btn-search:hover {
    box-shadow: 0 1px 1px rgba(0,0,0,0.1);
    border: 1px solid #dadce0;
    color: #202124;
}

/* --- 4. RESULTS PAGE STYLES --- */
header:has(.logo-small) {
    display: flex;
    align-items: center;
    padding: 20px 30px;
    border-bottom: 1px solid #ebebeb;
    gap: 40px;
    position: sticky;
    top: 0;
    background: white;
    z-index: 100;
}

.logo-small {
    font-size: 30px;
    font-weight: 500;
    letter-spacing: -1px;
    user-select: none;
    flex-shrink: 0;
}

.search-container {
    flex: 1;
    max-width: 690px;
    position: relative;
}

.search-input {
    width: 100%;
    height: 44px;
    padding: 0 45px;
    border: 1px solid transparent;
    box-shadow: 0 2px 5px 1px rgba(64,60,67,.16);
    border-radius: 24px;
    font-size: 16px;
    outline: none;
}

.search-input:focus {
    box-shadow: 0 1px 6px rgba(32,33,36,0.28);
    border-color: rgba(223,225,229,0);
}

.search-container .search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
}

.results-tabs {
    padding: 0 180px;
    display: flex;
    gap: 20px;
    border-bottom: 1px solid #ebebeb;
    font-size: 14px;
    color: var(--gray-text);
}

.tab {
    padding: 15px 0;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
}

.tab:hover {
    text-decoration: none;
}

.tab:not(.active) {
    color: var(--gray-text);
}

.tab.active {
    color: var(--ton-blue);
    border-bottom-color: var(--ton-blue);
}

.tab.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Results Main Content */
main:has(.results-stats),
main:has(.search-result) {
    padding: 20px 180px;
    max-width: 1000px;
    flex: 1;
}

/* Image search main - no max-width to allow full width */
main:has(.image-grid) {
    max-width: none;
}

.results-stats {
    font-size: 14px;
    color: var(--gray-text);
    margin-bottom: 25px;
}

.search-result {
    margin-bottom: 32px;
    max-width: 650px;
    text-align: left;
}

.result-url {
    font-size: 14px;
    color: var(--result-url-color);
    margin-bottom: 4px;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.result-title {
    font-size: 20px;
    color: var(--link-color);
    margin-bottom: 4px;
    display: inline-block;
}

.result-description {
    font-size: 14px;
    line-height: 1.58;
    color: #4d5156;
    word-wrap: break-word;
}

.match-snippet {
    font-weight: bold;
    margin-bottom: 4px;
    color: #000;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-top: 40px;
    padding-bottom: 50px;
    font-size: 14px;
}

.page-num { color: var(--link-color); cursor: pointer; }
.page-active { color: var(--text-color); font-weight: bold; cursor: default; }
.next-btn { color: var(--ton-blue); font-weight: 500; }

/* Suggestions dropdown */
.suggestions-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #dfe1e5;
    border-radius: 0 0 24px 24px;
    box-shadow: 0 4px 6px rgba(32,33,36,0.28);
    display: none;
    z-index: 10;
    max-height: 200px;
    overflow-y: auto;
}

.suggestion-item {
    padding: 10px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
}

.suggestion-item:hover {
    background: #f8f9fa;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.muted-date {
    color: #666;
    font-size: 12px;
}

/* Image search styles */
.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    align-items: start;
}

@media (max-width: 600px) {
    .image-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
}

.image-item {
    cursor: pointer;
    display: flex;
    flex-direction: column;
    max-width: 200px;
}

.image-thumb {
    width: 100%;
    max-width: 200px;
    aspect-ratio: 1/1;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: #f1f3f4;
}

.image-meta {
    margin-top: 8px;
    font-size: 12px;
}

.image-title {
    color: var(--text-color);
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.image-source {
    color: var(--gray-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
}

/* Result actions dropdown */
.result-actions {
    position: relative;
}

.dropdown-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: #70757a;
}

.dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background: white;
    border: 1px solid #dfe1e5;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    z-index: 10;
    min-width: 120px;
}

.dropdown-menu a {
    display: block;
    padding: 8px 12px;
    color: #1a0dab;
    text-decoration: none;
}

.dropdown-menu a:hover {
    background: #f8f9fa;
}

/* Responsive */
@media (max-width: 900px) {
    .results-tabs,
    main:has(.results-stats),
    main:has(.search-result) {
        padding: 15px 20px;
    }
    header:has(.logo-small) { padding: 15px; gap: 15px; }
    .logo-small { font-size: 24px; }
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.domain-item {
    margin-bottom: 16px;
    padding: 8px;
    border: 1px solid #dfe1e5;
    border-radius: 4px;
}

.domain-name {
    font-weight: bold;
    color: var(--link-color);
}

.domain-info {
    color: var(--gray-text);
    font-size: 14px;
}

.stats-section {
    margin: 20px 0;
    padding: 16px;
    border: 1px solid #dfe1e5;
    border-radius: 8px;
    background: #f9f9f9;
}

.stats-section h2 {
    margin-top: 0;
    font-size: 18px;
    color: var(--text-color);
}

.stats-section p {
    margin: 8px 0;
    font-size: 14px;
    color: var(--gray-text);
}
