/**
 * SERP Preview Tool - Pixel-Perfect Google SERP Styles
 * Based on Google's current search result styling
 */

/* ===========================================
   GOOGLE SEARCH PAGE CONTAINER
   =========================================== */
.serp-preview-container {
    background: #fff;
    border-radius: 8px;
    min-height: 400px;
    overflow: hidden;
}

/* Google Header */
.google-header {
    padding: 20px 20px 0 20px;
    border-bottom: 1px solid #ebebeb;
}

.google-logo {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-bottom: 16px;
}

.google-logo-img {
    height: 30px;
}

.google-logo-text {
    font-family: 'Product Sans', Arial, sans-serif;
    font-size: 24px;
    font-weight: 500;
    display: flex;
}

.google-logo-text span:nth-child(1) { color: #4285f4; }
.google-logo-text span:nth-child(2) { color: #ea4335; }
.google-logo-text span:nth-child(3) { color: #fbbc05; }
.google-logo-text span:nth-child(4) { color: #4285f4; }
.google-logo-text span:nth-child(5) { color: #34a853; }
.google-logo-text span:nth-child(6) { color: #ea4335; }

/* Search Bar */
.google-search-bar {
    display: flex;
    align-items: center;
    max-width: 650px;
    height: 44px;
    border: 1px solid #dfe1e5;
    border-radius: 24px;
    padding: 0 16px;
    background: #fff;
    box-shadow: none;
    transition: box-shadow 0.2s;
}

.google-search-bar:hover {
    box-shadow: 0 1px 6px rgba(32, 33, 36, 0.28);
}

.google-search-bar:focus-within {
    box-shadow: 0 1px 6px rgba(32, 33, 36, 0.28);
}

.search-icon {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    fill: #9aa0a6;
    flex-shrink: 0;
}

.search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 16px;
    font-family: Arial, sans-serif;
    color: #202124;
    background: transparent;
}

.search-input::placeholder {
    color: #9aa0a6;
}

.search-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: 12px;
}

.search-action-btn {
    width: 24px;
    height: 24px;
    border: none;
    background: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-action-btn svg {
    width: 24px;
    height: 24px;
}

/* Navigation Tabs */
.google-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
    padding-left: 144px;
}

.google-nav-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 16px;
    font-size: 13px;
    color: #5f6368;
    text-decoration: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
}

.google-nav-item.active {
    color: #1a73e8;
    border-bottom-color: #1a73e8;
}

.google-nav-item svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

/* Results Info */
.google-results-info {
    padding: 12px 20px 12px 168px;
    font-size: 14px;
    color: #70757a;
    border-bottom: 1px solid #ebebeb;
}

/* ===========================================
   SERP RESULTS AREA
   =========================================== */
.serp-results-area {
    padding: 20px 20px 20px 168px;
    max-width: 820px;
}

/* Individual SERP Result */
.serp-result {
    font-family: Arial, sans-serif;
    max-width: 600px;
    padding: 0;
    margin-bottom: 24px;
}

/* Favicon and Site Info Row */
.serp-site-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 4px;
}

.serp-favicon-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.serp-favicon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #f1f3f4;
    border: 1px solid #ecedef;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 500;
    color: #5f6368;
    flex-shrink: 0;
}

.serp-favicon-img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: contain;
    background: #f1f3f4;
    border: 1px solid #ecedef;
    flex-shrink: 0;
}

.serp-favicon-fallback {
    display: none;
}

.serp-site-details {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.3;
}

.serp-site-name {
    font-size: 14px;
    line-height: 20px;
    color: #202124;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.serp-url {
    font-size: 12px;
    line-height: 18px;
    color: #4d5156;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.serp-url-menu {
    display: inline-flex;
    align-items: center;
    margin-left: 4px;
    cursor: pointer;
    opacity: 0.7;
}

.serp-url-menu:hover {
    opacity: 1;
}

.serp-url-menu svg {
    width: 18px;
    height: 18px;
    fill: #70757a;
}

/* Title */
.serp-title {
    font-size: 20px;
    line-height: 1.3;
    color: #1a0dab;
    cursor: pointer;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0;
    margin-top: 2px;
    word-break: break-word;
    font-weight: normal;
}

.serp-title:hover {
    text-decoration: underline;
}

/* Visited state */
.serp-result.visited .serp-title {
    color: #681da8;
}

/* Description */
.serp-description {
    font-size: 14px;
    line-height: 1.58;
    color: #4d5156;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
    margin-top: 8px;
}

.serp-description .highlight {
    font-weight: bold;
}

/* Date prefix in description */
.serp-date {
    color: #70757a;
}

/* Character limit warnings in preview */
.serp-title.over-limit,
.serp-description.over-limit {
    position: relative;
}

/* ===========================================
   EXPORT TARGET STYLES
   =========================================== */
#serp-export-target {
    background: #fff;
}

/* Compact export mode */
.export-compact #serp-export-target {
    padding: 16px;
}

.export-compact .google-header,
.export-compact .google-results-info {
    display: none;
}

.export-compact .serp-results-area {
    padding: 0;
}

/* ===========================================
   MOBILE SERP STYLES
   =========================================== */
.serp-preview-mobile .google-header {
    padding: 12px 16px 0 16px;
}

.serp-preview-mobile .google-logo {
    gap: 12px;
    margin-bottom: 12px;
}

.serp-preview-mobile .google-logo-text {
    font-size: 20px;
}

.serp-preview-mobile .google-search-bar {
    height: 40px;
    max-width: 100%;
}

.serp-preview-mobile .search-input {
    font-size: 14px;
}

.serp-preview-mobile .google-nav {
    padding-left: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.serp-preview-mobile .google-nav::-webkit-scrollbar {
    display: none;
}

.serp-preview-mobile .google-nav-item {
    padding: 10px 12px;
    font-size: 12px;
    white-space: nowrap;
}

.serp-preview-mobile .google-results-info {
    padding: 10px 16px;
    font-size: 12px;
}

.serp-preview-mobile .serp-results-area {
    padding: 16px;
}

.serp-preview-mobile .serp-result {
    max-width: 100%;
}

.serp-preview-mobile .serp-title {
    font-size: 18px;
    -webkit-line-clamp: 2;
    line-height: 1.4;
}

.serp-preview-mobile .serp-description {
    font-size: 13px;
    -webkit-line-clamp: 3;
}

.serp-preview-mobile .serp-favicon {
    width: 24px;
    height: 24px;
    font-size: 12px;
}

.serp-preview-mobile .serp-favicon-img {
    width: 24px;
    height: 24px;
}

.serp-preview-mobile .serp-site-name {
    font-size: 13px;
}

.serp-preview-mobile .serp-url {
    font-size: 11px;
}

/* Placeholder results styling */
.serp-result-placeholder {
    opacity: 0.7;
}

.serp-result-placeholder .serp-title {
    color: #1a0dab;
}

.serp-result-divider {
    height: 1px;
    background: #ebebeb;
    margin: 16px 0;
}

/* ===========================================
   RESPONSIVE ADJUSTMENTS
   =========================================== */
@media (max-width: 768px) {
    .google-nav {
        padding-left: 20px;
    }

    .google-results-info {
        padding-left: 20px;
    }

    .serp-results-area {
        padding-left: 20px;
    }
}

/* ===========================================
   DARK MODE STYLES
   =========================================== */
body.dark-mode .serp-preview-container {
    background: #202124;
}

body.dark-mode .google-header {
    border-bottom-color: #3c4043;
}

body.dark-mode .google-search-bar {
    background: #303134;
    border-color: #5f6368;
}

body.dark-mode .google-search-bar:hover,
body.dark-mode .google-search-bar:focus-within {
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
}

body.dark-mode .search-input {
    color: #e8eaed;
}

body.dark-mode .search-input::placeholder {
    color: #9aa0a6;
}

body.dark-mode .google-nav-item {
    color: #9aa0a6;
}

body.dark-mode .google-nav-item.active {
    color: #8ab4f8;
    border-bottom-color: #8ab4f8;
}

body.dark-mode .google-results-info {
    color: #9aa0a6;
    border-bottom-color: #3c4043;
}

body.dark-mode .serp-favicon {
    background: #3c4043;
    border-color: #5f6368;
    color: #9aa0a6;
}

body.dark-mode .serp-favicon-img {
    background: #3c4043;
    border-color: #5f6368;
}

body.dark-mode .serp-site-name {
    color: #bdc1c6;
}

body.dark-mode .serp-url {
    color: #969ba1;
}

body.dark-mode .serp-url-menu svg {
    fill: #9aa0a6;
}

body.dark-mode .serp-title {
    color: #8ab4f8;
}

body.dark-mode .serp-result.visited .serp-title {
    color: #c58af9;
}

body.dark-mode .serp-description {
    color: #bdc1c6;
}

body.dark-mode .serp-date {
    color: #9aa0a6;
}

body.dark-mode .serp-result-divider {
    background: #3c4043;
}

body.dark-mode #serp-export-target {
    background: #202124;
}
