/* ==========================================
   🔄 PORTAL LOADING STATES
   Globalne style dla stanów ładowania
   
   @version 1.0.0
   @author Portal Transportowy
   @link PORTAL-LOADING-API.md
   
   Eliminuje ~300 linii duplikacji w 8 plikach
   ========================================== */

/* ==========================================
   FULL PAGE LOADER
   ========================================== */

.portal-page-loader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    backdrop-filter: blur(4px);
}

.portal-loader-content {
    text-align: center;
    color: white;
}

.portal-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: var(--radius-full); /* 50% - Shape & Sizing System v4.0 */
    animation: portal-spin 0.8s linear infinite;
    margin: 0 auto 15px;
}

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

.portal-loader-message {
    font-size: 16px;
    font-weight: 500;
    margin: 0;
}

/* ==========================================
   CONTAINER LOADER
   ========================================== */

.portal-container-loader {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    border-radius: inherit;
}

[data-theme="dark"] .portal-container-loader {
    background: rgba(30, 30, 30, 0.95);
}

.portal-container-loader .portal-loader-content {
    color: var(--text-primary);
}

.portal-container-loader .portal-spinner {
    border-color: rgba(0, 0, 0, 0.1);
    border-top-color: var(--primary-color);
}

[data-theme="dark"] .portal-container-loader .portal-spinner {
    border-color: rgba(255, 255, 255, 0.1);
    border-top-color: var(--primary-color);
}

/* ==========================================
   SKELETON LOADERS
   ========================================== */

.skeleton {
    background: linear-gradient(
        90deg,
        var(--skeleton-base, #f0f0f0) 25%,
        var(--skeleton-highlight, #e0e0e0) 50%,
        var(--skeleton-base, #f0f0f0) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--radius-button); /* 8px - Shape & Sizing System v4.0 (deprecated fix) */
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Dark mode skeleton */
[data-theme="dark"] .skeleton {
    --skeleton-base: #2d2d2d;
    --skeleton-highlight: #3a3a3a;
}

/* Skeleton Card */
.skeleton-card {
    padding: var(--card-padding-md); /* 20px - Shape & Sizing System v5.0 */
    margin-bottom: 20px;
    min-height: 200px;
}

.skeleton-header {
    height: 20px;
    width: 60%;
    background: var(--skeleton-highlight);
    border-radius: var(--radius-sm); /* 4px - Shape & Sizing System v4.0 */
    margin-bottom: 15px;
}

.skeleton-text {
    height: 14px;
    width: 100%;
    background: var(--skeleton-highlight);
    border-radius: var(--radius-sm); /* 4px - Shape & Sizing System v4.0 */
    margin-bottom: 10px;
}

.skeleton-text:last-of-type {
    width: 80%;
}

.skeleton-footer {
    height: 16px;
    width: 40%;
    background: var(--skeleton-highlight);
    border-radius: var(--radius-sm); /* 4px - Shape & Sizing System v4.0 */
    margin-top: 20px;
}

/* Skeleton Row */
.skeleton-row {
    padding: var(--input-padding-x); /* 15px */
    margin-bottom: 10px;
    min-height: 60px;
}

.skeleton-row-content {
    height: 16px;
    width: 100%;
    background: var(--skeleton-highlight);
    border-radius: var(--radius-sm); /* 4px - Shape & Sizing System v4.0 */
}

/* Skeleton List */
.skeleton-list {
    padding: 10px;
}

.skeleton-list-item {
    height: 40px;
    background: var(--skeleton-highlight);
    border-radius: var(--radius-sm); /* 4px - Shape & Sizing System v4.0 */
    margin-bottom: 8px;
}

.skeleton-list-item:last-child {
    margin-bottom: 0;
}

/* === ROZSZERZONE TYPY SKELETON (FAZA B) === */

/* Skeleton Table */
.skeleton-table {
    width: 100%;
    border-collapse: collapse;
}

.skeleton-table-row {
    display: flex;
    gap: 10px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-light);
}

.skeleton-table-cell {
    height: 16px;
    background: var(--skeleton-highlight);
    border-radius: var(--radius-sm); /* 4px - Shape & Sizing System v4.0 */
    flex: 1;
}

.skeleton-table-cell.narrow {
    flex: 0.3;
}

.skeleton-table-cell.wide {
    flex: 2;
}

/* Skeleton Profile Card */
.skeleton-profile {
    display: flex;
    gap: 16px;
    padding: var(--card-padding-md); /* 20px - Shape & Sizing System v5.0 */
    background: var(--bg-card);
    border-radius: var(--radius-button); /* 8px - Shape & Sizing System v4.0 (deprecated fix) */
}

.skeleton-avatar {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-full); /* 50% - Shape & Sizing System v4.0 */
    background: var(--skeleton-highlight);
    flex-shrink: 0;
}

.skeleton-avatar.small {
    width: 40px;
    height: 40px;
}

.skeleton-avatar.large {
    width: 120px;
    height: 120px;
}

.skeleton-profile-details {
    flex: 1;
}

.skeleton-profile-name {
    height: 20px;
    width: 60%;
    background: var(--skeleton-highlight);
    border-radius: var(--radius-sm); /* 4px - Shape & Sizing System v4.0 */
    margin-bottom: 10px;
}

.skeleton-profile-bio {
    height: 14px;
    width: 100%;
    background: var(--skeleton-highlight);
    border-radius: var(--radius-sm); /* 4px - Shape & Sizing System v4.0 */
    margin-bottom: 8px;
}

.skeleton-profile-bio:last-child {
    width: 80%;
}

/* Skeleton Image */
.skeleton-image {
    width: 100%;
    padding-bottom: 66.67%; /* 3:2 aspect ratio */
    background: var(--skeleton-highlight);
    border-radius: var(--radius-button); /* 8px - Shape & Sizing System v4.0 (deprecated fix) */
    position: relative;
    overflow: hidden;
}

.skeleton-image.square {
    padding-bottom: 100%; /* 1:1 aspect ratio */
}

.skeleton-image.wide {
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
}

.skeleton-image::before {
    content: '📷';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 48px;
    opacity: 0.3;
}

/* Skeleton Button */
.skeleton-button {
    height: 44px;
    width: 120px;
    background: var(--skeleton-highlight);
    border-radius: var(--radius-button); /* 8px - Shape & Sizing System v4.0 (deprecated fix) */
    display: inline-block;
}

.skeleton-button.small {
    height: 32px;
    width: 80px;
}

.skeleton-button.large {
    height: 52px;
    width: 160px;
}

.skeleton-button.full-width {
    width: 100%;
}

/* Skeleton Form */
.skeleton-form-group {
    margin-bottom: 20px;
}

.skeleton-label {
    height: 14px;
    width: 30%;
    background: var(--skeleton-highlight);
    border-radius: var(--radius-sm); /* 4px - Shape & Sizing System v4.0 */
    margin-bottom: 8px;
}

.skeleton-input {
    height: 44px;
    width: 100%;
    background: var(--skeleton-highlight);
    border-radius: var(--radius-button); /* 8px - Shape & Sizing System v4.0 (deprecated fix) */
}

/* Skeleton Badge/Tag */
.skeleton-badge {
    display: inline-block;
    height: 24px;
    width: 60px;
    background: var(--skeleton-highlight);
    border-radius: var(--radius-card); /* 12px - Shape & Sizing System v4.0 */
    margin-right: 8px;
}

/* Skeleton Grid - dla job offers, company cards etc */
.skeleton-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.skeleton-grid.cols-2 {
    grid-template-columns: repeat(2, 1fr);
}

.skeleton-grid.cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.skeleton-grid.cols-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* Responsive dla skeleton grid */
@media (max-width: 1024px) {
    .skeleton-grid.cols-4 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .skeleton-grid.cols-3,
    .skeleton-grid.cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .skeleton-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ==========================================
   PROGRESS BAR
   ========================================== */

.portal-progress-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 500px;
    background: var(--bg-card);
    border-radius: var(--radius-button); /* 8px - Shape & Sizing System v4.0 (deprecated fix) */
    padding: var(--card-padding-md); /* 20px - Shape & Sizing System v5.0 */
    box-shadow: var(--shadow-lg);
    z-index: 99999;
}

.portal-progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm); /* 4px - Shape & Sizing System v4.0 */
    overflow: hidden;
    margin-bottom: 10px;
}

.portal-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    transition: width 0.3s ease;
    border-radius: var(--radius-sm); /* 4px - Shape & Sizing System v4.0 */
}

.portal-progress-message {
    margin: 0;
    font-size: 14px;
    color: var(--text-secondary);
    text-align: center;
}

/* ==========================================
   RESPONSIVE
   ========================================== */

@media (max-width: 768px) {
    .portal-spinner {
        width: 40px;
        height: 40px;
        border-width: 3px;
    }
    
    .portal-loader-message {
        font-size: 14px;
    }
    
    .portal-progress-container {
        width: 95%;
        padding: var(--input-padding-x); /* 15px */
    }
    
    .skeleton-card {
        padding: var(--input-padding-x); /* 15px */
        min-height: 150px;
    }
}

@media (max-width: 480px) {
    .portal-spinner {
        width: 35px;
        height: 35px;
        border-width: 3px;
    }
    
    .portal-loader-message {
        font-size: 13px;
    }
    
    .skeleton-card {
        padding: 12px;
        margin-bottom: 15px;
    }
}

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

/* Hide while loading */
.loading .hide-while-loading {
    display: none !important;
}

/* Show only while loading */
.show-while-loading {
    display: none !important;
}

.loading .show-while-loading {
    display: block !important;
}


