/* Discovery Page Styles v20260115a */
/* AI Search Optimization (GEO/AEO) */

/* Page Container */
.discovery-page {
    padding: 24px;
    max-width: 1200px;
    margin: 0 auto;
}

/* Page Header */
.discovery-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
}

.discovery-header-left {
    flex: 1;
}

.discovery-title {
    font-size: 28px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 4px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.discovery-subtitle {
    font-size: 14px;
    color: #6B7280;
    margin: 0;
}

.tier-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.tier-badge.tier-grow {
    background: linear-gradient(135deg, #9810FA 0%, #DA70FF 100%);
    color: white;
}

.version-badge {
    font-size: 10px;
    font-weight: 500;
    color: #9CA3AF;
    background: #F3F4F6;
    padding: 2px 6px;
    border-radius: 4px;
}

/* Tab Navigation */
.discovery-tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: #F9FAFB;
    border-radius: 12px;
    margin-bottom: 24px;
    overflow-x: auto;
}

.discovery-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: transparent;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #6B7280;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.discovery-tab:hover {
    color: #374151;
    background: rgba(0, 0, 0, 0.03);
}

.discovery-tab.active {
    background: white;
    color: #8B5CF6;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.discovery-tab svg {
    flex-shrink: 0;
}

/* Tab Panels */
.discovery-tab-panel {
    display: none;
}

.discovery-tab-panel.active {
    display: block;
}

/* Cards */
.discovery-card {
    background: white;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
}

.discovery-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.discovery-card-title {
    font-size: 18px;
    font-weight: 600;
    color: #111827;
    margin: 0;
}

.discovery-card-subtitle {
    font-size: 14px;
    color: #6B7280;
    margin: 4px 0 0 0;
}

/* Platform Select */
.discovery-platform-select {
    padding: 8px 32px 8px 12px;
    background: white;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    font-size: 14px;
    color: #374151;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2' xmlns='http://www.w3.org/2000/svg'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

.discovery-platform-select:focus {
    outline: none;
    border-color: #8B5CF6;
}

/* Connection Status */
.discovery-connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.connection-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #D1D5DB;
}

.connection-dot.connected {
    background: #10B981;
}

.connection-dot.disconnected {
    background: #EF4444;
}

.connection-dot.pending {
    background: #F59E0B;
}

.connection-label {
    font-size: 14px;
    font-weight: 600;
    color: #10B981;
}

.connection-label.disconnected {
    color: #EF4444;
}

.discovery-connection-desc {
    font-size: 14px;
    color: #374151;
    margin: 0 0 4px 0;
}

.discovery-sync-time {
    font-size: 13px;
    color: #9CA3AF;
    margin: 0 0 16px 0;
}

/* Connection Action Buttons */
.discovery-connection-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.discovery-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.discovery-btn-primary {
    background: #8B5CF6;
    color: white;
}

.discovery-btn-primary:hover {
    background: #7C3AED;
}

.discovery-btn-outline {
    background: white;
    border: 1px solid #E5E7EB;
    color: #374151;
}

.discovery-btn-outline:hover {
    background: #F9FAFB;
    border-color: #D1D5DB;
}

/* GPT Link Input */
.discovery-gpt-link {
    margin-top: 16px;
}

.discovery-gpt-link label {
    display: block;
    font-size: 13px;
    color: #6B7280;
    margin-bottom: 6px;
}

.discovery-gpt-link input {
    width: 100%;
    padding: 10px 12px;
    background: #F9FAFB;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    font-size: 14px;
    color: #374151;
    font-family: monospace;
}

.discovery-gpt-link input:focus {
    outline: none;
    border-color: #8B5CF6;
}

/* Metrics Row */
.discovery-metrics-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* Score Card */
.discovery-score-card {
    display: flex;
    flex-direction: column;
}

.discovery-score-content {
    display: flex;
    align-items: center;
    gap: 24px;
}

.discovery-score-gauge {
    position: relative;
    width: 120px;
    height: 120px;
    flex-shrink: 0;
}

.score-circle {
    width: 100%;
    height: 100%;
}

.score-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.score-number {
    font-size: 32px;
    font-weight: 700;
    color: #8B5CF6;
    display: block;
    line-height: 1;
}

.score-max {
    font-size: 14px;
    color: #9CA3AF;
}

.discovery-score-details {
    flex: 1;
}

.score-label {
    display: inline-block;
    padding: 4px 12px;
    background: #DCFCE7;
    color: #166534;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
}

.score-label.poor {
    background: #FEE2E2;
    color: #991B1B;
}

.score-label.fair {
    background: #FEF3C7;
    color: #92400E;
}

.score-progress {
    height: 8px;
    background: #E5E7EB;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.score-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #8B5CF6, #A78BFA);
    border-radius: 4px;
    transition: width 0.5s ease;
}

.score-comparison {
    font-size: 13px;
    color: #6B7280;
    margin: 0;
}

/* Metrics Card */
.discovery-metrics-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.discovery-metric {
    text-align: center;
}

.discovery-metric .metric-value {
    display: block;
    font-size: 32px;
    font-weight: 700;
    color: #111827;
    line-height: 1.2;
}

.discovery-metric .metric-label {
    display: block;
    font-size: 13px;
    color: #6B7280;
    margin-top: 4px;
}

.metric-change {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: 12px;
    font-weight: 500;
    margin-top: 4px;
}

.metric-change.positive {
    color: #10B981;
}

.metric-change.negative {
    color: #EF4444;
}

/* Section Titles */
.discovery-section-title {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin: 0 0 12px 0;
}

.discovery-section-divider {
    height: 1px;
    background: #E5E7EB;
    margin: 24px 0;
}

/* Prompts List */
.discovery-prompts-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.discovery-prompt-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #F9FAFB;
    border-radius: 8px;
    transition: background 0.2s ease;
}

.discovery-prompt-item:hover {
    background: #F3F4F6;
}

.prompt-drag-handle {
    color: #9CA3AF;
    cursor: grab;
    flex-shrink: 0;
}

.prompt-content {
    flex: 1;
    min-width: 0;
}

.prompt-text {
    font-size: 14px;
    font-weight: 500;
    color: #111827;
    margin: 0;
}

.prompt-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}

.prompt-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.prompt-badge.category {
    background: #EDE9FE;
    color: #7C3AED;
}

.prompt-badge.custom {
    background: #E0F2FE;
    color: #0369A1;
}

.prompt-impressions {
    font-size: 12px;
    color: #9CA3AF;
}

.prompt-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.prompt-btn {
    padding: 6px 12px;
    background: white;
    border: 1px solid #E5E7EB;
    border-radius: 6px;
    font-size: 13px;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s ease;
}

.prompt-btn:hover {
    background: #F9FAFB;
    border-color: #D1D5DB;
}

.prompt-menu-btn {
    padding: 6px 8px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: #9CA3AF;
    cursor: pointer;
}

.prompt-menu-btn:hover {
    background: #E5E7EB;
    color: #374151;
}

/* Suggested Prompts Header */
.discovery-suggested-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.discovery-link-btn {
    font-size: 13px;
    font-weight: 500;
    color: #8B5CF6;
    background: none;
    border: none;
    cursor: pointer;
    text-decoration: none;
}

.discovery-link-btn:hover {
    color: #7C3AED;
    text-decoration: underline;
}

/* Suggested Prompt Item */
.discovery-suggested-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: white;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    margin-bottom: 8px;
}

.suggested-content {
    flex: 1;
}

.suggested-text {
    font-size: 14px;
    font-weight: 500;
    color: #111827;
    margin: 0;
}

.suggested-meta {
    font-size: 12px;
    color: #9CA3AF;
    margin: 4px 0 0 0;
}

.suggested-add-btn {
    padding: 6px 12px;
    background: #8B5CF6;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease;
}

.suggested-add-btn:hover {
    background: #7C3AED;
}

/* Actions Grid */
.discovery-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.discovery-action-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px;
    background: white;
    border: 2px solid #E5E7EB;
    border-radius: 12px;
    text-align: center;
    transition: all 0.2s ease;
}

.discovery-action-card.enabled {
    border-color: #8B5CF6;
}

.discovery-action-card.enabled .action-icon {
    color: #8B5CF6;
}

.discovery-action-card.disabled {
    opacity: 0.6;
}

.discovery-action-card.disabled .action-icon {
    color: #9CA3AF;
}

.action-icon {
    width: 32px;
    height: 32px;
    margin-bottom: 8px;
}

.action-name {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin: 0;
}

.action-uses {
    font-size: 12px;
    color: #9CA3AF;
    margin: 4px 0 0 0;
}

/* Tip Banner */
.discovery-tip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: #FEF9C3;
    border-radius: 8px;
    font-size: 13px;
    color: #854D0E;
}

/* Content Suggestions */
.discovery-suggestions-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.discovery-suggestion-item {
    position: relative;
    padding: 16px;
    padding-left: 24px;
    border-radius: 8px;
    border-left: 4px solid;
}

.discovery-suggestion-item.high-priority {
    background: #FEF2F2;
    border-left-color: #EF4444;
}

.discovery-suggestion-item.suggested {
    background: white;
    border: 1px solid #E5E7EB;
    border-left: 4px solid #8B5CF6;
}

.suggestion-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}

.suggestion-type {
    font-size: 13px;
    font-weight: 600;
}

.discovery-suggestion-item.high-priority .suggestion-type {
    color: #EF4444;
}

.discovery-suggestion-item.suggested .suggestion-type {
    color: #8B5CF6;
}

.suggestion-question {
    font-size: 14px;
    font-weight: 500;
    color: #111827;
    margin: 0 0 4px 0;
}

.suggestion-meta {
    font-size: 12px;
    color: #6B7280;
    margin: 0 0 12px 0;
}

.suggestion-actions {
    display: flex;
    gap: 8px;
}

/* Queries List */
.discovery-queries-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.discovery-query-item {
    display: flex;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #F3F4F6;
}

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

.query-rank {
    width: 24px;
    font-size: 14px;
    font-weight: 600;
    color: #9CA3AF;
    flex-shrink: 0;
}

.query-text {
    flex: 1;
    font-size: 14px;
    color: #374151;
}

.query-count {
    font-size: 13px;
    color: #9CA3AF;
}

/* Actions Breakdown */
.discovery-actions-breakdown {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.breakdown-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

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

.breakdown-name {
    font-size: 14px;
    color: #374151;
}

.breakdown-value {
    font-size: 13px;
    color: #6B7280;
}

.breakdown-bar {
    height: 8px;
    background: #E5E7EB;
    border-radius: 4px;
    overflow: hidden;
}

.breakdown-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #8B5CF6, #A78BFA);
    border-radius: 4px;
    transition: width 0.5s ease;
}

/* Empty State */
.discovery-empty-state {
    padding: 32px;
    text-align: center;
    color: #9CA3AF;
}

.discovery-empty-state p {
    margin: 0;
}

/* Modals */
.discovery-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
}

.discovery-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.discovery-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
}

.discovery-modal-content {
    position: relative;
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 480px;
    margin: 24px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.discovery-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #E5E7EB;
}

.discovery-modal-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    margin: 0;
}

.discovery-modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    font-size: 24px;
    color: #9CA3AF;
    cursor: pointer;
    border-radius: 6px;
}

.discovery-modal-close:hover {
    background: #F3F4F6;
    color: #374151;
}

.discovery-modal-body {
    padding: 20px;
}

.discovery-modal-body label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 6px;
}

.discovery-modal-body input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    font-size: 14px;
}

.discovery-modal-body input:focus {
    outline: none;
    border-color: #8B5CF6;
}

.discovery-modal-hint {
    font-size: 12px;
    color: #9CA3AF;
    margin: 8px 0 0 0;
}

.discovery-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 16px 20px;
    border-top: 1px solid #E5E7EB;
}

/* QR Modal */
.qr-modal-body {
    text-align: center;
}

#qrCodeContainer {
    display: inline-block;
    padding: 16px;
    background: white;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    margin-bottom: 12px;
}

.qr-instructions {
    font-size: 13px;
    color: #6B7280;
    margin: 0;
}

/* Period Select */
.discovery-period-select {
    padding: 6px 28px 6px 10px;
    background: white;
    border: 1px solid #E5E7EB;
    border-radius: 6px;
    font-size: 13px;
    color: #374151;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2' xmlns='http://www.w3.org/2000/svg'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .discovery-page {
        padding: 16px;
    }

    .discovery-header {
        flex-direction: column;
        gap: 12px;
    }

    .discovery-title {
        font-size: 24px;
    }

    .discovery-tabs {
        padding: 2px;
    }

    .discovery-tab {
        padding: 8px 12px;
        font-size: 13px;
    }

    .discovery-tab svg {
        display: none;
    }

    .discovery-metrics-row {
        grid-template-columns: 1fr;
    }

    .discovery-score-content {
        flex-direction: column;
        text-align: center;
    }

    .discovery-score-gauge {
        margin: 0 auto 16px;
    }

    .discovery-metrics-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .discovery-metric .metric-value {
        font-size: 24px;
    }

    .discovery-card-header {
        flex-direction: column;
        gap: 12px;
    }

    .discovery-connection-actions {
        flex-direction: column;
    }

    .discovery-btn {
        width: 100%;
        justify-content: center;
    }

    .discovery-actions-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .discovery-modal-content {
        margin: 16px;
    }

    .prompt-actions {
        flex-direction: column;
    }

    .prompt-btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .discovery-actions-grid {
        grid-template-columns: 1fr 1fr;
    }

    .discovery-action-card {
        padding: 12px;
    }

    .action-icon {
        width: 24px;
        height: 24px;
    }

    .action-name {
        font-size: 12px;
    }
}
