/**
 * 🏢 BAZA FIRM - Styles
 * 
 * Strona z listą firm z min. 2 aktywnymi ofertami
 * Grid layout, filtry inline, paginacja/infinite scroll
 * 
 * @since Sprint 8 (Faza 2)
 * @version 2.0.0 - Multi-country system completed + optimized debug
 */

/* ==========================================
   🔧 RESET ASTRY - DOPASOWANIE DO BAZY FIRM
   ========================================== */

/* Reset globalnych stylów Astry */
body.blog #page,
body.blog .site,
body.page #page,
body.page .site {
    overflow-x: hidden;
    max-width: 100%;
    margin: 0;
}

/* Reset kontenerów Astry dla strony bazy firm */
body.blog .ast-container,
body.blog #content,
body.blog .site-content,
body.blog #primary,
body.blog .content-area,
body.blog .entry-content,
body.page .ast-container,
body.page #content,
body.page .site-content,
body.page #primary,
body.page .content-area,
body.page .entry-content {
    max-width: 100%;
    width: 100%;
    padding: 0;
    margin: 0;
}

/* Wyłącz box layout Astry */
body.blog.ast-box-layout #page,
body.page.ast-box-layout #page {
    max-width: 100%;
    margin: 0;
    box-shadow: none;
}

/* Ukryj sidebar */
body.blog #secondary,
body.blog .ast-sidebar-wrap,
body.blog .widget-area,
body.page #secondary,
body.page .ast-sidebar-wrap,
body.page .widget-area {
    display: none !important;
}

/* Box sizing */
.portal-offers-container *,
.portal-offers-container *::before,
.portal-offers-container *::after {
    box-sizing: border-box;
}

/* ==========================================
   GŁÓWNY KONTENER I HERO
   ========================================== */

/* Spójność z innymi stronami - kontener główny */
.company-base-container {
    width: 100%;
    max-width: var(--container-max-width); /* 1400px - Global Container System */
    margin-left: auto;
    margin-right: auto;
    /* margin-bottom dziedziczony z .portal-page-container (Footer Spacing System v1.0) */
    padding: var(--container-padding); /* 20px - Global Container System */
    min-height: 100vh;
    position: relative;
    box-sizing: border-box;
}

/* Base styles (width, max-width, margin, padding, box-sizing) dziedziczone z .portal-page-container */
/* Margin-top automatycznie zarządzany przez Page Container System v1.0 */
/* Margin-bottom automatycznie zarządzany przez Footer Spacing System v1.0 (60px → responsive) */

/* Ujednolicony styl dla HERO section */
.company-base-container .portal-offers-header {
    text-align: center;
    padding: 60px var(--card-padding-md) 40px; /* Shape & Sizing System v4.0 */
    border-radius: var(--radius-card); /* 12px */
    margin: 0 0 40px 0; /* Usunięto margin-top - dodawany przez body:not pattern na kontenerze */
}

/* Tablet portrait (768px and below) */
@media (max-width: 768px) {
    .company-base-container.portal-offers-container {
        padding: 10px;
        /* margin dziedziczony z .portal-page-container (Page Container + Footer Spacing System) */
    }
}

/* Mobile (480px and below) - margin-top dziedziczony z .portal-page-container */

/* Small mobile (375px and below) - margin-top dziedziczony z .portal-page-container */

/* ==========================================
   🏢 HERO SECTION (używa .portal-offers-header z style.css)
   ========================================== */

/* Gradient i kolory dziedziczone z variables.css (globalne reguły linia 547-575) */
/* background: var(--hero-gradient) !important - DZIEDZICZONE AUTOMATYCZNIE */
/* color: var(--text-inverse) !important - DZIEDZICZONE AUTOMATYCZNIE */

.portal-offers-header {
    /* background i color DZIEDZICZONE z variables.css - nie nadpisuj! */
    /* Tylko unikalne style dla tej strony: */
    text-align: center;
    margin: 0 0 30px 0; /* Usunięto margin-top - hero zaczyna się od góry kontenera */
}

.company-base-container .portal-offers-header .hero-title {
    margin: 0 0 15px 0;
    font-size: 2.5rem;
    font-weight: 700;
}

.company-base-container .portal-offers-header .hero-subtitle {
    font-size: 1.1rem;
    margin: 0 0 20px 0;
    opacity: 0.95;
}

.company-base-container .portal-offers-header .hero-stats {
    margin-top: var(--section-spacing-xs); /* 16px - Section Spacing System v1.0 */
}

.companies-count {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.2);
    padding: var(--btn-padding-md); /* 12px 24px - Shape & Sizing System v4.0 */
    border-radius: var(--radius-full); /* pill shape */
    font-size: 1rem;
    font-weight: 600;
    backdrop-filter: blur(10px);
}

.spinner-small {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ==========================================
   🔍 FILTRY INLINE
   ========================================== */

.company-filters-section {
    background: var(--bg-secondary);
    padding: var(--card-padding-lg) var(--card-padding-md); /* 30px 20px - Shape & Sizing System v4.0 */
    margin: 0 0 40px 0;
    border-radius: var(--radius-card); /* 12px */
    /* border usunięty - czyste tło */
}

.company-filters-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.filters-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.filters-row-secondary {
    display: grid;
    grid-template-columns: 2fr 1fr auto;
    gap: 20px;
    align-items: end;
}

.filter-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-field label {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}

.filter-field input[type="text"],
.filter-field select {
    padding: var(--input-padding); /* 10px 15px - Shape & Sizing System v4.0 */
    border: 2px solid var(--border-color);
    border-radius: var(--radius-input); /* 4px */
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 15px;
    transition: var(--transition);
    line-height: 1.5;
    height: auto;
    min-height: var(--input-height-md); /* 44px */
}

.filter-field input[type="text"] {
    display: block;
    width: 100%;
}

.filter-field select {
    display: block;
    width: 100%;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.filter-field input[type="text"]:focus,
.filter-field select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Filtr kraju */
#filter_country,
#modal-filter-country {
    font-size: 14px;
    padding: var(--input-padding); /* 10px 15px - Shape & Sizing System v4.0 */
    border: 2px solid var(--border-color);
    border-radius: var(--radius-input); /* 4px */
    background: var(--bg-input);
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
    line-height: 1.5;
    height: auto;
    min-height: var(--input-height-md); /* 44px */
    display: flex;
    align-items: center;
}

#filter_country:hover,
#modal-filter-country:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

#filter_country:focus,
#modal-filter-country:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#filter_country option,
#modal-filter-country option {
    padding: 10px;
    font-size: 14px;
    font-weight: 500;
}

/* Tooltips (dodane dla filtrów) */
.tooltip-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.tooltip {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.9);
    color: #fff;
    padding: 8px 12px;
    border-radius: var(--radius-md); /* 8px - tooltip - Shape & Sizing System v5.0 */
    font-size: 13px;
    line-height: 1.4;
    white-space: normal;
    max-width: 250px;
    z-index: 1000;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    text-align: center;
    font-weight: 400;
}

.tooltip::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.9);
}

.tooltip-wrapper:hover .tooltip {
    visibility: visible;
    opacity: 1;
}

/* Kategorie prawa jazdy */
.filter-categories {
    flex-direction: column;
}

.category-checkboxes {
    display: flex;
    gap: 20px;
    align-items: center;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    position: relative;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--primary-color);
    cursor: pointer;
}

.checkbox-box {
    display: none; /* Używamy natywnych checkboxów */
}

.checkbox-label span:not(.checkbox-box):not(.tooltip) {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    user-select: none;
}

/* Tooltip */
.tooltip-wrapper {
    position: relative;
}

.tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: var(--radius-md); /* 8px - tooltip - Shape & Sizing System v5.0 */
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1000;
    margin-bottom: 8px;
}

.tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.9);
}

.tooltip-wrapper:hover .tooltip {
    opacity: 1;
}

/* Przycisk reset */
.btn-reset {
    padding: var(--btn-padding-md); /* 12px 24px - Shape & Sizing System v4.0 */
    background: var(--bg-card);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-button); /* 8px */
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.btn-reset:hover {
    background: var(--danger-color);
    color: white;
    border-color: var(--danger-color);
    transform: translateY(-1px);
}

/* ==========================================
   📊 NAGŁÓWEK WYNIKÓW
   ========================================== */

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: var(--space-4) var(--card-padding-md); /* 16px 20px - Shape & Sizing System v4.0 */
    background: var(--bg-card);
    border-radius: var(--radius-card); /* 12px */
    /* border usunięty - czyste tło */
    flex-wrap: wrap;
    gap: 15px;
}

.results-info {
    color: var(--text-secondary);
    font-size: 14px;
}

#filtered-count {
    font-weight: 600;
    color: var(--text-primary);
}

.view-controls {
    display: flex;
    gap: 10px;
}

.mode-btn {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    padding: var(--btn-padding-sm); /* 8px 16px - Shape & Sizing System v4.0 */
    border-radius: var(--radius-badge); /* pill shape */
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
}

.mode-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.mode-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* ==========================================
   🏢 GRID FIRM
   ========================================== */

.companies-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    margin-bottom: 40px;
}

/* ==========================================
   🎴 KARTA FIRMY
   ========================================== */

.company-card {
    background: var(--bg-card);
    border-radius: var(--radius-card); /* 12px - Shape & Sizing System v4.0 */
    padding: var(--card-padding-compact); /* 25px */
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.company-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

/* Header karty z logo */
.company-card-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.company-logo {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-card); /* 12px - Shape & Sizing System v4.0 */
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid var(--border-color);
}

.company-logo-placeholder {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-card); /* 12px - Shape & Sizing System v4.0 */
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.company-name {
    flex: 1;
    min-width: 0;
}

.company-name h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Badge aktywna firma */
.company-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    background: linear-gradient(135deg, #ffd700, #ff8c00);
    color: white;
    padding: var(--badge-padding-md); /* 6px 12px */
    border-radius: var(--radius-full); /* pill shape - Shape & Sizing System v5.0 */
    font-size: 12px;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.4);
}

/* Informacje o firmie */
.company-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
    flex: 1;
}

.company-info-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--text-secondary);
}

.company-info-item .icon {
    font-size: 16px;
    color: var(--primary-color);
    width: 20px;
    text-align: center;
}

.company-info-item strong {
    color: var(--text-primary);
}

.company-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.category-badge {
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 4px 10px;
    border-radius: var(--radius-card); /* 12px - Shape & Sizing System v4.0 */
    font-size: 13px;
    font-weight: 600;
    border: 1px solid var(--border-color);
}

/* Przycisk zobacz oferty */
.company-card-footer {
    margin-top: auto;
}

.btn-view-offers {
    display: block;
    width: 100%;
    padding: var(--btn-padding-md); /* 12px 24px - Shape & Sizing System v4.0 */
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    border: none;
    border-radius: var(--radius-button); /* 8px */
    font-size: 15px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
}

.btn-view-offers:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    opacity: 0.9;
}

/* ==========================================
   ⚙️ LOADING & EMPTY STATES
   ========================================== */

/* Skeleton loading */
.skeleton-card {
    background: var(--bg-card);
    border-radius: var(--radius-card); /* 12px - Shape & Sizing System v4.0 */
    padding: var(--card-padding-compact); /* 25px */
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    overflow: hidden;
    position: relative;
}

.skeleton-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -150px;
    width: 150px;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    animation: skeleton-loading 1.5s infinite;
}

@keyframes skeleton-loading {
    0% { left: -150px; }
    100% { left: 100%; }
}

.skeleton-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.skeleton-logo {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-card); /* 12px - Shape & Sizing System v4.0 */
    background: var(--bg-secondary);
}

.skeleton-name {
    flex: 1;
    height: 24px;
    border-radius: var(--radius-sm); /* 4px - Shape & Sizing System v4.0 */
    background: var(--bg-secondary);
}

.skeleton-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.skeleton-line {
    height: 16px;
    border-radius: var(--radius-sm); /* 4px - Shape & Sizing System v4.0 */
    background: var(--bg-secondary);
}

.skeleton-line:nth-child(1) {
    width: 60%;
}

.skeleton-line:nth-child(2) {
    width: 80%;
}

.skeleton-line:nth-child(3) {
    width: 50%;
}

.skeleton-button {
    height: var(--input-height-md); /* 44px - Shape & Sizing System v4.0 */
    border-radius: var(--radius-button); /* 8px */
    background: var(--bg-secondary);
}

.loading-spinner {
    text-align: center;
    padding: 60px 20px;
}

.spinner {
    display: inline-block;
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

.loading-spinner p {
    color: var(--text-secondary);
    font-size: 16px;
}

.infinite-end {
    text-align: center;
    padding: var(--card-padding-xl) var(--card-padding-md); /* 40px 20px - Shape & Sizing System v4.0 */
    background: var(--bg-card);
    border-radius: var(--radius-card); /* 12px */
    border: 2px dashed var(--border-color);
    margin: 40px 0;
}

.infinite-end p {
    margin: 0 0 20px 0;
    color: var(--text-secondary);
    font-size: 16px;
}

.btn-back-top {
    padding: var(--btn-padding-md); /* 12px 24px - Shape & Sizing System v4.0 */
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-button); /* 8px */
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-back-top:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.error-message {
    text-align: center;
    padding: 40px 20px;
    background: var(--danger-bg);
    border: 2px solid var(--danger-color);
    border-radius: var(--radius-card); /* 12px - Shape & Sizing System v4.0 */
    margin: 40px 0;
}

.error-message p {
    margin: 0 0 20px 0;
    color: var(--danger-color);
    font-size: 16px;
    font-weight: 600;
}

.btn-retry {
    padding: var(--btn-padding-md); /* 12px 24px - Shape & Sizing System v4.0 */
    background: var(--danger-color);
    color: white;
    border: none;
    border-radius: var(--radius-button); /* 8px */
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-retry:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.4);
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 80px 20px;
}

.empty-state-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.6;
}

.empty-state h3 {
    margin: 0 0 10px 0;
    font-size: 24px;
    color: var(--text-primary);
}

.empty-state p {
    margin: 0 0 20px 0;
    color: var(--text-secondary);
    font-size: 16px;
}

/* ==========================================
   📄 PAGINACJA
   ========================================== */

.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin: 40px 0;
    flex-wrap: wrap;
}

.pagination-btn {
    padding: var(--btn-padding-sm); /* 8px 16px - Shape & Sizing System v4.0 */
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-button); /* 8px */
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.pagination-btn:hover:not(.active):not(:disabled) {
    background: var(--bg-hover);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.pagination-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-load-more {
    display: block;
    width: 100%;
    max-width: 400px;
    margin: 40px auto;
    padding: 16px 32px;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    border: none;
    border-radius: var(--radius-card); /* 12px - Shape & Sizing System v4.0 */
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-load-more:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* ==========================================
   📱 RESPONSYWNOŚĆ
   ========================================== */

/* Tablet (768px - 1199px) */
@media (max-width: 1199px) {
    .companies-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 25px;
    }
    
    .filters-row {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .filters-row-secondary {
        grid-template-columns: 1fr;
    }
}

/* Mobile (< 768px) */
@media (max-width: 768px) {
    .company-base-container .portal-offers-header {
        padding: 40px 15px 30px;
        margin: 0 0 30px 0; /* Normalny margin - hero w kontenerze */
    }
    
    .company-base-container .portal-offers-header .hero-title {
        font-size: 2rem;
    }
    
    .company-filters-section {
        padding: 20px 15px; /* Custom - Responsive mobile filters */
        margin: 0 0 30px 0;
    }
    
    .companies-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .filters-row {
        grid-template-columns: 1fr;
    }
    
    .category-checkboxes {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .results-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .view-controls {
        width: 100%;
    }
    
    .mode-btn {
        flex: 1;
    }
    
    .company-card-header {
        flex-direction: column;
        text-align: center;
    }
    
    .company-logo,
    .company-logo-placeholder {
        width: 100px;
        height: 100px;
    }
}

/* Small mobile (< 480px) */
@media (max-width: 480px) {
    .company-base-container .portal-offers-header .hero-title {
        font-size: 1.75rem;
    }
    
    .company-filters-section {
        padding: 20px 0; /* Custom - Vertical-only spacing (responsive) */
    }
    
    .filter-field input[type="text"],
    .filter-field select {
        font-size: 14px;
        padding: 10px 14px;
    }
    
    .company-card {
        padding: var(--card-padding-md); /* 20px - Shape & Sizing System v5.0 */
    }
}

/* ==========================================
   ❤️ ULUBIONE FIRMY
   ========================================== */

/* Przycisk ulubiona */
.btn-favorite {
    position: absolute;
    top: 15px;
    right: 15px;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btn-favorite:hover {
    transform: scale(1.1);
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(241, 90, 36, 0.2);
}

.btn-favorite.is-favorite {
    background: rgba(241, 90, 36, 0.1);
    border-color: var(--primary-color);
}

.heart-icon {
    font-size: 20px;
    line-height: 1;
    transition: all 0.3s ease;
}

.btn-favorite:hover .heart-icon {
    transform: scale(1.2);
}

.btn-favorite.is-favorite .heart-icon {
    animation: heartBeat 0.6s ease;
}

@keyframes heartBeat {
    0%, 100% {
        transform: scale(1);
    }
    25% {
        transform: scale(1.3);
    }
    50% {
        transform: scale(1.1);
    }
    75% {
        transform: scale(1.25);
    }
}

/* Dark mode dla przycisku ulubionych */
html[data-theme="dark"] .btn-favorite {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

html[data-theme="dark"] .btn-favorite:hover {
    border-color: var(--primary-color);
}

html[data-theme="dark"] .btn-favorite.is-favorite {
    background: rgba(241, 90, 36, 0.2);
    border-color: var(--primary-color);
}

/* ==========================================
   💾 ZAPISYWANIE FILTRÓW
   ========================================== */

/* Sekcja przycisku zapisywania */
.save-filter-section {
    margin: 15px 0;
    padding: var(--input-padding-x); /* 15px */
    background: var(--bg-secondary);
    border-radius: var(--radius-button); /* 8px - Shape & Sizing System v5.0 */
    text-align: center;
    border: 2px dashed var(--primary-color);
}

.save-filter-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: var(--btn-padding-md) /* 12px 24px - Shape & Sizing System v5.0 */;
    border-radius: var(--radius-button); /* 8px - Shape & Sizing System v5.0 */
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(241, 90, 36, 0.2);
}

.save-filter-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(241, 90, 36, 0.3);
}

/* Lista zapisanych filtrów */
.saved-filters-list {
    margin: 20px 0;
    padding: var(--card-padding-md); /* 20px - Shape & Sizing System v5.0 */
    background: var(--bg-secondary);
    border-radius: var(--radius-card); /* 12px - Shape & Sizing System v4.0 */
    border: 1px solid var(--border-color);
}

.saved-filters-list h4 {
    margin: 0 0 15px 0;
    font-size: 16px;
    color: var(--text-primary);
    font-weight: 600;
}

.saved-filters-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.saved-filter-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-button); /* 8px - Shape & Sizing System v5.0 */
    transition: all 0.3s ease;
}

.saved-filter-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.saved-filter-info {
    flex: 1;
    margin-right: 15px;
}

.saved-filter-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    display: block;
}

.saved-filter-meta {
    font-size: 13px;
    color: var(--text-secondary);
}

.saved-filter-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.filter-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-card); /* 12px - Shape & Sizing System v4.0 */
    font-size: 12px;
    color: var(--text-primary);
    font-weight: 500;
}

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

.btn-load-filter,
.btn-edit-filter,
.btn-delete-filter {
    padding: 8px 12px;
    border-radius: var(--radius-md); /* 8px - Shape & Sizing System v5.0 */
    border: none;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-load-filter {
    background: var(--primary-color);
    color: white;
}

.btn-load-filter:hover {
    background: var(--primary-hover);
}

.btn-edit-filter {
    background: #3b82f6;
    color: white;
}

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

.btn-delete-filter {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-delete-filter:hover {
    background: var(--danger-color, #dc3545);
    color: white;
    border-color: var(--danger-color, #dc3545);
}

/* Modal */
.filter-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.filter-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.filter-modal-content {
    position: relative;
    background: var(--bg-primary);
    border-radius: var(--radius-card); /* 12px - Shape & Sizing System v4.0 */
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.filter-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px; /* Custom - Modal header (balanced spacing) */
    border-bottom: 1px solid var(--border-color);
}

.filter-modal-header h3 {
    margin: 0;
    font-size: 20px;
    color: var(--text-primary);
}

.filter-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md); /* 8px - Shape & Sizing System v5.0 */
    transition: all 0.3s ease;
}

.filter-modal-close:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.filter-modal-body {
    padding: var(--card-padding-lg);
}

.filter-modal-body p {
    margin: 0 0 20px 0;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Edytowalne pola w modalu */
.filter-edit-fields {
    margin: 20px 0;
    padding: var(--card-padding-md); /* 20px - Shape & Sizing System v5.0 */
    background: var(--bg-secondary);
    border-radius: var(--radius-button); /* 8px - Shape & Sizing System v5.0 */
    border: 1px solid var(--border-color);
}

.filter-edit-fields h4 {
    margin: 0 0 16px 0;
    font-size: 15px;
    color: var(--text-primary);
    font-weight: 600;
}

.filter-edit-fields input[type="text"],
.filter-edit-fields select {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md); /* 8px - Shape & Sizing System v5.0 */
    font-size: 14px;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.filter-edit-fields input[type="text"]:focus,
.filter-edit-fields select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(241, 90, 36, 0.1);
}

.modal-category-checkboxes {
    display: flex;
    gap: 12px;
}

.modal-category-checkboxes label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 8px 12px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md); /* 8px - Shape & Sizing System v5.0 */
    background: var(--bg-primary);
    transition: all 0.3s ease;
}

.modal-category-checkboxes label:hover {
    border-color: var(--primary-color);
}

.modal-category-checkboxes input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}

.modal-category-checkboxes input[type="checkbox"]:checked + span {
    font-weight: 700;
    color: var(--primary-color);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
}

.filter-name-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-button); /* 8px - Shape & Sizing System v5.0 */
    font-size: 15px;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.filter-name-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(241, 90, 36, 0.1);
}

.input-hint {
    display: block;
    margin-top: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}

.filter-preview {
    margin-top: 20px;
    padding: var(--card-padding-sm);
    background: var(--bg-secondary);
    border-radius: var(--radius-button); /* 8px - Shape & Sizing System v5.0 */
    border: 1px solid var(--border-color);
}

.filter-preview h4 {
    margin: 0 0 12px 0;
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 600;
}

.filter-preview-content {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-tag {
    display: inline-flex;
    align-items: center;
    padding: var(--badge-padding-md); /* 6px 12px */
    background: var(--primary-color);
    color: white;
    border-radius: var(--radius-full); /* pill shape - Shape & Sizing System v5.0 */
    font-size: 13px;
    font-weight: 500;
}

.filter-tag-label {
    opacity: 0.9;
    margin-right: 4px;
}

.filter-tag-value {
    font-weight: 600;
}

.filter-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 24px; /* Custom - Modal footer (balanced spacing) */
    border-top: 1px solid var(--border-color);
}

.btn-cancel,
.btn-confirm {
    padding: var(--btn-padding-md) /* 12px 24px - Shape & Sizing System v5.0 */;
    border-radius: var(--radius-button); /* 8px - Shape & Sizing System v5.0 */
    border: none;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-cancel {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-cancel:hover {
    background: var(--bg-tertiary);
}

.btn-confirm {
    background: var(--primary-color);
    color: white;
}

.btn-confirm:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(241, 90, 36, 0.3);
}

/* Responsive modal */
@media (max-width: 768px) {
    .filter-modal-content {
        width: 95%;
        max-height: 90vh;
    }
    
    .filter-modal-header,
    .filter-modal-body,
    .filter-modal-footer {
        padding: var(--card-padding-sm);
    }
    
    .saved-filter-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .saved-filter-info {
        margin-right: 0;
    }
    
    .saved-filter-actions {
        width: 100%;
        flex-wrap: wrap;
    }
    
    .btn-load-filter,
    .btn-edit-filter,
    .btn-delete-filter {
        flex: 1;
        min-width: 90px;
    }
}

/* ==========================================
   🌙 DARK MODE SUPPORT
   ========================================== */

/* Dark mode gradient dziedziczony z style.css i variables.css */
/* --hero-gradient dla dark mode: linear-gradient(135deg, #2d2d2d 0%, #1a1a1a 100%) */

html[data-theme="dark"] .companies-count {
    background: rgba(255, 255, 255, 0.1);
}

html[data-theme="dark"] .company-logo {
    border-color: var(--border-color);
}

html[data-theme="dark"] .category-badge {
    background: var(--bg-primary);
}

/* Jaśniejsze tło HERO w dark mode */
/* .portal-offers-header dark mode DZIEDZICZONY z variables.css - nie trzeba nadpisywać! */

/* Usunięcie borderów i poprawa tła w dark mode */
html[data-theme="dark"] .company-filters-section,
html[data-theme="dark"] .results-header,
html[data-theme="dark"] .company-card {
    border: none;
    background-color: #2D2D2D;
}

