/**
 * TrustedBrokers Frontend Styles
 * Modern Angular Design - Clean & Professional
 */

/* CSS Variables - TrustedBrokers Brand Colors */
:root {
    --tb-primary: #061f2b;
    --tb-primary-dark: #041219;
    --tb-primary-light: #0a3a50;
    --tb-secondary: #10526a;
    --tb-secondary-dark: #0a3a4d;
    --tb-accent: #6adfe3;
    --tb-accent-light: #8fe9ec;
    --tb-success: #10b981;
    --tb-warning: #f59e0b;
    --tb-danger: #ef4444;
    --tb-gray-50: #f9fafb;
    --tb-gray-100: #f3f4f6;
    --tb-gray-200: #e5e7eb;
    --tb-gray-300: #d1d5db;
    --tb-gray-400: #9ca3af;
    --tb-gray-500: #6b7280;
    --tb-gray-600: #4b5563;
    --tb-gray-700: #374151;
    --tb-gray-800: #1f2937;
    --tb-gray-900: #111827;
    --tb-white: #ffffff;
    --tb-border: #e5e7eb;
    --tb-border-focus: #10526a;
    --tb-radius: 0;
    --tb-radius-sm: 2px;
    --tb-shadow: 0 1px 3px rgba(9, 49, 68, 0.08);
    --tb-shadow-lg: 0 4px 12px rgba(9, 49, 68, 0.12);
    --tb-transition: all 0.15s ease;
}

/* Base Reset */
.tb-search-container *,
.tb-list-container *,
.tb-comparison-container * {
    box-sizing: border-box;
}

/* Icon Styling */
.tb-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.tb-icon svg {
    width: 100%;
    height: 100%;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

.tb-tab-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.tb-btn-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* Search Container */
.tb-search-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--tb-gray-900);
}

.tb-search-header {
    text-align: center;
    margin-bottom: 32px;
}

.tb-search-title {
    font-size: 28px;
    font-weight: 600;
    color: var(--tb-gray-900);
    margin: 0 0 8px 0;
    letter-spacing: -0.02em;
}

.tb-search-subtitle {
    font-size: 15px;
    color: var(--tb-gray-500);
    margin: 0;
    font-weight: 400;
}

/* Tabs - Modern Angular */
.tb-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 0;
    background: var(--tb-gray-100);
    border: 1px solid var(--tb-border);
    border-bottom: none;
}

.tb-tab {
    flex: 1;
    padding: 14px 20px;
    border: none;
    background: transparent;
    color: var(--tb-gray-600);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--tb-transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
}

.tb-tab:not(:last-child) {
    border-right: 1px solid var(--tb-border);
}

.tb-tab:hover {
    background: var(--tb-white);
    color: var(--tb-secondary);
}

.tb-tab.active {
    background: var(--tb-white);
    color: var(--tb-secondary);
    font-weight: 600;
}

.tb-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--tb-secondary);
}

/* Search Box - Angular Design */
.tb-search-box {
    background: var(--tb-white);
    border: 1px solid var(--tb-border);
    padding: 24px;
    box-shadow: var(--tb-shadow);
}

.tb-search-fields {
    display: none;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    align-items: end;
}

.tb-search-fields.active {
    display: grid;
}

.tb-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tb-field label {
    font-size: 13px;
    font-weight: 500;
    color: var(--tb-gray-700);
    letter-spacing: 0.01em;
}

.tb-field label::after {
    content: ' *';
    color: var(--tb-secondary);
    font-weight: 400;
}

/* Modern Angular Inputs */
.tb-input,
.tb-select {
    width: 100%;
    padding: 12px 14px;
    font-size: 14px;
    color: var(--tb-gray-900);
    background: var(--tb-white);
    border: 1px solid var(--tb-border);
    border-radius: var(--tb-radius);
    transition: var(--tb-transition);
    outline: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.tb-input::placeholder {
    color: var(--tb-gray-400);
}

.tb-input:hover,
.tb-select:hover {
    border-color: var(--tb-gray-400);
}

.tb-input:focus,
.tb-select:focus {
    border-color: var(--tb-secondary);
    box-shadow: 0 0 0 1px var(--tb-secondary);
}

/* Select with Custom Arrow */
.tb-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
    cursor: pointer;
}

.tb-select:focus {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23166a86' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}

/* Search Button - Angular */
.tb-field-button {
    align-self: end;
}

.tb-search-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    color: var(--tb-white);
    background: var(--tb-accent);
    border: none;
    border-radius: var(--tb-radius);
    cursor: pointer;
    transition: var(--tb-transition);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tb-search-button:hover {
    background: var(--tb-secondary);
}

.tb-search-button:active {
    transform: translateY(1px);
}

/* Partner Logos Row */
.tb-partners-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 32px;
    padding: 20px 0;
    margin-top: 24px;
    border-top: 1px solid var(--tb-border);
}

.tb-partner-logo {
    max-height: 28px;
    width: auto;
    opacity: 0.6;
    filter: grayscale(100%);
    transition: var(--tb-transition);
}

.tb-partner-logo:hover {
    opacity: 1;
    filter: grayscale(0%);
}

/* Results Container */
.tb-search-results {
    margin-top: 32px;
}

/* List Container */
.tb-list-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.tb-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--tb-border);
}

.tb-list-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--tb-gray-900);
    margin: 0;
}

.tb-list-count {
    font-size: 14px;
    color: var(--tb-gray-500);
}

/* Sort Select */
.tb-sort-select {
    padding: 8px 36px 8px 12px;
    font-size: 13px;
    color: var(--tb-gray-700);
    background: var(--tb-white);
    border: 1px solid var(--tb-border);
    border-radius: var(--tb-radius);
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

/* List Items - Modern Card */
.tb-list-items {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tb-list-item {
    display: grid;
    grid-template-columns: 50px 1fr auto;
    gap: 20px;
    align-items: center;
    padding: 20px;
    background: var(--tb-white);
    border: 1px solid var(--tb-border);
    transition: var(--tb-transition);
}

.tb-list-item:hover {
    border-color: var(--tb-gray-300);
    box-shadow: var(--tb-shadow);
}

.tb-list-item.featured {
    border-left: 3px solid var(--tb-accent);
}

.tb-list-item.partner {
    background: linear-gradient(to right, rgba(26, 61, 77, 0.02), transparent);
}

/* Rank Number */
.tb-rank {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    font-size: 16px;
    font-weight: 700;
    color: var(--tb-gray-500);
    background: var(--tb-gray-100);
    border: 1px solid var(--tb-border);
}

.tb-rank.rank-1 {
    color: var(--tb-white);
    background: var(--tb-accent);
    border-color: var(--tb-accent);
}

.tb-rank.rank-2 {
    color: var(--tb-white);
    background: var(--tb-secondary);
    border-color: var(--tb-secondary);
}

.tb-rank.rank-3 {
    color: var(--tb-white);
    background: var(--tb-primary);
    border-color: var(--tb-primary);
}

/* Item Info */
.tb-item-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.tb-item-logo {
    width: 60px;
    height: 60px;
    object-fit: contain;
    border: 1px solid var(--tb-border);
    padding: 8px;
    background: var(--tb-white);
}

.tb-item-details {
    flex: 1;
}

.tb-item-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--tb-gray-900);
    margin: 0 0 4px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tb-item-badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    background: var(--tb-accent);
    color: var(--tb-white);
}

.tb-item-meta {
    font-size: 13px;
    color: var(--tb-gray-500);
    margin: 0;
}

/* Rating Stars */
.tb-rating {
    display: flex;
    align-items: center;
    gap: 6px;
}

.tb-stars {
    display: flex;
    gap: 2px;
}

.tb-star {
    width: 16px;
    height: 16px;
    color: var(--tb-gray-300);
}

.tb-star.filled {
    color: var(--tb-warning);
}

.tb-star.half {
    color: var(--tb-warning);
}

.tb-rating-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--tb-gray-900);
}

.tb-rating-count {
    font-size: 12px;
    color: var(--tb-gray-500);
}

/* Features Tags */
.tb-features {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.tb-feature-tag {
    display: inline-block;
    padding: 4px 10px;
    font-size: 12px;
    color: var(--tb-gray-600);
    background: var(--tb-gray-100);
    border: 1px solid var(--tb-border);
}

/* Pros Display */
.tb-pros {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.tb-pro-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: var(--tb-success);
}

.tb-pro-item::before {
    content: '';
    width: 14px;
    height: 14px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2310b981' stroke-width='2.5'%3E%3Cpath d='M20 6L9 17l-5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: contain;
}

/* Item Actions */
.tb-item-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-end;
}

.tb-cta-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    color: var(--tb-white);
    background: var(--tb-accent);
    border: none;
    text-decoration: none;
    cursor: pointer;
    transition: var(--tb-transition);
    white-space: nowrap;
}

.tb-cta-button:hover {
    background: var(--tb-secondary);
    color: var(--tb-white);
}

.tb-cta-button.secondary {
    color: var(--tb-secondary);
    background: transparent;
    border: 1px solid var(--tb-secondary);
}

.tb-cta-button.secondary:hover {
    background: var(--tb-secondary);
    color: var(--tb-white);
}

.tb-compare-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--tb-gray-500);
    cursor: pointer;
}

.tb-compare-checkbox input {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* Comparison Table - Angular */
.tb-comparison-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.tb-comparison-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--tb-white);
    border: 1px solid var(--tb-border);
}

.tb-comparison-table th,
.tb-comparison-table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--tb-border);
    font-size: 14px;
}

.tb-comparison-table th {
    background: var(--tb-gray-50);
    font-weight: 600;
    color: var(--tb-gray-700);
}

.tb-comparison-table th:first-child {
    width: 180px;
    color: var(--tb-gray-500);
    font-weight: 500;
}

.tb-comparison-table td:not(:first-child) {
    text-align: center;
}

.tb-comparison-table tr:hover td {
    background: var(--tb-gray-50);
}

.tb-comparison-header {
    text-align: center;
    padding: 20px;
}

.tb-comparison-logo {
    width: 80px;
    height: 50px;
    object-fit: contain;
    margin-bottom: 8px;
}

.tb-comparison-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--tb-gray-900);
}

/* Top Rated Cards */
.tb-top-rated-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.tb-top-card {
    background: var(--tb-white);
    border: 1px solid var(--tb-border);
    padding: 24px;
    transition: var(--tb-transition);
}

.tb-top-card:hover {
    border-color: var(--tb-gray-300);
    box-shadow: var(--tb-shadow-lg);
}

.tb-top-card-rank {
    display: inline-block;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 700;
    color: var(--tb-white);
    background: var(--tb-accent);
    margin-bottom: 16px;
}

.tb-top-card-rank.rank-1 {
    background: var(--tb-accent);
}

.tb-top-card-rank.rank-2 {
    background: var(--tb-secondary);
}

.tb-top-card-rank.rank-3 {
    background: var(--tb-primary);
}

.tb-top-card-logo {
    width: 100%;
    height: 60px;
    object-fit: contain;
    margin-bottom: 16px;
}

.tb-top-card-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--tb-gray-900);
    margin: 0 0 8px 0;
}

.tb-top-card-features {
    list-style: none;
    padding: 0;
    margin: 16px 0;
}

.tb-top-card-features li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    font-size: 13px;
    color: var(--tb-gray-600);
    border-bottom: 1px solid var(--tb-gray-100);
}

.tb-top-card-features li:last-child {
    border-bottom: none;
}

/* Loading State */
.tb-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--tb-gray-500);
}

.tb-loading::before {
    content: '';
    width: 24px;
    height: 24px;
    border: 2px solid var(--tb-gray-200);
    border-top-color: var(--tb-primary);
    animation: tb-spin 0.6s linear infinite;
    margin-right: 12px;
}

@keyframes tb-spin {
    to { transform: rotate(360deg); }
}

/* No Results */
.tb-no-results {
    text-align: center;
    padding: 60px 20px;
    color: var(--tb-gray-500);
}

.tb-no-results-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* Load More Button */
.tb-load-more {
    display: block;
    width: 100%;
    max-width: 300px;
    margin: 32px auto 0;
    padding: 14px 24px;
    font-size: 14px;
    font-weight: 600;
    color: var(--tb-secondary);
    background: transparent;
    border: 1px solid var(--tb-secondary);
    cursor: pointer;
    transition: var(--tb-transition);
}

.tb-load-more:hover {
    background: var(--tb-secondary);
    color: var(--tb-white);
}

/* Floating Compare Bar */
.tb-compare-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--tb-gray-900);
    color: var(--tb-white);
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    z-index: 1000;
}

.tb-compare-bar.active {
    transform: translateY(0);
}

.tb-compare-bar-items {
    display: flex;
    align-items: center;
    gap: 12px;
}

.tb-compare-bar-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.1);
    font-size: 13px;
}

.tb-compare-bar-item button {
    background: none;
    border: none;
    color: var(--tb-gray-400);
    cursor: pointer;
    padding: 0;
    font-size: 16px;
}

.tb-compare-bar-item button:hover {
    color: var(--tb-white);
}

.tb-compare-bar-button {
    padding: 12px 28px;
    font-size: 14px;
    font-weight: 600;
    color: var(--tb-gray-900);
    background: var(--tb-white);
    border: none;
    cursor: pointer;
    transition: var(--tb-transition);
}

.tb-compare-bar-button:hover {
    background: var(--tb-gray-100);
}

/* Responsive Design */
@media (max-width: 992px) {
    .tb-search-fields {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .tb-list-item {
        grid-template-columns: 40px 1fr;
    }
    
    .tb-item-actions {
        grid-column: span 2;
        flex-direction: row;
        justify-content: flex-end;
        padding-top: 16px;
        border-top: 1px solid var(--tb-border);
        margin-top: 16px;
    }
}

@media (max-width: 768px) {
    .tb-search-container,
    .tb-list-container {
        padding: 16px;
    }
    
    .tb-tabs {
        flex-direction: column;
    }
    
    .tb-tab:not(:last-child) {
        border-right: none;
        border-bottom: 1px solid var(--tb-border);
    }
    
    .tb-search-fields {
        grid-template-columns: 1fr;
    }
    
    .tb-list-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
    
    .tb-list-item {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .tb-rank {
        position: absolute;
        top: 16px;
        right: 16px;
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    
    .tb-item-actions {
        grid-column: 1;
        flex-direction: column;
        align-items: stretch;
    }
    
    .tb-cta-button {
        width: 100%;
    }
    
    .tb-comparison-table {
        display: block;
        overflow-x: auto;
    }
    
    .tb-top-rated-container {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .tb-search-title {
        font-size: 22px;
    }
    
    .tb-search-box {
        padding: 16px;
    }
    
    .tb-partners-row {
        flex-wrap: wrap;
        gap: 20px;
    }
}
