/* Base Layout with Original Theme */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f8fafc;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1650px;
    margin: 0 auto;
    padding: 20px;
    flex: 1;
    width: 100%;
}

/* Header - Original Theme */
.app-header {
    background: linear-gradient(135deg, #1D3747 0%, #4a90a4 100%);
    color: white;
    margin-bottom: 10px;
    padding: 20px;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 20px rgba(44, 95, 115, 0.15);
    position: relative;
    overflow: hidden;
}

.app-header::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 200px;
    height: 100%;
    background: linear-gradient(45deg, rgba(255,255,255,0.1), transparent);
    transform: skewX(-15deg);
}

.header-content {
    position: relative;
    z-index: 2;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    width: 100%;
    max-width: 1650px;
    margin: 0 auto;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo-section .header-logo {
    height: 80px;
    min-width: 110px;
    object-fit: contain;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.2));
    transition: all 0.3s ease;
}

.logo-section .header-logo:hover {
    transform: scale(1.05);
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.3));
}

.logo-section .header-text {
    display: flex;
    flex-direction: column;
}

.logo-section .header-text h1 {
    font-size: 2.2rem;
    font-weight: 700;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    align-items: center;
    display: flex;
    gap: 10px;
    line-height: normal;
}

.logo-section .header-text .subtitle {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
    margin: 0;
    font-weight: 400;
}

.logo-section .pkj-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #f59e0b;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
}

.logo-section .pkj-link:hover {
    color: #fbbf24;
    transform: translateY(-1px);
}

.logo-section .pkj-dev-icon {
    font-size: 1rem;
}

.logo-section .pkj-name {
    font-weight: 700;
    color: #fbbf24;
}

.logo-section .pkj-tooltip {
    position: absolute;
    bottom: 26px;
    left: 10%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.logo-section .pkj-link:hover .pkj-tooltip {
    opacity: 1;
    visibility: visible;
}

.version-badge {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.05));
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(12px);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.action-buttons {
    display: flex;
    gap: 12px;
    align-items: center;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 18px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 8px;
    color: white;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.action-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

.action-btn:hover::before {
    left: 100%;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.action-btn:active {
    transform: translateY(0);
}

.action-btn i {
    font-size: 1.1rem;
    opacity: 0.9;
}

.info-btn:hover {
    background: rgba(59, 130, 246, 0.3);
    border-color: rgba(59, 130, 246, 0.5);
}

.settings-btn:hover {
    background: rgba(245, 158, 11, 0.3);
    border-color: rgba(245, 158, 11, 0.5);
}

/* Research Input Section */
.research-input {
    background: white;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 4px 20px rgba(44, 95, 115, 0.08);
    border: 1px solid #e5e7eb;
    width: 100%;
}

.input-container {
    max-width: 100%;
    margin: 0 auto;
    width: 100%;
}

.input-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    font-weight: 600;
    color: #1D3747;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.input-group label i {
    color: #4a90a4;
    font-size: 14px;
}

.input-group input {
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s ease;
    background: white;
}

.input-group input:focus {
    outline: none;
    border-color: #4a90a4;
    box-shadow: 0 0 0 3px rgba(74, 144, 164, 0.1);
}

.form-helper {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    color: #6b7280;
    font-size: 13px;
    margin-bottom: 20px;
    text-align: left;
}

.form-helper i {
    color: #4a90a4;
    font-size: 12px;
    flex-shrink: 0;
}

.action-section {
    text-align: center;
}

.research-btn {
    padding: 15px 40px;
    font-size: 16px;
    font-weight: 600;
    background: linear-gradient(135deg, #1D3747 0%, #4a90a4 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 200px;
    justify-content: center;
}

.research-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(29, 55, 71, 0.3);
}

.research-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Results Section */
.results-section {
    width: 100%;
}

.research-layout {
    display: grid;
    grid-template-columns: 1fr 550px;
    gap: 30px;
    min-height: 600px;
    width: 100%;
}

/* Left Panel - Sources */
.sources-panel {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(44, 95, 115, 0.08);
    border: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-header {
    background: linear-gradient(135deg, #1D3747 0%, #4a90a4 100%);
    color: white;
    padding: 18px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header h2 {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.source-stats,
.insights-stats {
    font-size: 10px;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.9);
    padding: 2px 8px;
    border-radius: 8px;
    text-transform: none;
    letter-spacing: 0.3px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.source-stats .stat-item,
.insights-stats .stat-item {
    color: inherit;
}

/* Tab Navigation */
.sources-tabs {
    display: flex;
    background: #f8fafc;
    border-bottom: 1px solid #e5e7eb;
}

.tab-btn {
    flex: 1;
    padding: 15px 20px;
    background: none;
    border: none;
    font-size: 13px;
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 2px solid transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.tab-btn:hover {
    background: white;
    color: #1D3747;
}

.tab-btn.active {
    background: white;
    color: #1D3747;
    border-bottom-color: #4a90a4;
}

.tab-content {
    flex: 1;
    overflow-y: auto;
}

.tab-pane {
    display: none;
    padding: 20px;
    height: 100%;
}

.tab-pane.active {
    display: block;
}

/* Right Panel - Insights */
.insights-panel {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(44, 95, 115, 0.08);
    border: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative; /* Added for info bubble positioning */
}

.insights-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

/* Loading States */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.loading-content {
    background: white;
    padding: 40px 35px;
    border-radius: 12px;
    text-align: center;
    max-width: 450px;
    width: 90%;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border: 1px solid #f3f4f6;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f1f5f9;
    border-left: 4px solid #4a90a4;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-content h3 {
    color: #1f2937;
    margin-bottom: 12px;
    font-size: 20px;
    font-weight: 600;
}

.loading-text {
    color: #6b7280;
    margin-bottom: 25px;
    font-size: 14px;
}

.progress-steps {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 25px;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 10px;
    border-radius: 8px;
    transition: all 0.2s ease;
    min-width: 95px;
    background: #f8fafc;
    color: #9ca3af;
}

.step.active {
    background: #dbeafe;
    color: #1D3747;
}

.step.completed {
    background: #d1fae5;
    color: #059669;
}

.step i {
    font-size: 16px;
    margin-bottom: 4px;
}

.step span {
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    line-height: 1.2;
}

/* Error Display */
.error-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.error-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border: 1px solid #f3f4f6;
    position: relative;
}

.error-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: #f9fafb;
    color: #9ca3af;
    border: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 10px;
}

.error-close:hover {
    background: #f3f4f6;
    color: #6b7280;
}

.error-content i {
    font-size: 28px;
    color: #ef4444;
}

.error-content h3 {
    color: #1f2937;
    margin-bottom: 15px;
    font-size: 20px;
    font-weight: 600;
}

.error-content p {
    color: #6b7280;
    margin-bottom: 15px;
    font-size: 14px;
    line-height: 1.5;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    width: 90%;
    max-width: 480px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
}

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

.modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #495057;
    display: flex;
    align-items: center;
    gap: 8px;
}

.close-btn {
    background: none;
    border: none;
    color: #6c757d;
    font-size: 14px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
    width: auto;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.close-btn:hover {
    background: #e9ecef;
    color: #495057;
    transform: none;
}

.modal-body {
    padding: 20px;
    background: #ffffff;
    max-height: 60vh;
    overflow-y: auto;
    font-size: 14px;
    line-height: 1.5;
    color: #495057;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid #e1e5e9;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    background: #f8f9fa;
    border-radius: 0 0 8px 8px;
}

/* Footer - Original Theme */
.app-footer {
    background: linear-gradient(135deg, #1D3747 0%, #4a90a4 100%);
    color: white;
    margin-top: 30px;
    padding: 30px 0;
    border-radius: 8px 8px 0 0;
    position: relative;
    overflow: hidden;
}

.app-footer::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 200px;
    height: 100%;
    background: linear-gradient(45deg, rgba(255,255,255,0.08), transparent);
    transform: skewX(-15deg);
}

.footer-content {
    max-width: 1650px;
    margin: 0 auto;
    padding: 0 20px;
    position: relative;
    z-index: 1;
    text-align: center;
    width: 100%;
}

.footer-brand h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.footer-subtitle {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 15px;
}

.footer-copyright {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
}

.footer-link {
    color: #f59e0b;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

.footer-link:hover {
    color: #fff;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .research-layout {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .sources-panel {
        order: 2;
    }
    
    .insights-panel {
        order: 1;
    }
    
    .container {
        padding: 15px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .app-header {
        padding: 25px 20px;
        margin-bottom: 20px;
    }
    
    .header-content {
        flex-direction: column;
        text-align: center;
    }
    
    .logo-section h1 {
        font-size: 1.8rem;
    }
    
    .input-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .research-input {
        padding: 20px;
        margin-bottom: 20px;
    }
}

/* Analytics Modal Styles */
.analytics-modal {
    max-width: 1000px;
    max-height: 90vh;
    overflow-y: auto;
}

.analytics-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.summary-card {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 10px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.summary-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.summary-icon {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #4a90a4 0%, #1D3747 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
}

.summary-content {
    flex: 1;
}

.summary-number {
    font-size: 2rem;
    font-weight: 700;
    color: #1D3747;
    line-height: 1;
    margin-bottom: 5px;
}

.summary-label {
    font-size: 0.9rem;
    color: #64748b;
    font-weight: 500;
}

.analytics-table-container {
    background: white;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
}

.analytics-table-container h4 {
    padding: 20px;
    margin: 0;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    color: #1D3747;
    font-size: 1rem;
}

.analytics-table {
    width: 100%;
}

.table-header {
    display: grid;
    grid-template-columns: 2fr 1fr 1.5fr 1fr 1fr 1.5fr;
    background: #f1f5f9;
    border-bottom: 2px solid #e2e8f0;
}

.header-cell {
    padding: 15px 10px;
    font-weight: 600;
    color: #374151;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table-body {
    max-height: 400px;
    overflow-y: auto;
}

.table-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1.5fr 1fr 1fr 1.5fr;
    border-bottom: 1px solid #f1f5f9;
    transition: background-color 0.2s ease;
}

.table-row:hover {
    background-color: #f8fafc;
}

.table-cell {
    padding: 15px 10px;
    display: flex;
    align-items: center;
    font-size: 0.85rem;
    color: #374151;
}

.browser-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.browser-info i {
    color: #4a90a4;
    width: 16px;
}

.os-badge {
    background: #e0f2fe;
    color: #0369a1;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
}

.ip-address {
    font-family: 'Courier New', monospace;
    background: #f1f5f9;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
}

.visit-count, .click-count {
    font-weight: 600;
    color: #1D3747;
}

.last-visit {
    color: #64748b;
    font-size: 0.8rem;
}

/* Platform Settings Heading Hover Effect */
#platformSettingsHeading:hover {
    color: #4a90a4;
    transition: color 0.2s ease;
}

/* Search History Styles */
.search-history-container {
    background: white;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
    margin-top: 20px;
}

.search-history-container h4 {
    padding: 20px;
    margin: 0;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    color: #1D3747;
    font-size: 1rem;
}

.search-history-list {
    max-height: 400px;
    overflow-y: auto;
    padding: 10px;
}

.search-item {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    transition: all 0.2s ease;
}

.search-item:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    transform: translateY(-1px);
}

.search-main {
    margin-bottom: 10px;
}

.search-company {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
}

.search-company i {
    color: #4a90a4;
    width: 16px;
}

.company-name {
    font-weight: 600;
    color: #1D3747;
    font-size: 0.85rem;
}

.search-website {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 24px;
}

.search-website i {
    color: #64748b;
    width: 16px;
}

.website-url {
    color: #4a90a4;
    font-size: 0.9rem;
    font-family: 'Courier New', monospace;
    background: #e0f2fe;
    padding: 2px 6px;
    border-radius: 4px;
}

.search-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: #64748b;
    border-top: 1px solid #e2e8f0;
    padding-top: 8px;
}

.search-browser,
.search-time {
    display: flex;
    align-items: center;
    gap: 5px;
}

.search-browser i,
.search-time i {
    color: #94a3b8;
    width: 12px;
    line-height: normal;
}

.no-searches {
    text-align: center;
    padding: 40px 20px;
    color: #64748b;
}

.no-searches i {
    font-size: 2rem;
    color: #cbd5e1;
    margin-bottom: 10px;
}

.no-searches p {
    margin: 0;
    font-size: 0.9rem;
}

/* Mobile Analytics Styles */
@media (max-width: 768px) {
    .analytics-summary {
        grid-template-columns: 1fr;
    }
    
    .table-header,
    .table-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .header-cell,
    .table-cell {
        padding: 10px;
        border-bottom: 1px solid #e2e8f0;
    }
    
    .header-cell:before {
        content: attr(data-label) ": ";
        font-weight: 600;
        color: #374151;
    }
    
    .table-cell:before {
        content: attr(data-label) ": ";
        font-weight: 600;
        color: #374151;
        margin-right: 10px;
    }
    
    .search-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .search-browser,
    .search-time {
        width: 100%;
    }
}
