/* Comparison Page Styles */

/* Back button in header */
.back-btn {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: var(--button-bg);
    color: var(--text-primary);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: background 0.2s;
    z-index: 2;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.back-btn:hover {
    background: var(--button-hover-bg);
    color: var(--button-hover-text);
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Main comparison container */
.compare-main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.compare-container {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    overflow: hidden;
}

/* Tool Selection Section */
.tool-selection {
    padding: 2rem;
}

.tool-selection h2 {
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
    text-align: center;
}

.category-filter {
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.category-filter label {
    color: var(--text-secondary);
    font-weight: 500;
}

.category-filter select {
    background: var(--button-bg);
    color: var(--text-primary);
    border: 1px solid var(--accent);
    border-radius: 8px;
    padding: 0.5rem 1rem;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.category-filter select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

/* Tool Grid */
.tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
    max-height: 600px;
    overflow-y: auto;
    padding: 1rem;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 8px;
    background: var(--bg-main);
}

.tool-card {
    background: var(--card-bg);
    border: 2px solid transparent;
    border-radius: 12px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.tool-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    border-color: var(--accent);
}

.tool-card.selected {
    border-color: var(--accent);
    background: rgba(37, 99, 235, 0.05);
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.2);
}

.tool-card-header {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.tool-logo-compare {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    object-fit: contain;
    background: white;
    padding: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.tool-info-compare h3 {
    color: var(--text-primary);
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
}

.tool-info-compare p {
    color: var(--text-secondary);
    margin: 0.25rem 0 0 0;
    font-size: 0.9rem;
}

.tool-card .checkbox {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 20px;
    height: 20px;
    border: 2px solid var(--accent);
    border-radius: 4px;
    background: transparent;
    transition: all 0.3s ease;
}

.tool-card.selected .checkbox {
    background: var(--accent);
    position: relative;
}

.tool-card.selected .checkbox::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-weight: bold;
    font-size: 12px;
}

/* Compare Actions */
.compare-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.compare-btn, .clear-btn {
    padding: 0.75rem 2rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.compare-btn {
    background: var(--accent);
    color: var(--button-text);
}

.compare-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
}

.compare-btn:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
    opacity: 0.6;
}

.clear-btn {
    background: var(--accent);
    color: var(--button-text);
    border: 2px solid var(--accent);
}

.clear-btn:hover {
    background: var(--button-hover-bg);
    color: var(--button-hover-text);
    border-color: var(--button-hover-bg);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

/* Comparison Section */
.comparison-section {
    padding: 2rem;
}

.comparison-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.comparison-header h2 {
    color: var(--text-primary);
    margin: 0 0 0.5rem 0;
    font-size: 2rem;
    font-weight: 700;
}

.category-title {
    color: var(--accent);
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(37, 99, 235, 0.1);
    border-radius: 8px;
    display: inline-block;
    border: 1px solid rgba(37, 99, 235, 0.2);
}

.back-to-selection-btn {
    background: var(--accent);
    color: var(--button-text);
    border: 2px solid var(--accent);
    border-radius: 8px;
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2);
}

.back-to-selection-btn:hover {
    background: var(--button-hover-bg);
    color: var(--button-hover-text);
    border-color: var(--button-hover-bg);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

/* Comparison Table */
.comparison-table-container {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid rgba(0,0,0,0.1);
    background: var(--bg-main);
}

.comparison-table {
    min-width: 800px;
    border-collapse: collapse;
    width: 100%;
}

.comparison-table th,
.comparison-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(0,0,0,0.1);
    vertical-align: top;
}

.comparison-table th {
    background: var(--card-bg);
    color: var(--text-primary);
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
}

.comparison-table td {
    background: var(--card-bg);
    color: var(--text-primary);
}

/* Sticky first column (feature column) */
.comparison-table th:first-child,
.comparison-table td:first-child {
    position: sticky;
    left: 0;
    z-index: 5;
    background: var(--card-bg);
    border-right: 2px solid var(--accent);
    min-width: 200px;
}

/* Mobile adjustments for sticky column */
@media (max-width: 768px) {
    .comparison-table th:first-child,
    .comparison-table td:first-child {
        min-width: 120px;
        max-width: 150px;
        padding: 0.5rem;
    }
    
    .feature-name {
        font-size: 0.85rem;
        padding: 0.5rem;
    }
    
    .feature-icon {
        font-size: 0.8rem;
    }
}

/* Ensure sticky header first cell has higher z-index */
.comparison-table th:first-child {
    z-index: 15;
}

.comparison-table tr:hover td {
    background: rgba(37, 99, 235, 0.05);
}

/* Ensure sticky first column maintains background on hover */
.comparison-table tr:hover td:first-child {
    background: var(--card-bg);
}

/* Tool header in comparison table */
.tool-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 200px;
}

.tool-header img {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    object-fit: contain;
    background: white;
    padding: 2px;
}

.tool-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.tool-site-link {
    background: var(--button-bg);
    color: var(--text-primary);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s;
    z-index: 2;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.tool-site-link:hover {
    background: var(--button-hover-bg);
    color: var(--button-hover-text);
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Feature comparison */
.feature-row {
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.feature-name {
    font-weight: 600;
    color: var(--text-primary);
    background: rgba(37, 99, 235, 0.05);
    padding: 0.75rem 1rem;
    position: relative;
}

.feature-value {
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
}

.feature-value.positive {
    color: #10b981;
}

.feature-value.negative {
    color: #ef4444;
}

.feature-value.neutral {
    color: var(--text-secondary);
}

/* Feature icons */
.feature-icon {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-right: 0.5rem;
}

.feature-icon::before {
    font-size: 1.2rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .compare-main {
        padding: 0.5rem;
    }
    
    .tool-selection,
    .comparison-section {
        padding: 1rem;
    }
    
    .tool-grid {
        grid-template-columns: 1fr;
        max-height: 400px;
    }
    
    .tool-card {
        padding: 1rem;
    }
    
    .comparison-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .comparison-table-container {
        font-size: 0.8rem;
        margin: 0 -1rem;
        border-radius: 0;
    }
    
    .comparison-table {
        min-width: 600px;
    }
    
    .comparison-table th,
    .comparison-table td {
        padding: 0.5rem 0.3rem;
    }
    
    .tool-header {
        flex-direction: row;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        min-width: 120px;
        flex-wrap: wrap;
    }
    
    .tool-header img {
        width: 28px;
        height: 28px;
        flex-shrink: 0;
    }
    
    .tool-header h3 {
        font-size: 0.9rem;
        line-height: 1.2;
        margin: 0;
        flex: 1;
        min-width: 0;
    }
    
    .tool-site-link {
        width: 24px;
        height: 24px;
        font-size: 0.7rem;
        flex-shrink: 0;
    }
    
    .feature-name {
        font-size: 0.8rem;
        padding: 0.5rem 0.3rem;
    }
    
    .feature-value {
        font-size: 0.8rem;
        padding: 0.5rem 0.3rem;
    }
    
    .feature-icon {
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .compare-main {
        padding: 0.25rem;
    }
    
    .tool-selection,
    .comparison-section {
        padding: 0.75rem;
    }
    
    .comparison-table {
        min-width: 500px;
    }
    
    .comparison-table th,
    .comparison-table td {
        padding: 0.3rem 0.2rem;
    }
    
    .tool-header {
        min-width: 100px;
        gap: 0.3rem;
    }
    
    .tool-header img {
        width: 24px;
        height: 24px;
    }
    
    .tool-header h3 {
        font-size: 0.8rem;
    }
    
    .tool-site-link {
        width: 20px;
        height: 20px;
        font-size: 0.6rem;
    }
    
    /* Further reduce sticky column width on very small screens */
    .comparison-table th:first-child,
    .comparison-table td:first-child {
        min-width: 80px;
        max-width: 100px;
        padding: 0.2rem;
    }
    
    .feature-name {
        font-size: 0.7rem;
        padding: 0.4rem 0.2rem;
    }
    
    .feature-value {
        font-size: 0.7rem;
        padding: 0.4rem 0.2rem;
    }
}

@media (max-width: 480px) {
    .category-filter {
        flex-direction: column;
        align-items: stretch;
    }
    
    .compare-actions {
        flex-direction: column;
    }
    
    .compare-btn,
    .clear-btn {
        width: 100%;
    }
}

/* Loading states */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--accent);
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Error message styling */
.error-message {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 1rem;
    margin: 1rem 0;
    text-align: center;
    font-weight: 500;
}

/* Success message styling */
.success-message {
    background: #f0fdf4;
    color: #16a34a;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    padding: 1rem;
    margin: 1rem 0;
    text-align: center;
    font-weight: 500;
} 

/* Ad Zones for Compare Page */
.ad-zone {
    margin: 1rem 0;
    min-height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 8px;
    border: 1px dashed rgba(0, 0, 0, 0.1);
}

.ad-zone-top {
    margin-top: 0;
    margin-bottom: 1.5rem;
}

.ad-zone-bottom {
    margin-top: 1.5rem;
    margin-bottom: 0;
}

/* Responsive ad zones */
@media (max-width: 768px) {
    .ad-zone {
        margin: 0.5rem 0;
        min-height: 60px;
    }
    
    .ad-zone-top {
        margin-bottom: 1rem;
    }
    
    .ad-zone-bottom {
        margin-top: 1rem;
    }
}

@media (max-width: 480px) {
    .ad-zone {
        margin: 0.25rem 0;
        min-height: 50px;
    }
} 