/**
 * UK Solar Panel Directory - Modern Table Design
 * Engaging, user-friendly table view with sidebar filters
 */

/* Reset and Base Styles */
* {
    box-sizing: border-box;
}

.solar-panel-directory {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f8fafc;
    min-height: 100vh;
}

/* Header Styles */
.directory-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px 20px;
    text-align: center;
}

.header-content h1 {
    font-size: 2.5rem;
    margin: 0 0 15px 0;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header-content p {
    font-size: 1.1rem;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto 30px;
    line-height: 1.6;
}

.header-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-top: 30px;
}

.stat-item {
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Main Layout */
.directory-layout {
    max-width: 100%;
    margin: 0;
    padding: 0;
}

/* Main Content Area */
.directory-main {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.sidebar-section {
    margin-bottom: 30px;
    padding-bottom: 25px;
    border-bottom: 1px solid #f1f5f9;
}

.sidebar-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.sidebar-section h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 15px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Quick Filter Buttons */
.quick-filter-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.quick-filter-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    color: #475569;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.quick-filter-btn:hover {
    background: #e2e8f0;
    border-color: #cbd5e1;
    transform: translateX(2px);
}

.quick-filter-btn.active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: white;
}

.filter-icon {
    font-size: 1.1rem;
}

/* Filter Groups */
.filter-group {
    margin-bottom: 20px;
}

.filter-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
}

.filter-group input,
.filter-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: border-color 0.2s ease;
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.range-inputs {
    display: flex;
    align-items: center;
    gap: 8px;
}

.range-inputs input {
    flex: 1;
}

.range-separator {
    font-size: 0.8rem;
    color: #6b7280;
    font-weight: 500;
}

/* Features List */
.features-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.feature-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
}

.feature-checkbox input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.feature-checkbox label {
    margin: 0;
    font-size: 0.85rem;
    font-weight: 400;
    cursor: pointer;
}

/* Tool Buttons */
.tool-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tool-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    color: #475569;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.tool-btn:hover {
    background: #e2e8f0;
    border-color: #cbd5e1;
}

.tool-btn:active {
    transform: translateY(1px);
}

/* Results Summary */
.results-summary {
    background: #f8fafc;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.filtered-count {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 8px;
}

.comparison-count {
    font-size: 0.85rem;
    color: #64748b;
}

/* Main Content Area */
.directory-main {
    flex: 1;
    background: white;
    padding: 30px;
    overflow-x: auto;
}

/* Table Header */
.table-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f1f5f9;
    position: relative;
    z-index: 5;
}

.table-title h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 5px 0;
}

.table-title p {
    font-size: 0.9rem;
    color: #64748b;
    margin: 0;
}

.table-controls {
    display: flex;
    align-items: center;
    gap: 20px;
}

.sort-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sort-controls label {
    font-size: 0.9rem;
    font-weight: 500;
    color: #374151;
}

.sort-controls select {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.9rem;
}

.view-controls {
    display: flex;
    gap: 4px;
    background: #f1f5f9;
    padding: 4px;
    border-radius: 8px;
}

.view-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: #64748b;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.view-btn.active {
    background: white;
    color: #1e293b;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Table Styles */
.table-container {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border: 1px solid #e2e8f0;
}

.panels-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.panels-table thead {
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
}

.panels-table th {
    padding: 15px 12px;
    text-align: left;
    font-weight: 600;
    color: #374151;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-right: 1px solid #e2e8f0;
}

.panels-table th:last-child {
    border-right: none;
}

.panels-table td {
    padding: 15px 12px;
    border-bottom: 1px solid #f1f5f9;
    border-right: 1px solid #f1f5f9;
    vertical-align: middle;
}

.panels-table td:last-child {
    border-right: none;
}

.panels-table tbody tr {
    transition: background-color 0.2s ease;
    cursor: pointer;
}

.panels-table tbody tr:hover {
    background: #f8fafc;
}

.panels-table tbody tr.selected {
    background: #eff6ff;
    border-left: 3px solid #3b82f6;
}

/* Table Column Styles */
.select-col {
    width: 40px;
    text-align: center;
}

.manufacturer-col {
    width: 120px;
    font-weight: 600;
    color: #1e293b;
}

.model-col {
    width: 180px;
    font-weight: 500;
}

.power-col {
    width: 80px;
    text-align: center;
    font-weight: 600;
    color: #059669;
}

.voltage-col,
.current-col {
    width: 70px;
    text-align: center;
}

.width-col,
.height-col {
    width: 80px;
    text-align: center;
    font-size: 0.85rem;
    color: #64748b;
}

.price-col {
    width: 100px;
    text-align: right;
    font-weight: 600;
    color: #dc2626;
}

.price-per-watt-col {
    width: 70px;
    text-align: center;
    font-weight: 500;
    color: #7c3aed;
}

.supplier-col {
    width: 120px;
    font-size: 0.85rem;
    color: #64748b;
}

.features-col {
    width: 120px;
}

.actions-col {
    width: 100px;
    text-align: center;
}

/* Feature Badges */
.feature-badge {
    display: inline-block;
    padding: 2px 6px;
    background: #e0e7ff;
    color: #3730a3;
    font-size: 0.7rem;
    font-weight: 500;
    border-radius: 4px;
    margin: 1px;
}

.feature-badge.bifacial {
    background: #dcfce7;
    color: #166534;
}

.feature-badge.all-black {
    background: #1f2937;
    color: white;
}

/* Action Buttons */
.action-btn {
    padding: 6px 12px;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.action-btn:hover {
    background: #2563eb;
}

.action-btn.secondary {
    background: #6b7280;
}

.action-btn.secondary:hover {
    background: #4b5563;
}

/* Cards View */
.cards-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.panel-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.panel-card:hover {
    border-color: #3b82f6;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
    transform: translateY(-2px);
}

.panel-card.selected {
    border-color: #3b82f6;
    background: #eff6ff;
}

/* Comparison Section */
.comparison-section {
    margin-top: 30px;
    padding: 25px;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.comparison-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.comparison-header h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
}

.comparison-panels {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

/* Loading State */
.loading {
    text-align: center;
    padding: 60px 20px;
    color: #64748b;
    font-size: 1.1rem;
}

/* Filters Section */
.filters-section {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f1f5f9;
}

.filters-header h3 {
    font-size: 1.3rem;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
}

.quick-filters {
    margin-bottom: 25px;
}

.quick-filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.quick-filter-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    color: #475569;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.quick-filter-btn:hover {
    background: #e2e8f0;
    border-color: #cbd5e1;
    transform: translateY(-1px);
}

.quick-filter-btn.active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: white;
}

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

.filter-group {
    display: flex;
    flex-direction: column;
}

.filter-group label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
}

.filter-group input,
.filter-group select {
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: border-color 0.2s ease;
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.range-inputs {
    display: flex;
    align-items: center;
    gap: 8px;
}

.range-inputs input {
    flex: 1;
}

.range-separator {
    font-size: 0.8rem;
    color: #6b7280;
    font-weight: 500;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 8px;
}

.feature-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
}

.feature-checkbox input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.feature-checkbox label {
    margin: 0;
    font-size: 0.85rem;
    font-weight: 400;
    cursor: pointer;
}

.filter-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-outline {
    background: white;
    color: #374151;
    border-color: #d1d5db;
}

.btn-outline:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

.btn-secondary {
    background: #6b7280;
    color: white;
    border-color: #6b7280;
}

.btn-secondary:hover {
    background: #4b5563;
    border-color: #4b5563;
}

/* Sidebar Widget Styles */
.solar-panel-filters-widget {
    background: #f8fafc;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.solar-panel-filters-widget .widget-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 20px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #e2e8f0;
}

.solar-panel-filters-widget .quick-filter-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.solar-panel-filters-widget .quick-filter-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    color: #475569;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    width: 100%;
}

.solar-panel-filters-widget .quick-filter-btn:hover {
    background: #e2e8f0;
    border-color: #cbd5e1;
}

.solar-panel-filters-widget .quick-filter-btn.active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: white;
}

.solar-panel-filters-widget .filter-group {
    margin-bottom: 15px;
}

.solar-panel-filters-widget .filter-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}

.solar-panel-filters-widget .filter-group input,
.solar-panel-filters-widget .filter-group select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 0.85rem;
    transition: border-color 0.2s ease;
}

.solar-panel-filters-widget .filter-group input:focus,
.solar-panel-filters-widget .filter-group select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.solar-panel-filters-widget .range-inputs {
    display: flex;
    align-items: center;
    gap: 6px;
}

.solar-panel-filters-widget .range-inputs input {
    flex: 1;
}

.solar-panel-filters-widget .range-separator {
    font-size: 0.75rem;
    color: #6b7280;
    font-weight: 500;
}

.solar-panel-filters-widget .features-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.solar-panel-filters-widget .feature-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
}

.solar-panel-filters-widget .feature-checkbox input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.solar-panel-filters-widget .feature-checkbox label {
    margin: 0;
    font-size: 0.8rem;
    font-weight: 400;
    cursor: pointer;
}

.solar-panel-filters-widget .results-summary {
    background: white;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    margin-bottom: 15px;
}

.solar-panel-filters-widget .filtered-count {
    font-size: 0.9rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 4px;
}

.solar-panel-filters-widget .comparison-count {
    font-size: 0.75rem;
    color: #64748b;
}

.solar-panel-filters-widget .filter-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.solar-panel-filters-widget .btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    width: 100%;
}

.solar-panel-filters-widget .btn-outline {
    background: white;
    color: #374151;
    border-color: #d1d5db;
}

.solar-panel-filters-widget .btn-outline:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

.solar-panel-filters-widget .btn-secondary {
    background: #6b7280;
    color: white;
    border-color: #6b7280;
}

.solar-panel-filters-widget .btn-secondary:hover {
    background: #4b5563;
    border-color: #4b5563;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .directory-layout {
        padding: 0 15px;
    }
    
    .header-stats {
        gap: 20px;
    }
    
    .stat-number {
        font-size: 1.5rem;
    }
}

@media (max-width: 768px) {
    .directory-header {
        padding: 30px 15px;
    }
    
    .header-content h1 {
        font-size: 2rem;
    }
    
    .header-stats {
        flex-direction: column;
        gap: 15px;
    }
    
    .directory-main {
        padding: 20px 15px;
    }
    
    .table-header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    
    .table-controls {
        justify-content: space-between;
    }
    
    .table-container {
        overflow-x: auto;
    }
    
    .panels-table {
        min-width: 800px;
    }
    
    .cards-view {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .directory-sidebar {
        padding: 20px 15px;
    }
    
    .sidebar-section {
        margin-bottom: 20px;
        padding-bottom: 15px;
    }
    
    .quick-filter-buttons {
        gap: 6px;
    }
    
    .quick-filter-btn {
        padding: 10px 12px;
        font-size: 0.85rem;
    }
}

/* Page-specific two-column layout and compact quick filters */
.solar-panel-directory .directory-header { position: relative; z-index: 0; }
.solar-panel-directory .content-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 24px;
    max-width: 1200px;
    margin: 0 auto; /* avoid overlay that can block clicks */
    padding: 0 16px 32px;
    position: relative;
    z-index: 1;
}
.solar-panel-directory #cards-view { display: none; }
.solar-panel-directory .quick-filter-buttons { flex-direction: row; flex-wrap: wrap; }
.solar-panel-directory .quick-filter-btn { padding: 6px 10px; font-size: 0.85rem; }
.solar-panel-directory .table-container thead th { position: sticky; top: 0; z-index: 5; }
.solar-panel-directory .directory-main { border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.solar-panel-directory .directory-sidebar { background: white; border: 1px solid #e2e8f0; border-radius: 12px; padding: 20px; height: fit-content; }

@media (max-width: 1024px) {
  .solar-panel-directory .content-layout { grid-template-columns: 1fr; }
}
