/* ========================================
   seoMap by Andrea Papa - Main Stylesheet
   CLUSTERING TAB + SERP POPUP ONLY
   ======================================== */

/* ========================================
   RESET & BASE STYLES
   ======================================== */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f8fafc;
    overflow-x: hidden;
    margin: 0;
    padding: 0;
}

/* ========================================
   TOP NAVIGATION
   ======================================== */

.top-nav {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    margin: 0;
}

.top-nav-left {
    display: flex;
    align-items: center;
    gap: 24px;
}

.logo {
    font-size: 18px;
    font-weight: 700;
    color: #1f2937;
}

.project-selector-top {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    background: white;
    color: #374151;
    min-width: 200px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.project-selector-top:focus {
    outline: none;
    border-color: #4D3FD7;
    box-shadow: 0 0 0 3px rgba(77, 63, 215, 0.1);
}

.top-nav-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
}

.user-avatar:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.user-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.account-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    display: none;
    z-index: 1001;
    overflow: hidden;
}

.account-dropdown.show {
    display: block;
}

.account-dropdown-item {
    padding: 12px 16px;
    color: #374151;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.15s ease;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.account-dropdown-item:hover {
    background: #f9fafb;
}

.account-dropdown-item.logout {
    color: #ef4444;
    border-top: 1px solid #e5e7eb;
}

.account-dropdown-item.logout:hover {
    background: #fef2f2;
}

/* ========================================
   MAIN CONTENT
   ======================================== */

.main-content {
    width: 100%;
    min-height: calc(100vh - 64px);
    padding: 32px;
    margin: 0;
    box-sizing: border-box;
    background: #f8fafc;
}

/* ========================================
   CLUSTER GRID LAYOUT
   ======================================== */

.cluster-grid-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: minmax(120px, auto);
    gap: 24px;
    width: 100%;
    align-items: start;
}

.cluster-grid-container > .cluster-card {
    min-width: 0; /* Prevent grid items from overflowing */
}

/* Responsive Grid */
@media (max-width: 1200px) {
    .cluster-grid-container {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 900px) {
    .cluster-grid-container {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .cluster-grid-container {
        grid-template-columns: 1fr;
    }
    
    .top-nav {
        padding: 0 16px;
    }
    
    .project-selector-top {
        min-width: 150px;
    }
}

/* ========================================
   CLUSTER CARD
   ======================================== */

.cluster-card {
    background: #ffffff;
    border: 1px solid #f1f5f9;
    border-radius: 12px;
    padding: 1.25rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    cursor: pointer;
    width: 100%;
    min-height: 120px;
    display: flex;
    flex-direction: column;
}

/* PROTECT Action Buttons - Always visible */
.cluster-card .cluster-card-compact > div:first-child {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    margin-bottom: 0.75rem !important;
}

.cluster-card .cluster-card-compact > div:first-child > div:last-child {
    display: flex !important;
    gap: 0.5rem !important;
    align-items: center !important;
}

.cluster-card .cluster-connector-btn,
.cluster-card .cluster-serp-btn,
.cluster-card .cluster-delete-btn {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    border: none !important;
    border-radius: 6px !important;
    padding: 0.375rem !important;
    transition: all 0.2s !important;
}

/* Cluster Search Card - Compact search input */
#cluster-search-card {
    min-height: auto !important;
    height: auto !important;
    padding-top: 0.5rem !important;
    padding-right: 1rem !important;
    padding-bottom: 0.5rem !important;
    padding-left: 1rem !important;
    width: auto;
    min-width: 250px;
    max-width: 400px;
    align-items: center !important;
    justify-content: center !important;
}

#cluster-search-card .cluster-card-compact {
    padding: 0 !important;
    margin: 0 !important;
    line-height: 1 !important;
}

#cluster-search-card .cluster-card-compact > div {
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1 !important;
}

#cluster-search-card input::placeholder {
    color: #9ca3af;
    opacity: 0.7;
}

#cluster-search-card input:focus {
    color: #1f2937;
}

/* Keyword Research Card - Compact button-like when not expanded */
#keyword-research-card:not(.expanded) {
    min-height: auto !important;
    height: auto !important;
    padding-top: 0.5rem !important;
    padding-right: 1rem !important;
    padding-bottom: 0.5rem !important;
    padding-left: 1rem !important;
    width: fit-content;
    min-width: auto;
    align-items: center !important;
    justify-content: center !important;
}

#keyword-research-card:not(.expanded) .cluster-card-compact {
    padding: 0 !important;
    margin: 0 !important;
    line-height: 1 !important;
}

#keyword-research-card:not(.expanded) .cluster-card-compact > div {
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1 !important;
}

/* Hide all expand icons except inline when not expanded */
#keyword-research-card:not(.expanded) .expand-icon {
    display: none !important;
}

#keyword-research-card:not(.expanded) .research-expand-icon-bottom {
    display: none !important;
}

/* Research Expand Icon - Inline (when not expanded) */
.research-expand-icon-inline {
    position: relative;
    background: transparent;
    border: none;
    padding: 0.25rem;
    margin-left: 0.25rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    border-radius: 4px;
    opacity: 0.6;
    flex-shrink: 0;
}

.research-expand-icon-inline:hover {
    background: #f3f4f6;
    opacity: 1;
}

.research-expand-icon-inline svg {
    width: 12px;
    height: 12px;
    stroke: #6b7280;
    stroke-width: 2;
}

/* Research Expand Icon - Bottom Right (when expanded) */
.research-expand-icon-bottom {
    position: absolute;
    bottom: 1.25rem;
    right: 1.25rem;
    background: #f3f4f6;
    border: none;
    padding: 0.375rem;
    border-radius: 6px;
    cursor: pointer;
    display: none; /* Hidden by default */
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 100;
}

.research-expand-icon-bottom:hover {
    background: #e5e7eb;
}

/* Show bottom icon only when expanded */
#keyword-research-card.expanded .research-expand-icon-bottom {
    display: flex !important;
}

/* Hide inline icon when expanded */
#keyword-research-card.expanded .research-expand-icon-inline {
    display: none !important;
}

/* Show inline icon only when not expanded */
#keyword-research-card:not(.expanded) .research-expand-icon-inline {
    display: inline-flex !important;
}

.cluster-card:hover:not(.expanded) {
    border-color: #e2e8f0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transform: translateY(-2px);
}

/* Expanded Card - Takes 4 columns and 4 rows (16 grid cells) */
.cluster-card.expanded {
    grid-column: span 4;
    grid-row: span 4;
    padding: 2rem;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    border-color: #4D3FD7;
    min-height: auto;
    height: auto;
}

/* Expand Icon - Bottom Right */
.expand-icon {
    position: absolute;
    bottom: 1.25rem;
    right: 1.25rem;
    background: #f3f4f6;
    border: none;
    padding: 0.375rem;
    border-radius: 6px;
    cursor: pointer;
    display: flex !important;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 100;
    visibility: visible !important;
    opacity: 1 !important;
    width: auto;
    height: auto;
}

/* Don't apply expand-icon styles to research card when not expanded */
#keyword-research-card:not(.expanded) .expand-icon {
    display: none !important;
}

.expand-icon:hover {
    background: #e5e7eb;
}

.expand-icon svg {
    width: 16px;
    height: 16px;
    stroke: #6b7280;
    stroke-width: 2;
    fill: none;
}

/* Collapse Icon (when expanded) - Position bottom right, not in corner */
.cluster-card.expanded .expand-icon {
    background: #f3f4f6;
    bottom: 1.25rem;
    top: auto;
    right: 1.25rem;
    left: auto;
    z-index: 200;
}

.cluster-card.expanded .expand-icon:hover {
    background: #e5e7eb;
}

/* Expanded Content - Hidden by default */
.cluster-card-expanded-content {
    display: none;
    flex: 1 1 auto;
    overflow-y: auto;
    padding-bottom: 3.5rem; /* Space for expand icon */
}

.cluster-card.expanded .cluster-card-expanded-content {
    display: block;
}

/* Modern card styling for expanded sections */
.cluster-card-expanded-content .section-card {
    background: #ffffff;
    border: 1px solid #f1f5f9;
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.cluster-card-expanded-content .section-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Compact Content - Always visible */
.cluster-card-compact {
    display: block;
    flex: 0 0 auto;
}

.cluster-card.expanded .cluster-card-compact {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

/* ========================================
   LOADING & EMPTY STATES
   ======================================== */

.loading {
    text-align: center;
    padding: 3rem;
    color: #6b7280;
    font-size: 14px;
}

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: #6b7280;
}

.empty-state h3 {
    font-size: 18px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
}

.empty-state p {
    font-size: 14px;
    color: #6b7280;
}

/* ========================================
   LOGIN SCREEN
   ======================================== */

.login-screen {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #f8fafc;
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.login-container {
    background: white;
    padding: 3rem;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.15);
    max-width: 400px;
    width: 100%;
    margin: 2rem;
}

.login-title {
    font-size: 24px;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.login-subtitle {
    color: #6b7280;
    margin-bottom: 2rem;
    font-size: 14px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.login-form-group {
    display: flex;
    flex-direction: column;
}

.login-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.5rem;
}

.login-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.login-input:focus {
    outline: none;
    border-color: #4D3FD7;
    box-shadow: 0 0 0 3px rgba(77, 63, 215, 0.1);
}

.login-submit-btn {
    width: 100%;
    padding: 0.75rem;
    background: #4D3FD7;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.login-submit-btn:hover {
    background: #4338ca;
}

.login-error {
    display: none;
    margin-top: 1rem;
    padding: 0.75rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    color: #dc2626;
    font-size: 14px;
}

/* ========================================
   SERP DROPUP MODAL
   ======================================== */

#clustering-serp-dropup {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    background: white;
    border-top: 1px solid #e2e8f0;
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    box-shadow: 0 -10px 25px -5px rgba(0, 0, 0, 0.15);
    z-index: 1500;
    height: 70vh;
    max-height: 70vh;
    overflow: hidden;
    display: none;
    flex-direction: column;
}

#clustering-serp-dropup.show {
    display: flex;
}

.modal-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

/* SERP Keywords Horizontal Scroll */
#clustering-keywords-horizontal-scroll {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: 0.375rem !important;
    padding: 0.5rem 0 !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    white-space: nowrap !important;
    scrollbar-width: thin !important;
    scrollbar-color: #cbd5e1 transparent !important;
    width: 100% !important;
    min-height: 40px !important;
    height: auto !important;
    align-items: center !important;
    visibility: visible !important;
    opacity: 1 !important;
    margin-bottom: 1rem;
    background: #f8fafc;
    padding: 1rem;
    border-bottom: 1px solid #e2e8f0;
}

#clustering-keywords-horizontal-scroll::-webkit-scrollbar {
    height: 6px;
}

#clustering-keywords-horizontal-scroll::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

#clustering-keywords-horizontal-scroll::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

#clustering-keywords-horizontal-scroll::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

#clustering-keywords-horizontal-scroll .keyword-chip {
    display: inline-flex !important;
    align-items: center;
    padding: 0.375rem 0.625rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.75rem;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    flex-grow: 0 !important;
    font-weight: 500;
    min-width: max-content !important;
}

#clustering-keywords-horizontal-scroll .keyword-chip:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    transform: translateY(-1px);
}

#clustering-keywords-horizontal-scroll .keyword-chip.selected {
    background: #4D3FD7;
    border-color: #4D3FD7;
    color: white;
}

/* SERP Content */
#clustering-serp-content {
    padding: 1rem;
    min-height: 300px;
}

#clustering-live-keyword-search {
    width: 100%;
    padding: 0.5rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

#clustering-live-keyword-search:focus {
    outline: none;
    border-color: #4D3FD7;
    box-shadow: 0 0 0 3px rgba(77, 63, 215, 0.1);
}

/* SERP Results */
.serp-results-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
}

.serp-result-card {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1rem;
    background: #f8fafc;
}

.serp-result {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f1f5f9;
    transition: all 0.2s ease;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    display: block;
}

.serp-result:hover {
    background: #f8fafc;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.serp-result.own-website {
    background: #fef3c7;
    border-left: 4px solid #f59e0b;
    border-color: #f59e0b;
}

.serp-title {
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.375rem;
    font-size: 0.875rem;
    line-height: 1.4;
    cursor: pointer;
    display: block;
}

.serp-title:hover {
    color: #4D3FD7;
    text-decoration: underline;
}

.serp-url {
    color: #059669;
    font-size: 0.75rem;
    margin-bottom: 0.375rem;
    font-weight: 500;
    text-decoration: none;
    display: block;
}

.serp-description {
    color: #6b7280;
    font-size: 0.8125rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 0.25rem;
}

.serp-no-results {
    text-align: center;
    color: #6b7280;
    font-style: italic;
    padding: 2rem;
}

/* ========================================
   KEYWORD RESEARCH MODAL
   ======================================== */

.keyword-research-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease-out;
}

.keyword-research-modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    max-width: 95vw;
    width: 95vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease-out;
}

.keyword-research-modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    background: #ffffff;
}

.keyword-research-modal-header h3 {
    margin: 0;
    color: #1f2937;
    font-size: 1.125rem;
    font-weight: 600;
}

.keyword-research-close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #6b7280;
    padding: 0.25rem;
    transition: all 0.2s;
    line-height: 1;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}

.keyword-research-close-btn:hover {
    background: #f3f4f6;
    color: #ef4444;
}

.keyword-research-input-section {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
    flex-shrink: 0;
}

.keyword-research-input {
    flex: 1;
    padding: 0.625rem 0.875rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.875rem;
    transition: all 0.2s;
    background: white;
}

.keyword-research-input:focus {
    outline: none;
    border-color: #4D3FD7;
    box-shadow: 0 0 0 3px rgba(77, 63, 215, 0.1);
}

.keyword-research-select {
    padding: 0.625rem 0.875rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.875rem;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
}

.keyword-research-select:focus {
    outline: none;
    border-color: #4D3FD7;
    box-shadow: 0 0 0 3px rgba(77, 63, 215, 0.1);
}

.keyword-research-textarea {
    padding: 0.625rem 0.875rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.875rem;
    font-family: inherit;
    transition: all 0.2s;
    background: white;
}

.keyword-research-textarea:focus {
    outline: none;
    border-color: #4D3FD7;
    box-shadow: 0 0 0 3px rgba(77, 63, 215, 0.1);
}

.keyword-research-btn-primary {
    background: #4D3FD7;
    color: white;
    border: none;
    padding: 0.625rem 1.25rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
    box-shadow: 0 1px 2px rgba(77, 63, 215, 0.2);
}

.keyword-research-btn-primary:hover:not(:disabled) {
    background: #4338ca;
    box-shadow: 0 4px 6px rgba(77, 63, 215, 0.3);
}

.keyword-research-btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.keyword-research-btn-secondary {
    background: #f3f4f6;
    color: #374151;
    border: none;
    padding: 0.5rem 0.875rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 500;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.keyword-research-btn-secondary:hover {
    background: #e5e7eb;
}

.keyword-research-btn-small {
    background: #f3f4f6;
    color: #374151;
    border: none;
    padding: 0.375rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 500;
    transition: all 0.2s;
}

.keyword-research-btn-small:hover {
    background: #e5e7eb;
}

.keyword-research-loading {
    text-align: center;
    padding: 3rem 2rem;
    color: #6b7280;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.keyword-research-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    background: white;
    flex-shrink: 0;
}

.keyword-research-results-header strong {
    color: #4D3FD7;
    font-weight: 600;
}

.keyword-research-keywords-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.75rem 1.5rem;
    background: #ffffff;
    max-height: calc(85vh - 300px);
    min-height: 200px;
}

.keyword-research-keywords-list-compact {
    max-height: 500px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.75rem;
    background: #ffffff;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

/* Visibility Metrics */
.metric-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
}

.metric-label {
    font-size: 0.75rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.metric-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #4D3FD7;
}

.keyword-research-overview {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    padding: 1.5rem;
    overflow-y: auto;
    max-height: calc(90vh - 200px);
}

/* Visibility Metrics takes full width (first section) */
.keyword-research-section:first-child {
    grid-column: 1 / -1;
}

/* All other sections (Keywords, SERP, Questions, Related) take 1 column each - equal distribution */
.keyword-research-section:nth-child(n+2) {
    grid-column: span 1;
}

.keyword-research-section {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.keyword-research-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e2e8f0;
}

.keyword-research-section-header h4 {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 600;
    color: #1f2937;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.keyword-research-section-count {
    font-size: 0.8125rem;
    color: #6b7280;
    font-weight: 400;
    margin-left: 0.5rem;
}

.keyword-research-section-count strong {
    color: #4D3FD7;
    font-weight: 600;
}

.keyword-research-section-content {
    min-height: 100px;
}

.keyword-research-serp-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.875rem;
    margin-bottom: 0.5rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
    transition: all 0.2s;
}

.keyword-research-serp-item:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.keyword-research-serp-position {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    background: #4D3FD7;
    color: white;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
}

.keyword-research-serp-details {
    flex: 1;
    min-width: 0;
}

.keyword-research-serp-title {
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.25rem;
    font-size: 0.875rem;
    line-height: 1.4;
}

.keyword-research-serp-url {
    color: #059669;
    font-size: 0.75rem;
    margin-bottom: 0.25rem;
    word-break: break-all;
    font-weight: 500;
}

.keyword-research-serp-description {
    color: #6b7280;
    font-size: 0.8125rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.keyword-research-question-item {
    padding: 0.875rem;
    margin-bottom: 0.5rem;
    border-left: 3px solid #4D3FD7;
    background: #f8fafc;
    border-radius: 6px;
    transition: all 0.2s;
}

.keyword-research-question-item:hover {
    background: #f1f5f9;
}

.keyword-research-question-text {
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.25rem;
    font-size: 0.875rem;
}

.keyword-research-question-snippet {
    color: #6b7280;
    font-size: 0.8125rem;
    line-height: 1.4;
}

.keyword-research-related-searches {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.keyword-research-related-chip {
    padding: 0.5rem 0.75rem;
    background: #f3f4f6;
    border-radius: 6px;
    font-size: 0.8125rem;
    color: #374151;
    transition: all 0.2s;
    cursor: pointer;
}

.keyword-research-related-chip:hover {
    background: #e5e7eb;
    transform: translateY(-1px);
}

.keyword-research-loading-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #6b7280;
    font-size: 0.8125rem;
}

/* Keyword Research Filters */
.keyword-research-filters {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1rem;
    margin-top: 0.75rem;
}

.keyword-research-filter-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: flex-end;
}

.keyword-research-filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    min-width: 140px;
    flex: 1;
}

.keyword-research-filter-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #374151;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.keyword-research-filter-select,
.keyword-research-filter-input {
    padding: 0.5rem 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.875rem;
    background: white;
    color: #1f2937;
    transition: all 0.2s;
    width: 100%;
}

.keyword-research-filter-select:focus,
.keyword-research-filter-input:focus {
    outline: none;
    border-color: #4D3FD7;
    box-shadow: 0 0 0 3px rgba(77, 63, 215, 0.1);
}

.keyword-research-filter-select:hover,
.keyword-research-filter-input:hover {
    border-color: #cbd5e1;
}

.keyword-research-filter-input::placeholder {
    color: #9ca3af;
}

.keyword-research-modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    background: #ffffff;
    color: #6b7280;
    font-size: 0.875rem;
}

.keyword-research-tab {
    padding: 0.75rem 1.25rem;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: #6b7280;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    bottom: -1px;
}

.keyword-research-tab:hover {
    color: #4D3FD7;
    background: #f8fafc;
}

.keyword-research-tab.active {
    color: #4D3FD7;
    border-bottom-color: #4D3FD7;
    font-weight: 600;
}

.keyword-research-tab-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    max-height: calc(85vh - 400px);
    min-height: 200px;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* ========================================
   MODAL STYLES
   ======================================== */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 3000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    animation: fadeIn 0.2s ease;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

.modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    background: white;
}

.modal-header h3 {
    margin: 0;
    color: #1f2937;
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-body {
    padding: 2rem;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 1.5rem 2rem;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    align-items: center;
    flex-shrink: 0;
    background: #f8fafc;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

/* ========================================
   UTILITY CLASSES
   ======================================== */

.hidden {
    display: none !important;
}

.show {
    display: block !important;
}

/* ========================================
   ANIMATIONS
   ======================================== */

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