:root {
    --primary-color: #ff6e40;
    --primary-hover: #ff5722;
    --bg-color: #f8f9fa;
    --panel-bg: #ffffff;
    --border-color: #e2e5e8;
    --text-color: #2b2b2b;
    --text-muted: #6c757d;
    --google-blue: #1a0dab;
    --google-green: #006621;
    --google-text: #4d5156;
    --google-link: #202124;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
}

* {
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

body {
    margin: 0;
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.5;
}

.main-container {
    display: flex;
    min-height: 100vh;
}

/* LEFT PANEL (INPUTS) */
.input-panel {
    width: 420px;
    background: var(--panel-bg);
    border-right: 1px solid var(--border-color);
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    flex-shrink: 0;
    box-shadow: 4px 0 16px rgba(0, 0, 0, 0.02);
    z-index: 10;
}

.panel-header h2 {
    margin-top: 0;
    font-size: 1.75rem;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 0.5rem;
}

.panel-header p {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 2.5rem;
    line-height: 1.6;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.85rem;
    color: #333;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-with-action {
    display: flex;
    gap: 10px;
}

input[type="text"],
textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 15px;
    font-family: inherit;
    transition: all 0.2s;
    background: #fff;
    color: #495057;
}

input[type="text"]:focus,
textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 110, 64, 0.15);
    outline: none;
}

input[type="text"]::placeholder,
textarea::placeholder {
    color: #adb5bd;
}

#btn-fetch {
    background: #fff;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    padding: 0 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    white-space: nowrap;
    transition: all 0.2s;
}

#btn-fetch:hover {
    background: var(--primary-color);
    color: #fff;
}

.label-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.counter {
    font-weight: 500;
}

.progress-bar-container {
    height: 6px;
    background: #e9ecef;
    margin-top: 8px;
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: #28a745;
    transition: width 0.3s, background 0.3s;
}

.progress-bar.warning {
    background: #ffc107;
}

.progress-bar.error {
    background: #dc3545;
}

.checkbox-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.checkbox-group label {
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: none;
    letter-spacing: normal;
    font-size: 0.95rem;
    color: #495057;
}

.badge-new {
    background: var(--primary-color);
    color: white;
    font-size: 9px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.action-buttons {
    margin-top: 2.5rem;
    display: flex;
    gap: 12px;
}

.btn-primary,
.btn-secondary {
    padding: 12px 18px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    flex: 1;
    font-size: 0.95rem;
    transition: all 0.2s;
    text-align: center;
}

.btn-primary {
    background: var(--google-blue);
    color: white;
    box-shadow: 0 2px 4px rgba(26, 13, 171, 0.2);
}

.btn-primary:hover {
    background: #140a8c;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(26, 13, 171, 0.3);
}

.btn-secondary {
    background: #f1f3f5;
    color: #495057;
}

.btn-secondary:hover {
    background: #e9ecef;
    color: #212529;
}


/* RIGHT PANEL (PREVIEW) */
.preview-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 3rem;
    background-color: var(--bg-color);
    align-items: center;
    justify-content: flex-start;
}

.preview-controls {
    margin-bottom: 2.5rem;
    width: 100%;
    max-width: 800px;
    display: flex;
    justify-content: flex-end;
    /* Move toggle to right like Mangools? Or center. */
}

.device-toggle {
    background: #e9ecef;
    border-radius: 8px;
    padding: 4px;
    display: inline-flex;
}

.device-btn {
    border: none;
    background: transparent;
    padding: 8px 18px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    color: #495057;
    border-radius: 6px;
    transition: all 0.2s;
}

.device-btn.active {
    background: #fff;
    color: var(--google-blue);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.google-container {
    background: white;
    width: 100%;
    max-width: 780px;
    min-height: 480px;
    box-shadow: var(--shadow-md);
    border-radius: 12px;
    padding: 30px 40px;
    transition: all 0.3s ease;
    border: 1px solid #f1f3f4;
}

.search-bar-mockup {
    display: flex;
    align-items: center;
    border: 1px solid #dfe1e5;
    border-radius: 24px;
    padding: 11px 20px;
    margin-bottom: 30px;
    margin-top: 10px;
    box-shadow: 0 1px 6px rgba(32, 33, 36, 0.1);
    max-width: 580px;
    transition: box-shadow 0.2s;
}

.search-bar-mockup:hover {
    box-shadow: 0 1px 6px rgba(32, 33, 36, 0.2);
    border-color: #dfe1e5;
}

.search-bar-mockup input {
    border: none;
    flex: 1;
    font-size: 16px;
    background: transparent;
    color: #202124;
    padding: 0;
}

.search-bar-mockup input:focus {
    box-shadow: none;
}

.google-logo {
    text-align: left;
    margin-bottom: 25px;
}

.google-logo img {
    height: 32px;
}

/* SERP ITEM STYLES */
.serp-item {
    font-family: arial, sans-serif;
    max-width: 600px;
    /* margin-left: 18px; Google often has padding, but container handles it */
}

.serp-top-line {
    display: flex;
    align-items: center;
    white-space: nowrap;
    margin-bottom: 2px;
}

.serp-favicon-wrapper {
    background-color: transparent;
    border-radius: 50%;
    height: 28px;
    width: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    background: #f1f3f4;
    border: 1px solid #f1f3f4;
}

.serp-favicon img {
    width: 18px;
    /* Google's favicon is slightly larger in the circle */
    height: 18px;
    border-radius: 50%;
}

.serp-site-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    line-height: 1.3;
}

.serp-site-name {
    font-size: 14px;
    color: #202124;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    letter-spacing: 0.1px;
}

.serp-url {
    font-size: 12px;
    color: #4d5156;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    letter-spacing: 0.2px;
}

.serp-title {
    margin-top: 5px;
    margin-bottom: 2px;
}

.serp-title a {
    color: #1a0dab;
    font-size: 20px;
    line-height: 1.3;
    text-decoration: none;
    cursor: pointer;
    font-family: arial, sans-serif;
    display: inline-block;
}

.serp-title a:hover {
    text-decoration: underline;
}

.serp-snippet {
    color: #4d5156;
    font-size: 14px;
    line-height: 1.58;
    word-wrap: break-word;
    font-family: arial, sans-serif;
}

.serp-date {
    color: #70757a;
    font-size: 14px;
}

b {
    font-weight: bold;
    color: #4d5156;
}

.serp-rating {
    color: #4d5156;
    font-size: 14px;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.stars {
    color: #fbbc04;
    letter-spacing: -1px;
}

.serp-ads-label {
    font-weight: 700;
    color: #202124;
    margin-right: 8px;
    font-size: 14px;
}

.hidden {
    display: none !important;
}

/* AI OVERVIEW MOCK (Simple) */
.ai-overview-box {
    border: 1px solid #dadce0;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
    background: #f8f9fa;
    /* Slight distinct bg or gradient */
}

.ai-header {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-sparkle {
    color: var(--google-blue);
}


/* MOBILE PREVIEW */
body.mobile-view .google-container {
    max-width: 375px;
    padding: 16px;
    min-height: 500px;
    border-radius: 20px;
    /* More like a phone screen */
    border: 8px solid #333;
    /* Phone frame simulation optionally */
    border-width: 10px 4px;
}

body.mobile-view .serp-item {
    margin-left: 0;
    max-width: 100%;
}

body.mobile-view .serp-title a {
    font-size: 18px;
}

/* RESPONSIVE DESIGN FOR TOOL ITSELF */
@media (max-width: 900px) {
    .main-container {
        flex-direction: column;
    }

    .input-panel {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        height: auto;
        overflow-y: visible;
        padding: 2rem;
    }

    .preview-panel {
        padding: 2rem 1rem;
    }
}

/* Scrollbar refinement */
.input-panel::-webkit-scrollbar {
    width: 6px;
}

.input-panel::-webkit-scrollbar-track {
    background: transparent;
}

.input-panel::-webkit-scrollbar-thumb {
    background: #dcdcdc;
    border-radius: 3px;
}

.input-panel::-webkit-scrollbar-thumb:hover {
    background: #ced4da;
}