/* Import Fraunces font */
@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,400;0,9..144,500;0,9..144,600;0,9..144,700;1,9..144,400&display=swap');

/* Allgot Color Variables */
:root {
    --allgot-olive: #82895b;
    --allgot-olive-light: #a5b07a;
    --allgot-olive-dark: #6b7248;
    --allgot-neutral: #ffffff;
    --allgot-text: #212529;
    --allgot-text-light: #6c757d;
    --allgot-border: #e9ecef;
    --allgot-background: #f6f7f8;
    --allgot-card-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* NP File Browser Styles */
.np-browser-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: clamp(16px, 4vw, 32px);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--allgot-text);
    background: var(--allgot-background);
    border-radius: 0 0 20px 20px;
    min-height: 100vh;
}

.np-browser-header {
    text-align: center;
    margin-bottom: clamp(20px, 4vw, 32px);
}

.np-browser-title {
    font-family: 'Fraunces', serif;
    font-variation-settings: "opsz" 18;
    font-weight: 600;
    font-size: clamp(24px, 5vw, 36px);
    color: var(--allgot-text);
    margin: 0;
    letter-spacing: -0.02em;
}

.np-browser-filters {
    background: var(--allgot-neutral);
    border: 1px solid var(--allgot-border);
    border-radius: 12px;
    padding: clamp(12px, 2.5vw, 16px);
    margin-bottom: clamp(16px, 3vw, 24px);
    box-shadow: var(--allgot-card-shadow);
}

.filter-row,
.filter-row-compact {
    display: flex;
    gap: clamp(8px, 2vw, 12px);
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: clamp(8px, 1.5vw, 12px);
}

.filter-group,
.filter-group-compact {
    display: flex;
    flex-direction: column;
    min-width: clamp(100px, 15vw, 140px);
    flex: 1;
    gap: 4px;
}

.filter-group label,
.filter-group-compact label {
    font-size: clamp(12px, 1.8vw, 13px);
    font-weight: 600;
    color: var(--allgot-olive);
    margin-bottom: 2px;
    font-family: 'Fraunces', serif;
    font-variation-settings: "opsz" 14;
}

.filter-group input,
.filter-group select,
.filter-group-compact input,
.filter-group-compact select {
    padding: clamp(8px, 1.5vw, 10px) clamp(10px, 2vw, 12px);
    border: 1px solid var(--allgot-border);
    border-radius: 6px;
    font-size: clamp(13px, 2vw, 14px);
    background: var(--allgot-neutral);
    color: var(--allgot-text);
    transition: all 0.2s ease-out;
    font-family: inherit;
    width: 100%;
    height: 36px;
}

.filter-group input:focus,
.filter-group select:focus,
.filter-group-compact input:focus,
.filter-group-compact select:focus {
    outline: none;
    border-color: var(--allgot-olive);
    box-shadow: 0 0 0 2px rgba(130, 137, 91, 0.1);
}

.filter-group select:disabled {
    background-color: var(--allgot-background);
    color: var(--allgot-text-light);
    cursor: not-allowed;
}

.filter-group select.loading {
    background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxNiAxNiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGNpcmNsZSBjeD0iOCIgY3k9IjgiIHI9IjYiIHN0cm9rZT0iIzY5NzA3ZCIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1kYXNoYXJyYXk9IjMgMyIvPgo8L3N2Zz4K');
    background-repeat: no-repeat;
    background-position: calc(100% - 12px) center;
    background-size: 16px 16px;
    animation: spin 1s linear infinite;
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.1);
}

#np-search {
    min-width: 180px;
}

.results-info {
    margin-left: auto;
    font-size: clamp(12px, 1.8vw, 14px);
    color: var(--allgot-text-light);
}

#results-count {
    font-weight: 500;
}

.np-btn {
    padding: clamp(10px, 2vw, 14px) clamp(16px, 3vw, 24px);
    border: 2px solid transparent;
    border-radius: 8px;
    font-size: clamp(14px, 2.2vw, 16px);
    font-weight: 500;
    font-family: 'Fraunces', serif;
    font-variation-settings: "opsz" 14;
    cursor: pointer;
    transition: all 0.2s ease-out;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    letter-spacing: -0.01em;
}

.np-btn.primary {
    background-color: var(--allgot-olive);
    color: var(--allgot-neutral);
    border-color: var(--allgot-olive);
}

.np-btn.primary:hover {
    background-color: var(--allgot-olive-dark);
    border-color: var(--allgot-olive-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(130, 137, 91, 0.2);
}

.np-btn.secondary {
    background-color: var(--allgot-neutral);
    color: var(--allgot-text);
    border-color: var(--allgot-border);
}

.np-btn.secondary:hover {
    border-color: var(--allgot-olive);
    transform: translateY(-1px);
}

.np-btn svg {
    width: 16px;
    height: 16px;
    margin-right: 6px;
    vertical-align: text-top;
}

#np-share-filters {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.results-info-compact {
    margin-left: auto;
    font-size: clamp(12px, 2vw, 13px);
    color: var(--allgot-text-light);
    white-space: nowrap;
    padding-left: clamp(8px, 2vw, 12px);
}

.np-reset-btn {
    background: transparent;
    border: 1px solid var(--allgot-border);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease-out;
    margin-left: clamp(6px, 1.5vw, 8px);
    opacity: 0;
    visibility: hidden;
    flex-shrink: 0;
}

.np-reset-btn.visible {
    opacity: 1;
    visibility: visible;
}

.np-reset-btn:hover {
    background: var(--allgot-olive);
    border-color: var(--allgot-olive);
    color: var(--allgot-neutral);
    transform: scale(1.1);
}

.reset-icon {
    font-size: 16px;
    font-weight: bold;
    color: var(--allgot-text-light);
    transition: color 0.2s ease-out;
}

.np-reset-btn:hover .reset-icon {
    color: var(--allgot-neutral);
}

.np-share-btn {
    background: transparent;
    border: 1px solid var(--allgot-border);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease-out;
    margin-left: clamp(6px, 1.5vw, 8px);
    flex-shrink: 0;
}

.np-share-btn:hover {
    background: var(--allgot-olive);
    border-color: var(--allgot-olive);
    transform: scale(1.1);
}

.share-icon {
    font-size: 14px;
    font-weight: normal;
    color: var(--allgot-text-light);
    transition: color 0.2s ease-out;
}

.np-share-btn:hover .share-icon {
    color: var(--allgot-neutral);
}

.np-share-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--allgot-olive);
    color: var(--allgot-neutral);
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    z-index: 1001;
    transform: translateX(100%);
    transition: transform 0.3s ease-out;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.np-share-notification.show {
    transform: translateX(0);
}

.np-share-notification.hide {
    transform: translateX(100%);
}

.np-browser-results {
    position: relative;
}

.np-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #6c757d;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e9ecef;
    border-top: 4px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes slideInUp {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.np-files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(clamp(280px, 25vw, 350px), 1fr));
    gap: clamp(16px, 3vw, 24px);
    margin-bottom: clamp(32px, 6vw, 48px);
    align-items: start;
}

.np-file-card {
    background: var(--allgot-neutral);
    border: 1px solid var(--allgot-border);
    border-radius: 16px;
    padding: clamp(14px, 2.5vw, 18px);
    transition: all 0.2s ease-out;
    position: relative;
    opacity: 0;
    animation: slideInUp 0.4s ease forwards;
    box-shadow: var(--allgot-card-shadow);
    min-height: clamp(140px, 20vw, 180px);
    height: auto;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.np-file-card:hover {
    box-shadow: 0 12px 40px rgba(130, 137, 91, 0.12), 0 4px 16px rgba(0, 0, 0, 0.08);
    border-color: var(--allgot-olive);
    transform: translateY(-4px);
    border-width: 1px;
}

.np-file-header {
    display: flex;
    align-items: flex-start;
    margin-bottom: 8px;
    flex-shrink: 0;
}

.np-file-icon {
    width: 20px;
    height: 20px;
    margin-right: 10px;
    flex-shrink: 0;
}

.np-file-icon.pdf {
    background: linear-gradient(135deg, #dc3545, #e74c3c);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 7px;
    letter-spacing: 0.5px;
}

.np-file-icon.mp3 {
    background: linear-gradient(135deg, #28a745, #20c997);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 10px;
}

.np-file-icon.xlsx {
    background: linear-gradient(135deg, #198754, #20c997);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 7px;
    letter-spacing: 0.3px;
}

.np-file-icon.docx {
    background: linear-gradient(135deg, #0d6efd, #6610f2);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 7px;
    letter-spacing: 0.3px;
}

.np-file-info {
    flex: 1;
    min-width: 0;
}

.np-file-title {
    font-weight: 600;
    color: #212529;
    margin: 0 0 5px 0;
    font-size: 15px;
    line-height: 1.3;
    word-wrap: break-word;
}

.np-file-meta {
    font-size: 12px;
    color: #6c757d;
    line-height: 1.4;
}

.np-file-meta span {
    margin-right: 10px;
}

.np-file-info-tags {
    margin-top: 15px;
    margin-bottom: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.np-info-tag {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.np-info-tag.arskurs { 
    background: #e1f5fe; 
    color: #01579b; 
}

.np-info-tag.kurs { 
    background: #f3e5f5; 
    color: #4a148c; 
}

.np-info-tag.niva { 
    background: #e8f5e8; 
    color: #1b5e20; 
}

.np-info-tag.delprov { 
    background: #fff3e0; 
    color: #e65100; 
}

.np-file-taxonomies {
    margin-top: 12px;
}

.np-tax-group {
    margin-bottom: 8px;
}

.np-tax-label {
    font-size: 11px;
    font-weight: 600;
    color: #495057;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-right: 8px;
}

.np-tax-tag {
    display: inline-block;
    background: #e9ecef;
    color: #495057;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    margin-right: 6px;
    margin-bottom: 4px;
}

.np-tax-tag.amnen { background: #e3f2fd; color: #1565c0; }
.np-tax-tag.artal { background: #f3e5f5; color: #7b1fa2; }
.np-tax-tag.stadieindelning { background: #e8f5e8; color: #2e7d32; }

.np-file-actions {
    margin-top: 15px;
    text-align: right;
}

.np-download-btn {
    background: #007cba;
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.3s ease;
}

.np-download-btn:hover {
    background: #005a87;
    color: white;
    text-decoration: none;
}

.np-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 30px;
}

.np-load-more-status {
    text-align: center;
    padding: 20px;
}

.np-scroll-hint {
    color: var(--allgot-text-light);
    font-style: italic;
    font-size: 14px;
    margin: 0;
}

.np-end-message {
    color: var(--allgot-olive);
    font-weight: 500;
    font-size: 14px;
    margin: 0;
}

.np-no-results {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
}

.np-no-results h3 {
    color: #495057;
    margin-bottom: 10px;
}

.np-info-grid {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
    overflow: hidden;
}

.np-info-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: clamp(6px, 1.5vw, 10px);
    line-height: 1.2;
    align-items: start;
}

.np-info-row.primary {
    margin-bottom: 6px;
}

.np-info-row.secondary {
    opacity: 0.8;
    font-size: 0.9em;
}

.np-info-item {
    display: flex;
    flex-direction: column;
    gap: 3px;
    white-space: nowrap;
    min-width: 0;
    align-items: center;
    text-align: center;
}

.np-info-item.inline {
    flex-direction: column;
}

.np-info-label {
    font-family: 'Fraunces', serif;
    font-variation-settings: "opsz" 9;
    font-weight: 600;
    color: var(--allgot-olive);
    font-size: clamp(7px, 1.4vw, 9px);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    flex-shrink: 0;
    margin-bottom: 2px;
    white-space: nowrap;
}

.np-info-value {
    color: var(--allgot-text);
    font-weight: 600;
    font-size: clamp(10px, 2vw, 13px);
    line-height: 1.3;
    letter-spacing: -0.01em;
    max-width: 100%;
    word-wrap: break-word;
    white-space: normal;
    overflow-wrap: break-word;
    hyphens: auto;
}

/* Skeleton Loading with Allgot colors */
.np-skeleton {
    background: linear-gradient(90deg, var(--allgot-background) 25%, var(--allgot-border) 50%, var(--allgot-background) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

.np-skeleton-card {
    background: var(--allgot-neutral);
    border: 2px solid var(--allgot-border);
    border-radius: 12px;
    padding: clamp(16px, 3vw, 24px);
    margin-bottom: clamp(20px, 4vw, 32px);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.np-skeleton-header {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.np-skeleton-icon {
    width: 24px;
    height: 24px;
    border-radius: 3px;
    margin-right: 8px;
}

.np-skeleton-line {
    height: 12px;
    border-radius: 6px;
    margin-bottom: 6px;
}

.np-skeleton-line.short {
    width: 60%;
}

.np-skeleton-line.medium {
    width: 80%;
}

.np-skeleton-line.long {
    width: 100%;
}

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


/* Bulk Actions */
.np-bulk-actions {
    background: var(--allgot-neutral);
    border: 2px solid var(--allgot-border);
    border-radius: 12px;
    padding: clamp(12px, 2.5vw, 16px);
    margin-bottom: clamp(16px, 3vw, 24px);
    display: none;
    align-items: center;
    gap: clamp(8px, 2vw, 12px);
    box-shadow: 0 2px 8px rgba(130, 137, 91, 0.1);
}

.np-bulk-actions.visible {
    display: flex;
}

.np-bulk-count {
    font-family: 'Fraunces', serif;
    font-variation-settings: "opsz" 12;
    font-weight: 600;
    color: var(--allgot-olive);
    font-size: clamp(13px, 2.2vw, 15px);
}

.np-bulk-btn {
    background: var(--allgot-background);
    border: 2px solid var(--allgot-border);
    color: var(--allgot-text);
    padding: clamp(6px, 1.5vw, 8px) clamp(10px, 2.5vw, 12px);
    border-radius: 6px;
    font-size: clamp(11px, 2vw, 13px);
    cursor: pointer;
    transition: all 0.2s ease-out;
}

.np-bulk-btn:hover {
    border-color: var(--allgot-olive);
    transform: translateY(-1px);
}

.np-file-checkbox {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 16px;
    height: 16px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.np-file-card:hover .np-file-checkbox {
    opacity: 1;
}

.np-file-card.selected {
    border-color: var(--allgot-olive);
    border-left: 4px solid var(--allgot-olive);
    background: rgba(130, 137, 91, 0.02);
}

.np-file-card.selected .np-file-checkbox {
    opacity: 1;
}

/* Accessibility improvements */
.np-file-card:focus-within {
    outline: 2px solid var(--allgot-olive);
    outline-offset: 2px;
}

.np-btn:focus,
.np-quick-tag:focus,
.filter-group input:focus,
.filter-group select:focus {
    outline: 2px solid var(--allgot-olive);
    outline-offset: 2px;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .np-file-card,
    .np-btn,
    .np-quick-tag,
    .filter-group input,
    .filter-group select {
        transition: none;
        animation: none;
    }
    
    .np-file-card:hover {
        transform: none;
    }
}

/* Rich Preview Modal */
.np-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.np-modal.visible {
    display: flex;
    align-items: center;
    justify-content: center;
}

.np-modal-content {
    background: var(--allgot-neutral);
    border-radius: 16px;
    padding: clamp(20px, 4vw, 32px);
    max-width: 90vw;
    max-height: 90vh;
    overflow: auto;
    position: relative;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.np-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: var(--allgot-background);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    font-size: 18px;
    color: var(--allgot-text);
    transition: all 0.2s ease;
}

.np-modal-close:hover {
    background: var(--allgot-olive);
    color: var(--allgot-neutral);
}

.np-modal-title {
    font-family: 'Fraunces', serif;
    font-variation-settings: "opsz" 16;
    font-weight: 600;
    font-size: clamp(18px, 3vw, 24px);
    color: var(--allgot-text);
    margin-bottom: 16px;
    padding-right: 40px;
}

.np-preview-content {
    text-align: center;
}

.np-preview-content iframe {
    border: 2px solid var(--allgot-border);
    border-radius: 8px;
    max-width: 100%;
    height: 60vh;
}

.np-preview-actions {
    margin-top: 16px;
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* Responsiv design */
@media (max-width: 768px) {
    .np-browser-container {
        padding: 15px;
    }
    
    .filter-row-compact {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
    
    .filter-group-compact {
        min-width: auto;
        flex: none;
    }
    
    .results-info-compact {
        margin-left: 0;
        padding-left: 0;
        text-align: center;
        margin-top: 8px;
    }
    
    #np-search {
        min-width: auto;
    }
    
    .np-files-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .np-file-card {
        padding: 12px;
        min-height: clamp(120px, 18vw, 160px);
        height: auto;
    }
    
    .np-info-row {
        grid-template-columns: 1fr;
        gap: 8px;
        text-align: left;
    }
    
    .np-info-item {
        align-items: flex-start;
        text-align: left;
    }
    
    .np-info-value {
        max-width: 120px;
    }
    
}