/* ==========================================
   🎯 COMPONENTS.CSS - WSPÓLNE KOMPONENTY
   ========================================== */

/* Import variables */
@import url('./variables.css');

/* ==========================================
   🎯 PRZYCISKI - WSZYSTKIE WARIANTY
   ========================================== */

/* Bazowy przycisk - używa zmiennych z variables.css v4.0 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--gap-sm); /* 8px */
    padding: var(--btn-padding-md); /* 12px 24px */
    border: none;
    border-radius: var(--radius-button); /* 8px */
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
    min-height: var(--btn-height-md); /* 44px - WCAG compliant */
    line-height: 1.4;
    box-sizing: border-box;
    white-space: nowrap;
}

/* Rozmiary przycisków - używają zmiennych z Shape & Sizing System v4.0 */
.btn-sm {
    padding: var(--btn-padding-sm); /* 8px 16px */
    font-size: 12px;
    min-height: var(--btn-height-sm); /* 36px */
}

.btn-lg {
    padding: var(--btn-padding-lg); /* 16px 32px */
    font-size: 16px;
    min-height: var(--btn-height-lg); /* 52px */
}

.btn-xl {
    padding: var(--btn-padding-xl); /* 20px 40px */
    font-size: 18px;
    min-height: var(--btn-height-xl); /* 60px */
}

/* Warianty kolorystyczne */
.btn-primary {
    background: var(--primary-color);
    color: white;
    border: 1px solid var(--primary-color);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--border-strong);
}

.btn-success {
    background: var(--success-color);
    color: white;
    border: 1px solid var(--success-color);
}

.btn-success:hover {
    background: var(--success-color-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(46, 204, 113, 0.3);
}

.btn-warning {
    background: var(--warning-color);
    color: white;
    border: 1px solid var(--warning-color);
}

.btn-warning:hover {
    background: #e67e22;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(243, 156, 18, 0.3);
}

.btn-danger {
    background: var(--danger-color);
    color: white;
    border: 1px solid var(--danger-color);
}

.btn-danger:hover {
    background: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

.btn-info {
    background: var(--info-color);
    color: white;
    border: 1px solid var(--info-color);
}

.btn-info:hover {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

/* Outline buttons */
.btn-outline-primary {
    background: transparent;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

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

.btn-outline-secondary {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-outline-secondary:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--border-strong);
}

/* Link button */
.btn-link {
    background: transparent;
    color: var(--accent-color);
    border: 1px solid transparent;
    text-decoration: none;
}

.btn-link:hover {
    background: rgba(0, 115, 170, 0.1);
    color: var(--primary-dark);
    text-decoration: underline;
}

/* Disabled state */
.btn:disabled,
.btn.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Full width */
.btn-block {
    width: 100%;
}

/* ==========================================
   📋 KARTY - WSZYSTKIE WARIANTY
   ========================================== */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-card); /* 12px - Shape & Sizing System v4.0 */
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    overflow: hidden;
    /* Padding jest dodawany przez globalne reguły z variables.css */
}

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

.card-header {
    background: var(--bg-secondary);
    padding: var(--card-padding-md) var(--card-padding-lg); /* 20px 30px */
    border-bottom: 1px solid var(--border-color);
}

.card-header h3,
.card-header h4,
.card-header h5 {
    margin: 0;
    color: var(--text-primary);
    font-weight: 600;
}

.card-body {
    padding: var(--card-padding-lg); /* 30px */
}

.card-footer {
    background: var(--bg-secondary);
    padding: var(--input-padding-y) var(--card-padding-lg); /* 10px 30px */
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: var(--gap-sm); /* 8px */
}

/* Card variants */
.card-primary {
    border-color: var(--primary-color);
}

.card-primary .card-header {
    background: var(--primary-color);
    color: white;
}

.card-success {
    border-color: var(--success-color);
}

.card-success .card-header {
    background: var(--success-color);
    color: white;
}

.card-warning {
    border-color: var(--warning-color);
}

.card-warning .card-header {
    background: var(--warning-color);
    color: white;
}

.card-danger {
    border-color: var(--danger-color);
}

.card-danger .card-header {
    background: var(--danger-color);
    color: white;
}

/* ==========================================
   📝 FORMULARZE - KOMPONENTY
   ========================================== */

.form-control {
    width: 100%;
    padding: var(--input-padding); /* 10px 15px - Shape & Sizing System v4.0 */
    border: 1px solid var(--border-color);
    border-radius: var(--radius-input); /* 4px */
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 14px;
    transition: var(--transition);
    min-height: var(--input-height-md); /* 44px - WCAG compliant */
    box-sizing: border-box;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-control:disabled {
    background-color: #f5f5f5;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Form sizes - Shape & Sizing System v4.0 */
.form-control-sm {
    padding: var(--btn-padding-sm); /* 8px 16px */
    font-size: 12px;
    min-height: var(--input-height-sm); /* 36px */
}

.form-control-lg {
    padding: var(--btn-padding-lg); /* 16px 32px */
    font-size: 16px;
    min-height: var(--input-height-lg); /* 52px */
}

/* Input groups */
.input-group {
    display: flex;
    align-items: stretch;
    width: 100%;
}

.input-group .form-control {
    border-radius: 0;
    flex: 1;
}

.input-group .form-control:first-child {
    border-top-left-radius: var(--radius-input); /* 4px - Shape & Sizing System v5.0 */
    border-bottom-left-radius: var(--radius-input);
}

.input-group .form-control:last-child {
    border-top-right-radius: var(--radius-input); /* 4px - Shape & Sizing System v5.0 */
    border-bottom-right-radius: var(--radius-input);
}

.input-group-text {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 14px;
    white-space: nowrap;
}

/* ==========================================
   🏷️ BADGES I STATUSY
   ========================================== */

.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1); /* 4px */
    padding: var(--badge-padding-sm); /* 4px 8px - Shape & Sizing System v4.0 */
    border-radius: var(--radius-badge); /* pill shape */
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1;
}

.badge-primary {
    background: rgba(0, 115, 170, 0.2);
    color: var(--primary-color);
    border: 1px solid rgba(0, 115, 170, 0.3);
}

.badge-success {
    background: rgba(72, 187, 120, 0.2);
    color: var(--success-color);
    border: 1px solid rgba(72, 187, 120, 0.3);
}

.badge-warning {
    background: rgba(243, 156, 18, 0.2);
    color: var(--warning-color);
    border: 1px solid rgba(243, 156, 18, 0.3);
}

.badge-danger {
    background: rgba(231, 76, 60, 0.2);
    color: var(--danger-color);
    border: 1px solid rgba(231, 76, 60, 0.3);
}

.badge-info {
    background: rgba(52, 152, 219, 0.2);
    color: var(--info-color);
    border: 1px solid rgba(52, 152, 219, 0.3);
}

.badge-secondary {
    background: rgba(160, 174, 192, 0.2);
    color: var(--text-muted);
    border: 1px solid rgba(160, 174, 192, 0.3);
}

/* Badge sizes - Shape & Sizing System v4.0 */
.badge-sm {
    padding: var(--badge-padding-xs); /* 2px 6px */
    font-size: 10px;
}

.badge-lg {
    padding: var(--badge-padding-md); /* 6px 12px */
    font-size: 14px;
}

/* ==========================================
   📊 ALERTS I KOMUNIKATY
   ========================================== */

.alert {
    padding: var(--input-padding-y) var(--card-padding-md); /* 10px 20px */
    border-radius: var(--radius-md); /* 8px - Shape & Sizing System v4.0 */
    margin-bottom: var(--card-padding-md); /* 20px */
    font-weight: 500;
    border: 1px solid;
    display: flex;
    align-items: flex-start;
    gap: var(--gap-md); /* 16px */
}

.alert-icon {
    font-size: 18px;
    flex-shrink: 0;
    margin-top: 2px;
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-weight: 600;
    margin-bottom: 5px;
}

.alert-text {
    margin: 0;
    line-height: 1.5;
}

.alert-success {
    background: rgba(72, 187, 120, 0.1);
    color: #155724;
    border-color: rgba(72, 187, 120, 0.3);
}

.alert-warning {
    background: rgba(243, 156, 18, 0.1);
    color: #856404;
    border-color: rgba(243, 156, 18, 0.3);
}

.alert-danger {
    background: rgba(231, 76, 60, 0.1);
    color: #721c24;
    border-color: rgba(231, 76, 60, 0.3);
}

.alert-info {
    background: rgba(52, 152, 219, 0.1);
    color: #004085;
    border-color: rgba(52, 152, 219, 0.3);
}

.alert-primary {
    background: rgba(0, 115, 170, 0.1);
    color: #003d5c;
    border-color: rgba(0, 115, 170, 0.3);
}

/* Dismissible alerts */
.alert-dismissible {
    position: relative;
    padding-right: 50px;
}

.alert-close {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    right: 20px;
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: inherit;
    opacity: 0.7;
    transition: var(--transition);
}

.alert-close:hover {
    opacity: 1;
}

/* ==========================================
   📋 LISTY I GRUPY
   ========================================== */

.list-group {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border-radius: var(--radius-card); /* 12px - Shape & Sizing System v5.0 */
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.list-group-item {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-card);
    color: var(--text-primary);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.list-group-item:last-child {
    border-bottom: none;
}

.list-group-item:hover {
    background: var(--bg-hover);
}

.list-group-item.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.list-group-item-action {
    cursor: pointer;
}

/* ==========================================
   🔄 LOADING STATES
   ========================================== */

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-light);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.spinner-sm {
    width: 16px;
    height: 16px;
}

.spinner-lg {
    width: 32px;
    height: 32px;
    border-width: 3px;
}

/* Loading overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-text {
    margin-left: 10px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ==========================================
   🎯 UTILITY CLASSES
   ========================================== */

/* Display */
.d-none { display: none; }
.d-block { display: block; }
.d-inline { display: inline; }
.d-inline-block { display: inline-block; }
.d-flex { display: flex; }
.d-inline-flex { display: inline-flex; }
.d-grid { display: grid; }

/* Flex utilities */
.flex-row { flex-direction: row; }
.flex-column { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.flex-nowrap { flex-wrap: nowrap; }
.justify-content-start { justify-content: flex-start; }
.justify-content-end { justify-content: flex-end; }
.justify-content-center { justify-content: center; }
.justify-content-between { justify-content: space-between; }
.justify-content-around { justify-content: space-around; }
.align-items-start { align-items: flex-start; }
.align-items-end { align-items: flex-end; }
.align-items-center { align-items: center; }
.align-items-stretch { align-items: stretch; }

/* Text alignment */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-justify { text-align: justify; }

/* Text colors */
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success-color); }
.text-warning { color: var(--warning-color); }
.text-danger { color: var(--danger-color); }
.text-info { color: var(--info-color); }

/* Font weights */
.fw-normal { font-weight: 400; }
.fw-medium { font-weight: 500; }
.fw-semibold { font-weight: 600; }
.fw-bold { font-weight: 700; }

/* Spacing utilities */
.m-0 { margin: 0; }
.m-1 { margin: 0.25rem; }
.m-2 { margin: 0.5rem; }
.m-3 { margin: 1rem; }
.m-4 { margin: 1.5rem; }
.m-5 { margin: 3rem; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mt-5 { margin-top: 3rem; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mb-5 { margin-bottom: 3rem; }

.p-0 { padding: 0; }
.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 1rem; }
.p-4 { padding: 1.5rem; }
.p-5 { padding: 3rem; }

/* Border radius - Shape & Sizing System v5.0 */
.rounded { border-radius: var(--radius-button); } /* 8px */
.rounded-sm { border-radius: var(--radius-input); } /* 4px */
.rounded-lg { border-radius: var(--radius-card); } /* 12px */
.rounded-circle { border-radius: 50%; }

/* Box shadows */
.shadow-none { box-shadow: none; }
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }

/* Position */
.position-relative { position: relative; }
.position-absolute { position: absolute; }
.position-fixed { position: fixed; }
.position-sticky { position: sticky; }

/* Width and height */
.w-25 { width: 25%; }
.w-50 { width: 50%; }
.w-75 { width: 75%; }
.w-100 { width: 100%; }
.h-25 { height: 25%; }
.h-50 { height: 50%; }
.h-75 { height: 75%; }
.h-100 { height: 100%; }

/* ==========================================
   📱 RESPONSIVE UTILITIES
   ========================================== */

@media (max-width: 768px) {
    .d-md-none { display: none; }
    .d-md-block { display: block; }
    .d-md-flex { display: flex; }
    
    .text-md-center { text-align: center; }
    .text-md-left { text-align: left; }
    
    .btn-md-block {
        width: 100%;
        display: block;
    }
    
    .flex-md-column {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .d-sm-none { display: none; }
    .d-sm-block { display: block; }
    .d-sm-flex { display: flex; }
    
    .text-sm-center { text-align: center; }
    .text-sm-left { text-align: left; }
    
    .btn-sm-block {
        width: 100%;
        display: block;
    }
}

/* ==========================================
   🖼️ HERO LOGO - GLOBALNY KOMPONENT
   ========================================== */

/* Logo używane w hero sections - scentralizowane style */
.hero-logo {
    width: 450px;
    height: auto;
    max-height: 60px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
    flex-shrink: 0;
}

/* Backward compatibility - stare szablony */
.header-logo {
    width: 200px;
    height: auto;
    max-height: 60px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
    vertical-align: middle;
}

/* Responsive - małe ekrany */

/* Tablet landscape */
@media (max-width: 1024px) {
    .hero-logo,
    .header-logo {
        width: 180px;
        max-height: 50px;
    }
}

/* Tablet portrait */
@media (max-width: 768px) {
    .hero-logo,
    .header-logo {
        width: 150px;
        max-height: 45px;
    }
}

/* Mobile */
@media (max-width: 480px) {
    .hero-logo,
    .header-logo {
        width: 120px;
        max-height: 35px;
    }
}

/* ==========================================
   🔍 PORTAL AUTOCOMPLETE
   Globalny system wyszukiwania z autocomplete
   Faza B - Dzień 4-5
   ========================================== */

/* Input wrapper styling */
.has-autocomplete {
    position: relative;
}

/* Suggestions container */
.portal-autocomplete-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 var(--radius-button) var(--radius-button); /* 8px - Shape & Sizing System v5.0 */
    box-shadow: var(--shadow-md);
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    margin-top: -1px;
}

/* Suggestion item */
.suggestion-item {
    padding: 12px 16px;
    cursor: pointer;
    transition: background-color 0.15s ease;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover,
.suggestion-item.active {
    background: var(--bg-hover);
}

/* Loading/Empty/Error states */
.suggestion-loading,
.suggestion-empty,
.suggestion-error {
    padding: var(--card-padding-sm);
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
}

.suggestion-error {
    color: var(--danger-color);
}

/* History header */
.suggestions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

/* Clear history button */
.clear-history-btn {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    font-size: 12px;
    padding: var(--badge-padding-sm); /* 4px 8px */
    transition: opacity 0.15s ease;
}

.clear-history-btn:hover {
    opacity: 0.8;
}

/* History item icon */
.suggestion-history::before {
    content: '🕐';
    margin-right: 8px;
    opacity: 0.6;
}

/* Responsive - Mobile */
@media (max-width: 768px) {
    .portal-autocomplete-suggestions {
        max-height: 250px;
    }
    
    .suggestion-item {
        padding: 10px 14px;
        font-size: 14px;
    }
    
    .suggestions-header {
        padding: 8px 14px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .portal-autocomplete-suggestions {
        max-height: 200px;
    }
    
    .suggestion-item {
        padding: 8px 12px;
        font-size: 13px;
    }
}

/* ==========================================
   📂 SIDEBAR - GLOBALNY PATTERN
   Uniwersalny pattern dla wszystkich sidebarów w portalu
   
   UŻYCIE:
   <aside class="portal-sidebar portal-filters-sidebar">...</aside>
   <aside class="portal-sidebar portal-settings-sidebar">...</aside>
   
   UWAGA:
   - .portal-sidebar = base styles + responsive behavior
   - .portal-[type]-sidebar = content-specific styles (np. .portal-filters-sidebar)
   - Responsive zachowanie jest zarządzane globalnie
   - Dla custom szerokości użyj zmiennych CSS (--sidebar-width-sm/md/lg)
   ========================================== */

.portal-sidebar {
    /* Layout & Sizing */
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    
    /* Visual Styling - Shape & Sizing System v5.0 */
    background: var(--bg-card, white);
    padding: var(--sidebar-padding); /* 25px */
    border-radius: var(--radius-card); /* 4px */
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    
    /* Theme Support */
    color: var(--text-primary);
    transition: var(--transition-theme);
}

/* ==========================================
   📱 RESPONSIVE BEHAVIOR
   Breakpoints zgodne z Global Responsive Pattern
   ========================================== */

/* Desktop Large (1200px and below) */
@media (max-width: 1200px) {
    .portal-sidebar {
        padding: 28px;
    }
}

/* Tablet Landscape (1024px and below) - PRZEŁĄCZENIE NA STATIC */
@media (max-width: 1024px) {
    .portal-sidebar {
        /* Layout - zmiana z sticky na static */
        position: static;
        max-height: none;
        margin-bottom: 20px;
        
        /* Padding */
        padding: var(--sidebar-padding); /* 25px */
    }
}

/* Tablet Portrait (768px and below) - PEŁNA SZEROKOŚĆ */
@media (max-width: 768px) {
    .portal-sidebar {
        /* CRITICAL FIX: Zapewnia pełną szerokość w grid 1fr */
        width: 100%;
        max-width: 100%;
        
        /* Padding */
        padding: var(--card-padding-md); /* 20px */
    }
}

/* Mobile (480px and below) */
@media (max-width: 480px) {
    .portal-sidebar {
        /* Padding */
        padding: var(--input-padding-x); /* 15px */
    }
}















