/* Frontend Media Library CSS */

/* FML Override styles dla kompatybilności */
#fml-upload-modal.show {
    display: block !important;
    z-index: 999999 !important;
}

.fml-modal {
    z-index: 999998 !important;
}

.fml-library {
    max-width: 100%;
    margin: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Controls */
.fml-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.fml-search input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    width: 250px;
}

.fml-filters {
    display: flex;
    gap: 10px;
}

.fml-filters select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: white;
}

.fml-user-actions {
    margin-left: auto;
}

.fml-user-actions .button {
    padding: 8px 16px;
    margin-left: 10px;
    background: #0073aa;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    display: inline-block;
}

.fml-user-actions .button:hover {
    background: #005a87;
}

/* Grid Layout */
.fml-grid {
    display: grid;
    gap: 20px;
    margin-bottom: 20px;
}

.fml-grid[data-columns="2"] {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.fml-grid[data-columns="3"] {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}

.fml-grid[data-columns="4"] {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

.fml-grid[data-columns="6"] {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}

/* Grid Items */
.fml-item {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative; /* WAŻNE: dodane dla pozycjonowania ikon typu pliku */
    min-height: 350px; /* Minimalna wysokość kafelka */
    display: flex;
    flex-direction: column;
}

.fml-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.fml-item-content {
    padding: 15px;
    display: flex;
    flex-direction: column;
    flex: 1; /* Zajmuje całą dostępną przestrzeń */
    justify-content: space-between; /* Rozdziela elementy równomiernie */
}

.fml-thumbnail {
    width: 100%;
    height: 150px;
    overflow: hidden;
    border-radius: 4px;
    margin-bottom: 10px;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fml-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.fml-file-icon {
    width: 100%;
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    background: #f8f9fa;
    border-radius: 4px;
    margin-bottom: 10px;
    position: relative;
}

/* Ikona typu pliku w prawym dolnym rogu kafelka głównej biblioteki */
.fml-file-icon::after {
    content: attr(data-file-type-icon);
    position: absolute;
    bottom: -140px; /* Pozycjonowanie względem dna całego kafelka */
    right: -15px;   /* Pozycjonowanie względem prawej krawędzi kafelka */
    font-size: 18px;
    color: #666;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    border: 1px solid rgba(0,0,0,0.1);
    z-index: 10;
    transition: all 0.2s ease;
}

.fml-file-icon::after:hover {
    transform: scale(1.1);
    box-shadow: 0 3px 8px rgba(0,0,0,0.2);
    background: rgba(255, 255, 255, 1);
}

.fml-item-info {
    margin-bottom: 15px;
    min-height: 80px; /* Minimalną wysokość dla sekcji info */
    display: flex;
    flex-direction: column;
}

.fml-item-title {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    line-height: 1.3;
    min-height: 2.6em; /* Zawsze wysokość jak 2 linie tekstu (1.3 * 2) */
    display: flex;
    align-items: flex-start;
    overflow: hidden;
    word-wrap: break-word;
    hyphens: auto;
}

.fml-item-description {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: #666;
    line-height: 1.4;
    flex-grow: 1; /* Rozciąga opis by wypełnić dostępną przestrzeń */
}

.fml-item-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 10px;
}

.fml-category-tag {
    background: #e3f2fd;
    color: #1976d2;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.fml-item-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: auto; /* Przesuwa akcje na dół kafelka */
}

/* WSPÓLNE STYLE DLA PRZYCISKÓW AKCJI */
.fml-item-actions a,
.fml-item-actions button,
.fml-favorite-actions a,
.fml-favorite-actions button {
    padding: 8px 12px;
    background: #f8f9fa;
    color: #333;
    text-decoration: none;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.fml-item-actions a:hover,
.fml-item-actions button:hover,
.fml-favorite-actions a:hover,
.fml-favorite-actions button:hover {
    background: #e9ecef;
    text-decoration: none;
}

.fml-item-actions .fml-remove-favorite,
.fml-favorite-actions .fml-remove-favorite {
    background: #dc3545 !important;
    color: white !important;
    border-color: #dc3545 !important;
}

.fml-item-actions .fml-remove-favorite:hover,
.fml-favorite-actions .fml-remove-favorite:hover {
    background: #c82333 !important;
    border-color: #c82333 !important;
}

.fml-favorite {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    margin-left: auto;
    font-size: 18px;
    color: #ddd;
    transition: color 0.2s ease;
}

.fml-favorite:hover {
    color: #ff6b6b;
}

.fml-favorite.favorited {
    color: #e74c3c;
}

.fml-heart {
    display: inline-block;
    animation: heartbeat 1s ease-in-out;
}

@keyframes heartbeat {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.fml-favorite.favorited .fml-heart {
    animation: heartbeat 0.6s ease-in-out;
}

/* Logo animation when adding to favorites */
.fml-favorite-logo {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    width: 120px;
    height: 120px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    border: 3px solid rgba(255, 255, 255, 0.3);
}

.fml-favorite-logo.show {
    animation: logoPopup 2s ease-out;
}

@keyframes logoPopup {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.3) rotate(-180deg);
    }
    15% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.3) rotate(10deg);
    }
    25% {
        transform: translate(-50%, -50%) scale(1.1) rotate(-5deg);
    }
    35% {
        transform: translate(-50%, -50%) scale(1.2) rotate(0deg);
    }
    50% {
        transform: translate(-50%, -50%) scale(1) rotate(0deg);
    }
    85% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1) rotate(0deg);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5) rotate(0deg) translateY(-80px);
    }
}

/* Real logo image styling */
.fml-logo-image {
    width: 80px;
    height: 80px;
    object-fit: contain;
    filter: drop-shadow(0 3px 6px rgba(0,0,0,0.2));
    animation: logoSpin 2s ease-in-out;
}

@keyframes logoSpin {
    0% { transform: rotate(-180deg) scale(0.5); }
    25% { transform: rotate(0deg) scale(1.1); }
    50% { transform: rotate(5deg) scale(1); }
    75% { transform: rotate(-2deg) scale(1); }
    100% { transform: rotate(0deg) scale(1); }
}

/* Enhanced favorite button - simplified version */
.fml-favorite {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    margin-left: auto;
    font-size: 20px;
    color: #ddd;
    transition: all 0.2s ease;
    border-radius: 50%;
    position: relative;
    overflow: hidden;
}

.fml-favorite:hover {
    color: #ff6b6b;
    transform: scale(1.1);
}

.fml-favorite.favorited {
    color: #e74c3c;
}

.fml-favorite.favorited:hover {
    color: #c0392b;
}

/* Heart animation enhancement - simplified */
.fml-heart {
    display: inline-block;
    font-size: 18px;
    transition: all 0.2s ease;
}

.fml-favorite.favorited .fml-heart {
    animation: heartbeat 0.6s ease-in-out;
}

@keyframes heartbeat {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* Empty State */
.fml-empty {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.fml-empty p {
    font-size: 16px;
    margin: 0;
}

/* Modal - with higher specificity */
div.fml-modal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0,0,0,0.5) !important;
    z-index: 10000 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    opacity: 0 !important;
    visibility: hidden !important;
    transition: all 0.3s ease !important;
    backdrop-filter: blur(3px) !important;
}

div.fml-modal.show {
    opacity: 1 !important;
    visibility: visible !important;
}

.fml-modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    overflow: hidden;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    border: 1px solid #e9ecef;
}

.fml-modal.show .fml-modal-content {
    transform: scale(1);
}

.fml-modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    min-height: 70px;
}

.fml-modal-header-content {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
}

.fml-modal-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    background: white;
    padding: 2px;
    /* Debug styles - usuń po naprawieniu */
    min-width: 40px;
    min-height: 40px;
    flex-shrink: 0;
    transition: border 0.3s ease;
}

.fml-modal-logo.loaded {
    border: none;
}

.fml-modal-logo-placeholder {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    flex-shrink: 0;
}

.fml-modal-header h3 {
    margin: 0;
    font-size: 20px;
    color: #333;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.fml-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.fml-modal-close:hover {
    background: #f8f9fa;
    color: #333;
    transform: scale(1.1);
}

.fml-modal-body {
    padding: 25px;
    max-height: calc(90vh - 140px);
    overflow-y: auto;
}

/* Library Controls */
.fml-library-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
}

.fml-library-search input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    width: 250px;
}

.fml-library-filters select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: white;
}

.fml-notification-settings {
    margin-left: auto;
}

.fml-notification-settings label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #333;
}

/* User Library Files */
.fml-user-library-files {
    display: grid;
    gap: 20px;
}

.fml-user-file {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    transition: box-shadow 0.2s ease;
}

.fml-user-file:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.fml-user-file-info {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.fml-user-file-info img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}

.fml-user-file-info .fml-file-icon {
    width: 80px;
    height: 80px;
    font-size: 32px;
    flex-shrink: 0;
}

.fml-user-file-details {
    flex: 1;
}

.fml-user-file-details h4 {
    margin: 0 0 8px 0;
    font-size: 16px;
    color: #333;
}

.fml-user-file-details p {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: #666;
}

.fml-user-file-actions {
    display: flex;
    gap: 10px;
}

.fml-user-file-actions a,
.fml-user-file-actions button {
    padding: 6px 12px;
    background: #f8f9fa;
    color: #333;
    text-decoration: none;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.fml-user-file-actions a:hover,
.fml-user-file-actions button:hover {
    background: #e9ecef;
    text-decoration: none;
}

.fml-remove-favorite {
    background: #dc3545 !important;
    color: white !important;
    border-color: #dc3545 !important;
}

.fml-remove-favorite:hover {
    background: #c82333 !important;
}

/* Categorization */
.fml-user-file-categorization {
    margin-bottom: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
}

.fml-user-file-categorization label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #333;
}

.fml-categories-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 10px;
}

.fml-categories-selector label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: normal;
    margin-bottom: 0;
    padding: 5px 10px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.fml-categories-selector label:hover {
    background: #e3f2fd;
}

.fml-categories-selector input[type="checkbox"]:checked + label {
    background: #2196f3;
    color: white;
    border-color: #2196f3;
}

.fml-add-category {
    display: flex;
    gap: 10px;
    align-items: center;
}

.fml-add-category input {
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    flex: 1;
}

.fml-add-category-btn {
    padding: 6px 12px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s ease;
}

.fml-add-category-btn:hover {
    background: #218838;
}

/* Importance */
.fml-user-file-importance {
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
}

.fml-user-file-importance label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.fml-importance-selector {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: white;
}

.fml-importance-selector option[value="important"] {
    color: #dc3545;
}

.fml-importance-selector option[value="useful"] {
    color: #28a745;
}

.fml-importance-selector option[value="later"] {
    color: #ffc107;
}

/* Loading */
.fml-loading {
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 16px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .fml-controls {
        flex-direction: column;
        gap: 10px;
    }
    
    .fml-search input {
        width: 100%;
    }
    
    .fml-user-actions {
        margin-left: 0;
    }
    
    .fml-grid {
        grid-template-columns: 1fr;
    }
    
    .fml-grid[data-columns="2"] {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
    
    /* Zmniejsz minimalne wysokości na mobile */
    .fml-item {
        min-height: 300px;
    }
    
    .fml-favorite-item {
        min-height: 350px;
    }
    
    .fml-item-info {
        min-height: 60px;
    }
    
    .fml-favorite-info {
        min-height: 80px;
    }
    
    .fml-user-file-info {
        flex-direction: column;
    }
    
    .fml-user-file-actions {
        flex-wrap: wrap;
    }
    
    .fml-library-controls {
        flex-direction: column;
    }
    
    .fml-library-search input {
        width: 100%;
    }
    
    .fml-modal-content {
        width: 95%;
        margin: 20px;
    }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.fml-item {
    animation: fadeIn 0.3s ease;
}

.fml-user-file {
    animation: fadeIn 0.4s ease;
}

/* Style dla różnych typów plików */
.fml-item[data-type="file"],
.fml-favorite-item[data-type="file"] {
    /* Style dla plików */
}

.fml-item[data-type="link"],


/* Hidden elements */
.fml-item[style*="display: none"] {
    display: none !important;
}

/* Favorites page styles */
.fml-favorites-library {
    max-width: 100%;
    margin: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.fml-login-required,
.fml-empty-favorites {
    text-align: center;
    padding: 60px 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    color: #666;
    font-size: 16px;
}

.fml-favorites-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.fml-favorites-actions {
    margin-left: auto;
    display: flex;
    gap: 10px;
}

.fml-favorites-stats {
    margin-bottom: 20px;
    padding: 10px 15px;
    background: #e3f2fd;
    border-radius: 6px;
    border-left: 4px solid #2196f3;
}

.fml-total-favorites {
    font-weight: 600;
    color: #1976d2;
}

.fml-favorites-grid {
    display: grid;
    gap: 25px;
    margin-bottom: 20px;
}

.fml-favorites-grid[data-columns="2"] {
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
}

.fml-favorites-grid[data-columns="3"] {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}

.fml-favorites-grid[data-columns="4"] {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.fml-favorite-item {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative; /* WAŻNE: dodane dla pozycjonowania logo */
    min-height: 400px; /* Minimalna wysokość kafelka ulubionych */
    display: flex;
    flex-direction: column;
}

.fml-favorite-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.fml-favorite-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex: 1; /* Zajmuje całą dostępną przestrzeń */
    justify-content: space-between; /* Rozdziela elementy równomiernie */
}

.fml-favorite-info {
    margin-bottom: 15px;
    min-height: 120px; /* Minimalną wysokość dla sekcji info na stronie ulubionych */
    display: flex;
    flex-direction: column;
}

/* NOWE STYLE DLA TYTUŁU BEZ LOGO */
.fml-favorite-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e9ecef;
}

.fml-favorite-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    line-height: 1.3;
    flex: 1;
    min-height: 2.6em; /* Zawsze wysokość jak 2 linie tekstu (1.3 * 2) */
    display: flex;
    align-items: flex-start;
    overflow: hidden;
    word-wrap: break-word;
    hyphens: auto;
}

/* LOGO FIRMY WRACA DO NAGŁÓWKA */
.fml-file-logo {
    width: 20px;
    height: 20px;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    background: white;
    padding: 1px;
    flex-shrink: 0;
    margin-left: auto;
}

.fml-file-logo-placeholder {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    border-radius: 4px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    flex-shrink: 0;
    margin-left: auto;
}

/* IKONY TYPU PLIKU W PRAWYM DOLNYM ROGU */
.fml-file-type-icon {
    position: absolute;
    bottom: 15px;
    right: 15px;
    font-size: 20px;
    color: #666;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    border: 1px solid rgba(0,0,0,0.1);
    z-index: 10;
    transition: all 0.2s ease;
}

.fml-file-type-icon:hover {
    transform: scale(1.1);
    box-shadow: 0 3px 8px rgba(0,0,0,0.2);
    background: rgba(255, 255, 255, 1);
}

.fml-file-type-icon {
    font-size: 16px;
    color: #666;
    flex-shrink: 0;
}

.fml-favorite-description {
    margin: 0 0 15px 0;
    font-size: 14px;
    color: #666;
    line-height: 1.4;
    flex-grow: 1; /* Rozciąga opis by wypełnić dostępną przestrzeń */
}

.fml-admin-categories {
    margin-bottom: 15px;
}

.fml-admin-categories strong {
    display: block;
    margin-bottom: 5px;
    font-size: 13px;
    color: #333;
}

.fml-admin-category-tag {
    background: #e3f2fd;
    color: #1976d2;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    margin-right: 5px;
    display: inline-block;
}

.fml-user-categorization {
    margin-bottom: 15px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.fml-user-categorization label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 13px;
    color: #333;
}

.fml-categories-display {
    margin-bottom: 8px;
    min-height: 24px;
}

.fml-user-category-tag {
    background: #d1ecf1;
    color: #0c5460;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    margin-right: 5px;
    display: inline-block;
}

.fml-no-categories {
    color: #999;
    font-style: italic;
    font-size: 12px;
}

.fml-edit-categories {
    background: none;
    border: 1px solid #ddd;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 11px;
    cursor: pointer;
    color: #666;
}

.fml-edit-categories:hover {
    background: #f0f0f0;
    border-color: #0073aa;
    color: #0073aa;
}

.fml-importance-display {
    margin-bottom: 15px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.fml-importance-display label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 13px;
    color: #333;
}

.fml-importance-select {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 13px;
    background: white;
}

.fml-importance-select option[value="important"] {
    color: #dc3545;
}

.fml-importance-select option[value="useful"] {
    color: #28a745;
}

.fml-importance-select option[value="later"] {
    color: #ffc107;
}

.fml-favorite-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: auto; /* Przesuwa akcje na dół kafelka */
    padding-right: 45px; /* Dodaje miejsce na ikonę typu pliku w prawym dolnym rogu */
}

.fml-favorite-actions a,
.fml-favorite-actions button {
    padding: 8px 12px;
    background: #f8f9fa;
    color: #333;
    text-decoration: none;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.fml-favorite-actions a:hover,
.fml-favorite-actions button:hover {
    background: #e9ecef;
    text-decoration: none;
}

.fml-remove-favorite {
    background: #dc3545 !important;
    color: white !important;
    border-color: #dc3545 !important;
}

.fml-remove-favorite:hover {
    background: #c82333 !important;
    border-color: #c82333 !important;
}

/* Category management modal */
#fml-category-modal .fml-modal-body {
    max-height: 500px;
}

.fml-current-categories h4,
.fml-add-category-form h4 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 16px;
}

.fml-category-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    margin-bottom: 5px;
}

.fml-delete-category {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fml-add-category-form {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
}

.fml-add-category-form input {
    width: 70%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-right: 10px;
}

/* NOWE STYLE DLA MODALA WYBORU KATEGORII */

/* Modal wyboru kategorii przy dodawaniu do ulubionych */
#fml-category-selection-modal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0,0,0,0.6) !important;
    z-index: 10001 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(3px);
}

#fml-category-selection-modal.show {
    opacity: 1 !important;
}

#fml-category-selection-modal .fml-modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow: hidden;
    transform: scale(0.95);
    transition: transform 0.3s ease;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    border: 1px solid #e9ecef;
}

#fml-category-selection-modal.show .fml-modal-content {
    transform: scale(1);
}

/* File info section */
.fml-file-info {
    margin-bottom: 20px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #2196f3;
}

.fml-file-info p {
    margin: 0;
    color: #333;
    font-size: 14px;
}

/* Category selection section */
.fml-category-selection-section {
    margin-bottom: 25px;
}

.fml-category-selection-section h4 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 16px;
    font-weight: 600;
}

.fml-category-selection {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    max-height: 200px;
    overflow-y: auto;
    padding: 10px;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    background: #fafafa;
}

.fml-category-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    font-size: 14px;
}

.fml-category-option:hover {
    background: #e3f2fd;
    border-color: #2196f3;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(33, 150, 243, 0.1);
}

.fml-category-option input[type="checkbox"] {
    margin: 0;
    transform: scale(1.1);
    accent-color: #2196f3;
}

.fml-category-option input[type="checkbox"]:checked + .fml-category-name {
    font-weight: 600;
    color: #1976d2;
}

.fml-category-name {
    flex: 1;
    color: #333;
    line-height: 1.4;
}

/* Modal actions */
.fml-modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
}

/* Primary button first (with categories) */
.fml-button-primary {
    padding: 10px 20px;
    background: #2196f3;
    color: white;
    border: 1px solid #2196f3;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    order: 1; /* First button */
}

.fml-button-primary:hover {
    background: #1976d2;
    border-color: #1976d2;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.3);
    text-decoration: none;
    color: white;
}

/* Secondary button second (without categories) */
.fml-button-secondary {
    padding: 10px 20px;
    background: #f8f9fa;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    order: 2; /* Second button */
}

.fml-button-secondary:hover {
    background: #e9ecef;
    border-color: #adb5bd;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    text-decoration: none;
    color: #333;
}

.fml-button-primary:focus,
.fml-button-secondary:focus {
    outline: 2px solid #2196f3;
    outline-offset: 2px;
}

/* Loading state dla przycisku favorite */
.fml-favorite.loading .fml-heart {
    animation: spin 1s linear infinite;
}

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

/* Responsive design dla modala kategorii */
@media (max-width: 768px) {
    .fml-favorites-controls {
        flex-direction: column;
        gap: 10px;
    }
    
    .fml-favorites-actions {
        margin-left: 0;
    }
    
    .fml-favorites-grid {
        grid-template-columns: 1fr;
    }
    
    .fml-item-actions {
        padding-right: 40px; /* Miejsce na ikonę typu pliku na mobile */
    }
    
    /* Responsive dla ikon typu pliku w głównych kafelkach */
    .fml-item .fml-file-type-indicator {
        bottom: 10px;
        right: 10px;
        width: 26px;
        height: 26px;
        font-size: 14px;
    }
    
    .fml-favorite-actions {
        flex-direction: column;
        padding-right: 40px; /* Zachowaj miejsce na ikonę typu pliku także na mobile */
    }
    
    /* Ikona typu pliku responsive adjustments */
    .fml-file-type-icon {
        bottom: 10px;
        right: 10px;
        width: 28px;
        height: 28px;
        font-size: 16px;
    }
    
    /* Modal responsive adjustments */
    .fml-modal-content {
        width: 95%;
        margin: 10px;
        max-height: 95vh;
    }
    
    .fml-modal-header {
        padding: 15px 20px;
        min-height: 60px;
    }
    
    .fml-modal-logo {
        width: 32px;
        height: 32px;
    }
    
    .fml-modal-header h3 {
        font-size: 18px;
    }
    
    .fml-modal-header-content {
        gap: 10px;
    }
    
    .fml-modal-body {
        padding: 20px;
        max-height: calc(95vh - 120px);
    }
    
    #fml-category-selection-modal .fml-modal-content {
        width: 95%;
        margin: 20px;
        max-height: 85vh;
    }
    
    .fml-category-selection {
        grid-template-columns: 1fr;
        max-height: 150px;
    }
    
    .fml-modal-actions {
        flex-direction: column;
        gap: 8px;
    }
    
    .fml-button-primary,
    .fml-button-secondary {
        width: 100%;
        text-align: center;
        order: unset; /* Reset order on mobile for natural flow */
    }
    
    /* On mobile, primary button first in document order */
    .fml-button-primary {
        order: 1;
    }
    
    .fml-button-secondary {
        order: 2;
    }
}

/* Accessibility improvements */
.fml-category-option:focus-within {
    outline-offset: 2px;
}

/* Scrollbar styling dla listy kategorii */
.fml-category-selection::-webkit-scrollbar {
    width: 6px;
}

.fml-category-selection::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.fml-category-selection::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.fml-category-selection::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Animation dla pojawiania się checkboxów */
.fml-category-option {
    animation: slideInCategory 0.3s ease;
}

@keyframes slideInCategory {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Dodatkowe style dla lepszego UX */
.fml-category-selection-section {
    position: relative;
}

.fml-category-selection-section::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #2196f3, #21cbf3);
    border-radius: 1px;
}

/* Style dla disabled state */
.fml-favorite:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.fml-favorite:disabled:hover {
    transform: none;
    color: inherit;
}

/* Error and debug styles */
.fml-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    padding: 15px;
    margin: 20px 0;
}

.fml-debug {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
    border-radius: 4px;
    padding: 15px;
    margin: 20px 0;
    font-family: monospace;
    font-size: 13px;
}

/* Focus states */
input:focus,
select:focus,
button:focus {
    outline-offset: 2px;
}

/* Scrollbar styling */
.fml-modal-body::-webkit-scrollbar {
    width: 8px;
}

.fml-modal-body::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.fml-modal-body::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.fml-modal-body::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Inline category editor styles */
.fml-inline-category-editor {
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 10px;
    margin: 5px 0;
}

.fml-inline-category-editor label {
    display: block;
    margin-bottom: 5px;
    font-size: 13px;
}

.fml-editor-actions {
    margin-top: 10px;
}

.fml-editor-actions button {
    margin-right: 5px;
    padding: 4px 8px;
    font-size: 12px;
    border: 1px solid #ddd;
    border-radius: 3px;
    cursor: pointer;
}

.fml-save-categories {
    background: #28a745;
    color: white;
    border-color: #28a745;
}

.fml-cancel-edit {
    background: #6c757d;
    color: white;
    border-color: #6c757d;
}

/* Notifications */
.fml-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 4px;
    color: white;
    font-weight: 500;
    z-index: 10001;
    animation: slideIn 0.3s ease;
}

.fml-notification-success {
    background: #28a745;
}

.fml-notification-error {
    background: #dc3545;
}

.fml-notification-info {
    background: #17a2b8;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

body.fml-modal-open {
    overflow: hidden;
}

.fml-results-counter {
    margin-bottom: 15px;
    font-size: 14px;
    color: #666;
    text-align: center;
}

.fml-library-count {
    margin-left: 10px;
    font-size: 14px;
    color: #666;
    font-weight: normal;
}

/* UPROSZCZONE KAFELKI GŁÓWNEJ BIBLIOTEKI - NOWY DESIGN */

/* Reset i nowa struktura kafelka głównej biblioteki */
.fml-item {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    overflow: visible;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    min-height: 320px; /* Jeszcze więcej wysokości */
    display: flex;
    flex-direction: column;
    padding: 20px 20px 35px 20px; /* Znacznie więcej paddingu na dole */
}

.fml-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* NAGŁÓWEK Z TYTUŁEM I IKONĄ */
.fml-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e9ecef; /* Separator */
}

.fml-item-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    line-height: 1.3;
    flex: 1;
    padding-right: 10px;
    /* OGRANICZENIE DO 2 LINII Z WIELOKROPKIEM */
    height: 2.6em; /* Dokładnie 2 linie (1.3 * 2) */
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    word-wrap: break-word;
    hyphens: auto;
}

.fml-header-logo {
    width: 20px;
    height: 20px;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    background: white;
    padding: 1px;
    flex-shrink: 0;
}

.fml-header-logo-placeholder {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    border-radius: 4px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    flex-shrink: 0;
}

/* ŚRODKOWA SEKCJA Z DUŻĄ IKONĄ PLIKU */
.fml-item-file-display {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 20px 0;
    min-height: 120px;
}

.fml-large-file-icon {
    font-size: 64px;
    color: #666;
    transition: all 0.2s ease;
}

.fml-item:hover .fml-large-file-icon {
    transform: scale(1.1);
    color: #333;
}

/* PRZYCISKI AKCJI NA DOLE - POZYCJONOWANIE ABSOLUTNE */
.fml-item-actions {
    position: absolute;
    bottom: 20px; /* Pozycja od dna kafelka */
    left: 20px;
    right: 70px; /* Miejsce na serduszko */
    display: flex;
    gap: 10px;
    height: 40px; /* Stała wysokość dla przycisków */
}

.fml-item-actions a,
.fml-item-actions button {
    padding: 8px 16px;
    background: #f8f9fa;
    color: #333;
    text-decoration: none;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex: 1;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%; /* Wypełnij całą wysokość kontenera */
    box-sizing: border-box;
}

.fml-item-actions a:hover,
.fml-item-actions button:hover {
    background: #e9ecef;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* SERDUSZKO W PRAWYM DOLNYM ROGU - WYRÓWNANE Z PRZYCISKAMI */
.fml-favorite {
    position: absolute;
    bottom: 20px; /* Ta sama pozycja co przyciski */
    right: 15px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    font-size: 24px;
    color: #ddd;
    transition: all 0.2s ease;
    border-radius: 50%;
    width: 40px;
    height: 40px; /* Taka sama wysokość jak przyciski */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.fml-favorite:hover {
    color: #ff6b6b;
    transform: scale(1.1);
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.fml-favorite.favorited {
    color: #e74c3c;
}

.fml-favorite.favorited:hover {
    color: #c0392b;
}

.fml-heart {
    display: inline-block;
    font-size: 20px;
    transition: all 0.2s ease;
}

.fml-favorite.favorited .fml-heart {
    animation: heartbeat 0.6s ease-in-out;
}

@keyframes heartbeat {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* USUŃ STARE ELEMENTY KTÓRE JUŻ NIE SĄ POTRZEBNE */
.fml-thumbnail,
.fml-file-icon,
.fml-item-info,
.fml-item-description,
.fml-item-categories,
.fml-category-tag,
.fml-file-type-indicator {
    display: none !important;
}

/* RESPONSIVE DESIGN */
@media (max-width: 768px) {
    /* Na mobile pozostaw 2 kolumny, ale zmniejsz kafelki */
    .fml-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .fml-item {
        min-height: 280px; /* Zwiększona wysokość na mobile */
        padding: 15px 15px 30px 15px; /* Więcej paddingu na mobile */
    }
    
    .fml-item-file-display {
        min-height: 80px;
        margin: 15px 0;
    }
    
    .fml-large-file-icon {
        font-size: 48px;
    }
    
    .fml-item-actions {
        position: absolute;
        bottom: 15px; /* Pozycja od dna na mobile */
        left: 15px;
        right: 60px; /* Miejsce na serduszko na mobile */
        height: 35px; /* Zmniejszona wysokość na mobile */
    }
    
    .fml-item-actions a,
    .fml-item-actions button {
        padding: 6px 12px;
        font-size: 12px;
        height: 100%;
    }
    
    .fml-favorite {
        width: 35px;
        height: 35px; /* Dopasowane do wysokości przycisków na mobile */
        font-size: 18px;
        bottom: 15px; /* Ta sama pozycja co przyciski na mobile */
        right: 10px;
    }
    
    .fml-heart {
        font-size: 16px;
    }
    
    .fml-item-title {
        font-size: 14px;
        height: 2.4em; /* Nieco mniejsza wysokość na mobile */
    }
}

@media (max-width: 480px) {
    /* Na bardzo małych ekranach przejdź na 1 kolumnę */
    .fml-grid {
        grid-template-columns: 1fr;
    }
}

/* GRID ADJUSTMENTS - ZAWSZE 2 KAFELKI W RZĘDZIE */
.fml-grid[data-columns="2"],
.fml-grid[data-columns="3"],
.fml-grid[data-columns="4"],
.fml-grid[data-columns="6"],
.fml-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

/* LOADING STATE */
.fml-favorite.loading .fml-heart {
    animation: spin 1s linear infinite;
}

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

/* FOCUS STATES */
.fml-favorite:focus {
    outline-offset: 2px;
}

.fml-item-actions a:focus,
.fml-item-actions button:focus {
    outline-offset: 2px;
}

/* === Poprawki dla przycisków akcji i kontenera `.fml-item` === */

/* 1. Kontener `.fml-item` - widoczność overflow i dolny padding */
.fml-item {
    overflow: visible !important;
    padding-bottom: 60px !important;
}

/* 2. Kontener przycisków akcji - desktop */
.fml-item-actions {
    position: absolute;
    bottom: 20px;
    left: 20px;
    right: 70px;
    display: flex;
    gap: 10px;
    /* usunięto margin-top i sztywną wysokość */
}

/* 3. Kontener przycisków akcji - tablet/mobile */
@media (max-width: 768px) {
    .fml-item-actions {
        bottom: 15px !important;
        left: 15px !important;
        right: 60px !important;
    }
}

/* 4. Skonsolidowane style przycisków `.fml-item-actions a, button` i `.fml-favorite-actions a, button` */
.fml-item-actions a,
.fml-item-actions button,
.fml-favorite-actions a,
.fml-favorite-actions button {
    padding: 8px 12px;
    background: #f8f9fa;
    color: #333;
    text-decoration: none;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease, box-shadow 0.1s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* 5. Efekty hover */
.fml-item-actions a:hover,
.fml-item-actions button:hover,
.fml-favorite-actions a:hover,
.fml-favorite-actions button:hover {
    background: #e9ecef;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transform: translateY(-1px);
}

/* 6. Stan focus */
.fml-item-actions a:focus,
.fml-item-actions button:focus,
.fml-favorite-actions a:focus,
.fml-favorite-actions button:focus {
    outline-offset: 2px;
}

/* 1. Usuń cienie z przycisków w stanie normalnym */
.fml-item-actions a,
.fml-item-actions button,
.fml-favorite-actions a,
.fml-favorite-actions button {
  box-shadow: none !important;      /* wyłączamy wszystkie cienie */
  border: 1px solid #ddd !important;/* pojedyncza, cienka linia */
  background-clip: border-box;       /* aby obramowanie było widoczne w całości */
}

/* 2. Przywróć dolny brzeg, jeśli gdzieś zniknął */
.fml-item-actions a,
.fml-item-actions button {
  border-bottom-width: 1px !important;
}

/* 3. Na hover zostaw delikatne podniesienie, ale bez cienia pod spodem */
.fml-item-actions a:hover,
.fml-item-actions button:hover,
.fml-favorite-actions a:hover,
.fml-favorite-actions button:hover {
  transform: translateY(-1px) !important;
  /* box-shadow tu możesz zostawić lub usunąć, np.: */
  box-shadow: 0 1px 2px rgba(0,0,0,0.1) !important;
}


/* FML Uploads CSS - Dodatek do głównego pliku CSS */

/* === MODAL UPLOADÓW === */

.fml-upload-modal-content {
    max-width: 700px;
    width: 95%;
}

/* Upload Tabs */
.fml-upload-tabs {
    display: flex;
    margin-bottom: 25px;
    border-bottom: 1px solid #e9ecef;
    gap: 0;
}

.fml-upload-tabs .fml-tab {
    background: none;
    border: none;
    padding: 12px 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    border-bottom: 3px solid transparent;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex: 1;
    text-align: center;
}

.fml-upload-tabs .fml-tab:hover {
    color: #333;
    background: #f8f9fa;
}

.fml-upload-tabs .fml-tab.fml-tab-active {
    color: #2196f3;
    border-bottom-color: #2196f3;
    background: white;
}

/* Tab Content */
.fml-tab-content {
    display: none;
}

.fml-tab-content.fml-tab-active {
    display: block;
    animation: fadeInTab 0.3s ease;
}

@keyframes fadeInTab {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* === FORMULARZE === */

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

.fml-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.fml-form-group input[type="text"],
.fml-form-group input[type="url"],
.fml-form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.fml-form-group input:focus,
.fml-form-group textarea:focus {
    outline: none;
    border-color: #2196f3;
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

.fml-form-group textarea {
    resize: vertical;
    min-height: 80px;
}

/* === FILE INPUT === */

.fml-file-input-wrapper {
    position: relative;
}

#fml-upload-file {
    width: 100%;
    padding: 12px;
    border: 2px dashed #ddd;
    border-radius: 8px;
    background: #fafafa;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
}

#fml-upload-file:hover {
    border-color: #2196f3;
    background: #f0f8ff;
}

#fml-upload-file:focus {
    outline: none;
    border-color: #2196f3;
    background: #f0f8ff;
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

/* File Info Display */
.fml-file-info {
    display: none;
    margin-top: 15px;
    padding: 15px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.fml-file-preview {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: 6px;
    border: 1px solid #ddd;
    flex-shrink: 0;
}

.fml-file-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

.fml-file-icon {
    font-size: 24px;
}

.fml-file-details {
    flex: 1;
}

.fml-file-name {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
    word-break: break-word;
}

.fml-file-size {
    display: block;
    font-size: 13px;
    color: #666;
}

.fml-file-requirements {
    margin-top: 8px;
}

.fml-file-requirements small {
    display: block;
    color: #666;
    font-size: 12px;
    margin-bottom: 2px;
}

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

.fml-upload-progress {
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.fml-progress-bar {
    width: 100%;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.fml-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #2196f3, #21cbf3);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 4px;
}

.fml-progress-text {
    font-size: 13px;
    font-weight: 600;
    color: #333;
}

/* === PRZYCISKI === */

.fml-form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
}

.fml-btn {
    padding: 10px 20px;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 120px;
}

.fml-btn:focus {
    outline-offset: 2px;
}

.fml-btn-primary {
    background: #2196f3;
    color: white;
    border-color: #2196f3;
}

.fml-btn-primary:hover:not(:disabled) {
    background: #1976d2;
    border-color: #1976d2;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.3);
}

.fml-btn-secondary {
    background: #f8f9fa;
    color: #333;
    border-color: #ddd;
}

.fml-btn-secondary:hover:not(:disabled) {
    background: #e9ecef;
    border-color: #adb5bd;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.fml-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.fml-btn-small {
    padding: 6px 12px;
    font-size: 12px;
    min-width: auto;
}

/* === URL PREVIEW === */

.fml-url-preview {
    margin-top: 10px;
    padding: 12px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
}

.fml-url-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.fml-url-title {
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.fml-url-domain {
    font-size: 13px;
    color: #666;
}

/* === MOJE PRZESŁANIA === */

.fml-my-uploads-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e9ecef;
}

.fml-my-uploads-header h4 {
    margin: 0;
    color: #333;
    font-size: 18px;
}

.fml-refresh-uploads {
    background: #f8f9fa;
    color: #333;
    border: 1px solid #ddd;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
}

.fml-refresh-uploads:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

/* Lista przesłań */
.fml-user-uploads-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.fml-no-uploads {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.fml-upload-item {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    transition: box-shadow 0.2s ease, transform 0.1s ease;
}

.fml-upload-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transform: translateY(-1px);
}

/* Status styling */
.fml-upload-pending {
    border-left: 4px solid #ffc107;
}

.fml-upload-approved {
    border-left: 4px solid #28a745;
}

.fml-upload-rejected {
    border-left: 4px solid #dc3545;
}

.fml-upload-header {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    margin-bottom: 15px;
}

.fml-upload-type {
    font-size: 24px;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.fml-upload-info {
    flex: 1;
    min-width: 0;
}

.fml-upload-title {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    line-height: 1.3;
    word-wrap: break-word;
}

.fml-upload-meta {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.fml-upload-date {
    font-size: 13px;
    color: #666;
}

.fml-upload-status {
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.fml-status-pending {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.fml-status-approved {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.fml-status-rejected {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.fml-upload-description {
    margin-bottom: 15px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 6px;
    color: #666;
    font-size: 14px;
    line-height: 1.4;
    border: 1px solid #e9ecef;
}

.fml-upload-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.fml-upload-view,
.fml-upload-download,
.fml-delete-upload {
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-decoration: none;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #f8f9fa;
    color: #333;
}

.fml-upload-view:hover,
.fml-upload-download:hover {
    background: #e9ecef;
    border-color: #adb5bd;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.fml-delete-upload {
    background: #dc3545;
    color: white;
    border-color: #dc3545;
}

.fml-delete-upload:hover:not(:disabled) {
    background: #c82333;
    border-color: #c82333;
    transform: translateY(-1px);
    box-shadow: 0 1px 3px rgba(220, 53, 69, 0.3);
}

.fml-delete-upload:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* === LOADING & ERROR STATES === */

.fml-loading {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-size: 16px;
}

.fml-loading::before {
    content: '⏳';
    margin-right: 8px;
    animation: spin 2s linear infinite;
}

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

.fml-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 6px;
    padding: 15px;
    margin: 20px 0;
    text-align: center;
}

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

@media (max-width: 768px) {
    .fml-upload-modal-content {
        width: 95%;
        margin: 10px;
        max-height: 95vh;
    }
    
    .fml-upload-tabs {
        flex-direction: column;
        gap: 0;
    }
    
    .fml-upload-tabs .fml-tab {
        border-bottom: 1px solid #e9ecef;
        border-right: none;
        text-align: left;
        padding: 15px 20px;
    }
    
    .fml-upload-tabs .fml-tab.fml-tab-active {
        border-bottom-color: #e9ecef;
        border-left: 3px solid #2196f3;
        background: #f0f8ff;
    }
    
    .fml-form-actions {
        flex-direction: column;
    }
    
    .fml-btn {
        width: 100%;
        justify-content: center;
    }
    
    .fml-file-info {
        flex-direction: column;
        text-align: center;
    }
    
    .fml-file-preview {
        align-self: center;
    }
    
    .fml-upload-header {
        flex-direction: column;
        text-align: center;
    }
    
    .fml-upload-meta {
        justify-content: center;
    }
    
    .fml-upload-actions {
        justify-content: center;
    }
    
    .fml-my-uploads-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .fml-my-uploads-header h4 {
        text-align: center;
    }
}

@media (max-width: 480px) {
    .fml-modal-header {
        padding: 15px 20px;
    }
    
    .fml-modal-body {
        padding: 20px;
    }
    
    .fml-upload-tabs .fml-tab {
        padding: 12px 15px;
        font-size: 13px;
    }
    
    .fml-form-group {
        margin-bottom: 15px;
    }
    
    .fml-upload-item {
        padding: 15px;
    }
    
    .fml-upload-actions {
        flex-direction: column;
    }
    
    .fml-upload-view,
    .fml-upload-download,
    .fml-delete-upload {
        width: 100%;
        text-align: center;
    }
}

/* === ACCESSIBILITY === */

.fml-tab:focus,
.fml-btn:focus,
input:focus,
textarea:focus {
    outline-offset: 2px;
}

/* Wysoky kontrast dla statusów */
@media (prefers-contrast: high) {
    .fml-status-pending {
        background: #ffeb3b;
        color: #000;
        border-color: #f57f17;
    }
    
    .fml-status-approved {
        background: #4caf50;
        color: #fff;
        border-color: #2e7d32;
    }
    
    .fml-status-rejected {
        background: #f44336;
        color: #fff;
        border-color: #c62828;
    }
}

/* Animacje dla lepszego UX */
.fml-upload-item {
    animation: slideInUpload 0.3s ease;
}

@keyframes slideInUpload {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Hover effects enhancement */
.fml-upload-item:hover .fml-upload-type {
    transform: scale(1.05);
    background: #e3f2fd;
    border-color: #2196f3;
}

/* Focus indicators improvement */
.fml-upload-view:focus,
.fml-upload-download:focus {
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.2);
}

.fml-delete-upload:focus {
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.2);
}

<style>
/* === POPRAWKA GŁÓWNEJ STRUKTURY KAFELKÓW === */
.fml-item {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    overflow: visible;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    min-height: 280px;
    display: flex;
    flex-direction: column;
    padding: 20px;
}

.fml-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* NAGŁÓWEK Z TYTUŁEM I LOGO */
.fml-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e9ecef;
}

.fml-item-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    line-height: 1.3;
    flex: 1;
    padding-right: 10px;
    max-height: 2.6em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.fml-header-logo {
    width: 20px;
    height: 20px;
    object-fit: contain;
    border-radius: 4px;
    flex-shrink: 0;
}

/* CENTRALNA IKONA PLIKU */
.fml-item-file-display {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 20px 0;
    min-height: 100px;
}

.fml-large-file-icon {
    font-size: 64px;
    color: #666;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Ikony dla różnych typów plików */
.fml-item[data-file-type="pdf"] .fml-large-file-icon::before,
.fml-item[data-file-type="document"] .fml-large-file-icon::before {
    content: "📄";
}

.fml-item[data-file-type="image"] .fml-large-file-icon::before,
.fml-item[data-file-type="jpg"] .fml-large-file-icon::before,
.fml-item[data-file-type="jpeg"] .fml-large-file-icon::before,
.fml-item[data-file-type="png"] .fml-large-file-icon::before,
.fml-item[data-file-type="gif"] .fml-large-file-icon::before {
    content: "🖼️";
}

.fml-item[data-file-type="video"] .fml-large-file-icon::before,
.fml-item[data-file-type="mp4"] .fml-large-file-icon::before,
.fml-item[data-file-type="avi"] .fml-large-file-icon::before,
.fml-item[data-file-type="mov"] .fml-large-file-icon::before {
    content: "🎬";
}

.fml-item[data-file-type="audio"] .fml-large-file-icon::before,
.fml-item[data-file-type="mp3"] .fml-large-file-icon::before,
.fml-item[data-file-type="wav"] .fml-large-file-icon::before {
    content: "🎵";
}

.fml-item[data-file-type="link"] .fml-large-file-icon::before,
.fml-item[data-file-type="url"] .fml-large-file-icon::before {
    content: "🔗";
}

/* Domyślna ikona - spinacz */
.fml-large-file-icon::before {
    content: "📎";
}

/* PRZYCISKI AKCJI NA DOLE */
.fml-item-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    padding-right: 50px; /* Miejsce na serduszko */
}

.fml-item-actions a,
.fml-item-actions button {
    padding: 8px 12px;
    background: #f8f9fa;
    color: #333;
    text-decoration: none;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex: 1;
    text-align: center;
}

.fml-item-actions a:hover,
.fml-item-actions button:hover {
    background: #e9ecef;
    transform: translateY(-1px);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* SERDUSZKO */
.fml-favorite {
    position: absolute;
    bottom: 20px;
    right: 15px;
    background: white;
    border: 1px solid #ddd;
    cursor: pointer;
    padding: 0;
    font-size: 20px;
    color: #ddd;
    transition: all 0.2s ease;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.fml-favorite:hover {
    color: #ff6b6b;
    transform: scale(1.1);
    background: #fff5f5;
    border-color: #ff6b6b;
}

.fml-favorite.favorited {
    color: #e74c3c;
    background: #fff5f5;
    border-color: #e74c3c;
}

.fml-heart {
    display: inline-block;
    font-size: 18px;
}

/* UKRYJ STARE ELEMENTY */
.fml-thumbnail,
.fml-file-icon,
.fml-item-content,
.fml-item-info,
.fml-item-description,
.fml-item-categories,
.fml-category-tag {
    display: none !important;
}

/* GRID - ZAWSZE 2 KOLUMNY */
.fml-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

/* RESPONSIVE */
@media (max-width: 768px) {
    .fml-grid {
        grid-template-columns: 1fr;
    }
    
    .fml-item {
        min-height: 240px;
    }
    
    .fml-large-file-icon {
        font-size: 48px;
    }
    
    .fml-item-actions {
        padding-right: 45px;
        font-size: 12px;
    }
    
    .fml-favorite {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }
}

/* SPÓJNE SERDUSZKA */
.fml-heart::before {
    content: "♥"; /* Zawsze to samo serduszko */
}

.fml-favorite .fml-heart {
    font-style: normal;
}

.fml-favorite:not(.favorited) .fml-heart::before {
    content: "♡"; /* Puste serduszko gdy nie jest ulubione */
}

.fml-favorite.favorited .fml-heart::before {
    content: "♥"; /* Pełne serduszko gdy ulubione */
    
    
    
}


.fml-modal {
    display: none;
    position: fixed;
    z-index: 99999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
}

.fml-modal-content {
    background-color: #fff;
    margin: 50px auto;
    padding: 0;
    border: 1px solid #888;
    width: 90%;
    max-width: 600px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.fml-modal-header {
    padding: 15px 20px;
    background: #f5f5f5;
    border-bottom: 1px solid #ddd;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.fml-modal-header-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.fml-modal-close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    border: none;
    background: none;
}

.fml-modal-close:hover {
    color: #000;
}

.fml-modal-body {
    padding: 20px;
}

.fml-modal-logo {
    height: 40px;
    width: auto;
}

/**
 * FML Upload Modal Styles
 */

/* Upload Modal Specific */
.fml-upload-modal-content {
    max-width: 600px;
}

/* Tab Navigation */
.fml-upload-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.fml-tab-btn {
    background: none!important;
    border: none;
    padding: 12px 20px;
    cursor: pointer;
    font-size: 14px;
    color: #666;
    margin-bottom: -2px;
}

.fml-tab-btn:hover {
    border: 1px;
    border-color: #ff8f00!important;
    color:  #ff8f00;
}

.fml-tab-btn.active {
    color: #ff8f00;
    font-weight: 600;
    border: none!important;
}

/* Tab Content */
.fml-tab-content {
    display: none;
    animation: fadeIn 0.3s;
}

.fml-tab-content.active {
    display: block;
}

/* Dropzone */
.fml-dropzone {
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #fafafa;
}

.fml-dropzone:hover {
    border-color: #ff8f00;
    background: #fff5e6;
}

.fml-dropzone.dragover {
    border-color: #ff8f00;
    background: #fff5e6;
    transform: scale(1.02);
}

.fml-dropzone-content {
    pointer-events: none;
}

.fml-upload-icon {
    color: #ff8f00;
    margin-bottom: 15px;
}

.fml-dropzone-text {
    font-size: 16px;
    color: #333;
    margin: 10px 0;
}

.fml-dropzone-info {
    font-size: 12px;
    color: #999;
}

/* File Preview */
#fml-file-preview {
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 20px;
}

.fml-preview-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.fml-file-name {
    font-weight: 500;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fml-remove-file {
    background: #ff4444;
    color: white;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    padding: 0;
}

.fml-remove-file:hover {
    background: #cc0000;
}

/* Form Groups */
.fml-form-group {
    margin-bottom: 20px;
}

.fml-form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
}

.fml-form-group input[type="text"],
.fml-form-group input[type="url"],
.fml-form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.fml-form-group input[type="text"]:focus,
.fml-form-group input[type="url"]:focus,
.fml-form-group textarea:focus {
    outline: none;
    border-color: #ff8f00;
    box-shadow: 0 0 0 2px rgba(255, 143, 0, 0.1);
}

.fml-form-group input[type="checkbox"] {
    margin-right: 8px;
}

/* Categories Checkboxes */
.fml-categories-checkboxes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    padding: 10px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    background: #f9f9f9;
    max-height: 150px;
    overflow-y: auto;
}

.fml-categories-checkboxes label {
    display: flex;
    align-items: center;
    font-weight: normal;
    margin-bottom: 0;
}

/* Form Actions */
.fml-form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.fml-form-actions .button {
    padding: 10px 24px;
}

.fml-form-actions .button-primary {
    background: #ff8f00;
    border-color: #ff8f00;
    color: white;
}

.fml-form-actions .button-primary:hover {
    background: #ff7700;
    border-color: #ff7700;
}

/* Upload Progress */
#fml-upload-progress {
    padding: 20px;
}

.fml-progress-bar {
    width: 100%;
    height: 30px;
    background: #e0e0e0;
    border-radius: 15px;
    overflow: hidden;
}

.fml-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff8f00, #ffb300);
    transition: width 0.3s ease;
    border-radius: 15px;
}

.fml-progress-text {
    text-align: center;
    margin-top: 15px;
    font-size: 14px;
    color: #666;
}

.fml-progress-text span {
    font-weight: bold;
    color: #ff8f00;
}

/* Success Message */
.fml-success-message {
    position: fixed;
    top: 50px;
    right: 20px;
    background: #4caf50;
    color: white;
    padding: 15px 25px;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    z-index: 10000;
    display: none;
    animation: slideInRight 0.3s;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 600px) {
    .fml-upload-modal-content {
        width: 95%;
        margin: 20px auto;
    }
    
    .fml-dropzone {
        padding: 30px 20px;
    }
    
    .fml-categories-checkboxes {
        grid-template-columns: 1fr;
    }
}


/* usuwanie sekcji z ikoną od strony biblioteki shortcode*/

/* Ukryj centralną ikonę */
.fml-item-file-display {
    display: none !important;
}

/* Dostosuj wysokość kafelka */
.fml-item {
    min-height: 150px !important;
    padding-bottom: 20px !important;
}

/* Przesuń przyciski bliżej */
.fml-item-actions {
    margin-top: 15px !important;
}

/* Przycisk pobierania ZIP w bibliotece */
.fml-bulk-actions {
    margin: 20px 0;
    padding: 15px;
    background: #f0f8ff;
    border: 1px solid #d1e7ff;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.fml-download-zip-btn {
    padding: 10px 20px !important;
    background: #0073aa !important;
    color: white !important;
    border: none !important;
    border-radius: 4px !important;
    cursor: pointer;
    font-size: 14px !important;
    font-weight: 600;
    text-decoration: none !important;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.fml-download-zip-btn:hover {
    background: #005a87 !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,115,170,0.3);
}

.fml-zip-info {
    font-size: 13px;
    color: #666;
    font-style: italic;
}

/* ==========================================================================
   Znacznik kursu na kaflu pliku
   Wygląd i odstępy zgodne z sekcjami „Moje kategorie" / „Ważność".
   ========================================================================== */

.fml-favorites-grid .fml-course-badge,
.fml-favorites-grid .fml-favorite-item .fml-course-badge,
.fml-library .fml-item .fml-course-badge {
    display: block;
    margin: 0 0 15px;
    padding: 12px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-left: 3px solid #4a90d9;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.45;
}

.fml-course-badge .fml-course-badge-label {
    display: block;
    margin-bottom: 6px;
    color: #333;
    font-weight: 600;
    font-size: 13px;
    text-transform: none;
    letter-spacing: 0;
}

/* Motyw koloruje linki w kaflu — nadpisujemy dla czytelności. */
.fml-favorites-grid .fml-course-badge .fml-course-badge-link,
.fml-library .fml-item .fml-course-badge .fml-course-badge-link,
.fml-course-badge a.fml-course-badge-link {
    display: block;
    color: #2c5aa0;
    font-weight: 500;
    font-size: 13px;
    line-height: 1.45;
    text-decoration: none;
    overflow-wrap: anywhere;
}

.fml-favorites-grid .fml-course-badge .fml-course-badge-link:hover,
.fml-library .fml-item .fml-course-badge .fml-course-badge-link:hover,
.fml-course-badge a.fml-course-badge-link:hover,
.fml-course-badge a.fml-course-badge-link:focus {
    color: #1a3d73;
    text-decoration: underline;
}

/* Filtr kursu — szerokość jak pozostałe filtry */
#fml-filter-course {
    max-width: 260px;
}

.fml-favorites-empty-filter {
    margin: 20px 0;
    padding: 16px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    color: #6b7a8d;
    text-align: center;
}

/* --- Znacznik kursu w siatce: nie kurczy się i nie nachodzi na przyciski --- */
.fml-library .fml-item .fml-course-badge,
.fml-favorites-grid .fml-favorite-item .fml-course-badge {
    flex: 0 0 auto;          /* nie daje się ścisnąć w kaflu flex */
    box-sizing: border-box;
    width: 100%;
    overflow: hidden;
}

/* Tytuł kursu skraca się do dwóch linii zamiast wypływać poza kafel. */
.fml-library .fml-item .fml-course-badge .fml-course-badge-link,
.fml-favorites-grid .fml-favorite-item .fml-course-badge .fml-course-badge-link {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    max-height: 2.9em;
}

/* Przyciski trzymają dystans od znacznika. */
.fml-library .fml-item .fml-item-actions {
    margin-top: 12px;
    flex-shrink: 0;
}

/* Wąskie kafle — zwarty wariant znacznika. */
@media (max-width: 480px) {
    .fml-library .fml-item .fml-course-badge,
    .fml-favorites-grid .fml-favorite-item .fml-course-badge {
        padding: 8px 10px;
        margin-bottom: 10px;
    }

    .fml-course-badge .fml-course-badge-label {
        margin-bottom: 3px;
        font-size: 12px;
    }

    .fml-library .fml-item .fml-course-badge .fml-course-badge-link,
    .fml-favorites-grid .fml-favorite-item .fml-course-badge .fml-course-badge-link {
        font-size: 12px;
        -webkit-line-clamp: 2;
    }
}

/* Kafel z dodanym znacznikiem potrzebuje więcej wysokości.
   Wcześniejsza reguła .fml-item ustawia min-height:150px !important,
   więc tu również jest !important — inaczej kafel się ściska.
   Klasa pochodzi z PHP; :has() to zapas. */
.fml-library .fml-item.has-course-badge,
.fml-library .fml-item:has(.fml-course-badge),
.fml-favorites-grid .fml-favorite-item:has(.fml-course-badge) {
    min-height: 0 !important;
    height: auto !important;
    padding-bottom: 20px !important;
}

/* Treść kafla nie może się kurczyć poniżej swojej zawartości. */
.fml-library .fml-item.has-course-badge .fml-course-badge,
.fml-library .fml-item:has(.fml-course-badge) .fml-course-badge {
    flex: 0 0 auto !important;
    min-height: 0 !important;
}

/* Przyciski zawsze pod znacznikiem, nigdy na nim. */
.fml-library .fml-item.has-course-badge .fml-item-actions,
.fml-library .fml-item:has(.fml-course-badge) .fml-item-actions {
    /* Taki sam odstęp, jaki nagłówek zostawia nad znacznikiem (15px). */
    margin-top: 15px !important;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

/* --- Serduszko w rzędzie przycisków (klasa z PHP: .fml-favorite-inline) ---
   Rząd stylizuje wszystkie swoje przyciski jak „Pobierz"/„Zobacz", więc tutaj
   odtwarzamy oryginalny okrągły wygląd i wyjmujemy je z pozycjonowania
   absolutnego, żeby flex ustawił je obok „Zobacz". */
.fml-item-actions .fml-favorite-inline,
.fml-item-actions button.fml-favorite-inline {
    position: static !important;
    right: auto !important;
    bottom: auto !important;
    top: auto !important;
    left: auto !important;
    margin: 0 !important;
    flex: 0 0 auto;
    align-self: center;

    /* wygląd jak przed przeniesieniem */
    width: 36px !important;
    height: 36px !important;
    padding: 0 !important;
    background: #fff !important;
    border: 1px solid #ddd !important;
    border-radius: 50% !important;
    color: #ddd !important;
    font-size: 20px !important;
    line-height: 1 !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    box-shadow: none !important;
    transition: all 0.2s ease;
}

.fml-item-actions .fml-favorite-inline:hover {
    color: #ff6b6b !important;
    background: #fff5f5 !important;
    border-color: #ff6b6b !important;
    transform: scale(1.1);
}

.fml-item-actions .fml-favorite-inline.favorited {
    color: #ff6b6b !important;
    border-color: #ff6b6b !important;
}

/* Rezerwacja miejsca zbędna — serduszko jest w rzędzie. */
.fml-library .fml-item.has-course-badge .fml-item-actions,
.fml-library .fml-item:has(.fml-course-badge) .fml-item-actions {
    /* Wcześniejsza reguła rezerwuje padding-right: 50px na serduszko przyklejone
       do rogu. Serduszko jest teraz w rzędzie, więc rezerwa znika, a rząd
       zwęża się do szerokości kafla i centruje razem z ramką znacznika. */
    /* Wcześniejsze reguły ustawiają rząd na position:absolute z left:20px
       i right:70px — stąd przesunięcie w prawo. Wracamy do zwykłego przepływu,
       żeby krawędzie pokryły się z ramką znacznika nad nim. */
    position: static !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    top: auto !important;
    height: auto !important;
    padding-right: 0 !important;
    padding-left: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    margin-top: 15px !important;
    box-sizing: border-box;
    width: 100% !important;
    max-width: 100% !important;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: nowrap;
}

/* „Pobierz" i „Zobacz" dzielą się miejscem po równo; serduszko zachowuje rozmiar. */
.fml-library .fml-item.has-course-badge .fml-item-actions > a,
.fml-library .fml-item:has(.fml-course-badge) .fml-item-actions > a {
    flex: 1 1 0;
    min-width: 0;
    text-align: center;
    white-space: nowrap;
}
