/* Wrapper og container */
.jakt-tider-wrapper {
    max-width: 100%;
    margin: 20px 0;
    font-size: 14px;
}

/* Filter-container layout */
.jakt-filter-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* Øvre filter-rad */
.jakt-filter-top {
    display: grid;
    grid-template-columns: minmax(200px, 300px) minmax(150px, 200px);
    gap: 15px;
}

/* Sticky filter */
/* Fjern aggressiv sticky på små skjermer; behold kun subtil effekt på desktop */
@media (min-width: 1025px) {
    .jakt-filter-container.sticky {
        position: sticky;
        top: 0;
        z-index: 10;
        margin-top: 0;
        border-radius: 0;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
        animation: slideDown 0.3s ease;
    }
}

@keyframes slideDown {
    from { transform: translateY(-100%); }
    to { transform: translateY(0); }
}

/* Forbedrede filter-grupper */
.jakt-filter-group {
    position: relative;
    margin-bottom: 10px;
}

/* Søkefelt */
#jakt-filter-search {
    width: 100%;
    height: 36px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

/* Kategori select */
#jakt-filter-category {
    width: 100%;
    height: 36px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background-color: white;
}

/* Forbedrede status-filtre */
.jakt-status-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-top: 15px;
}

.jakt-status-filters label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fff;
    border: 2px solid transparent;
}

/* Status-filter farger */
.jakt-status-filters label[for*="jaktbar"] {
    border-color: #28a745;
    color: #28a745;
}

.jakt-status-filters label[for*="snart-slutt"] {
    border-color: #ffc107;
    color: #333;
}

.jakt-status-filters label[for*="ikke-jaktbar"] {
    border-color: #dc3545;
    color: #dc3545;
}

/* Hover effekter */
.jakt-status-filters label:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Status-indikatorer i tabell */
.status-indicator {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 500;
}

/* Korrekte status-klasser for tabellen */
.status-indicator.status-jaktbar {
    background-color: #28a745;
    color: white;
}

.status-indicator.status-snart_slutt {
    background-color: #ffc107;
    color: #333;
}

.status-indicator.status-ikke_jaktbar {
    background-color: #dc3545;
    color: white;
}

/* Filter-spesifikke stiler */
.jakt-status-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-top: 15px;
}

.jakt-status-filters label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fff;
    border: 2px solid transparent;
}

/* Status-filter farger */
.jakt-status-filters label[for*="jaktbar"] {
    border-color: #28a745;
    color: #28a745;
}

.jakt-status-filters label[for*="snart-slutt"] {
    border-color: #ffc107;
    color: #333;
}

.jakt-status-filters label[for*="ikke-jaktbar"] {
    border-color: #dc3545;
    color: #dc3545;
}

/* Hover effekter */
.jakt-status-filters label:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Input og select styling */
.jakt-filter-group input,
.jakt-filter-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.jakt-filter-group input:focus,
.jakt-filter-group select:focus {
    border-color: #2271b1;
    outline: none;
}

/* Loading indikator */
.loading {
    text-align: center;
    padding: 30px;
    color: #666;
}

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    margin-right: 10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Forbedret responsiv design */
@media (max-width: 768px) {
    /* Skjul filter som standard på mobil, bruk toggle */
    .jakt-filter-container {
        display: none;
    }

    .jakt-filter-container.open {
        display: block;
    }

    .jakt-filter-toggle {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        padding: 10px 14px;
        background: #f1f3f5;
        border: 1px solid #dee2e6;
        border-radius: 6px;
        cursor: pointer;
        margin-bottom: 10px;
        font-size: 14px;
    }

    .jakt-filter-toggle:after {
        content: '\25BC';
        font-size: 12px;
        transition: transform 0.2s ease;
    }

    .jakt-filter-toggle[aria-expanded="true"]:after {
        transform: rotate(180deg);
    }
    /* Filter container */
    .jakt-filter-container {
        padding: 12px;
        gap: 8px;
        margin: 10px 0;
    }

    /* Søk og kategori */
    .jakt-filter-top {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    /* Input og select */
    .jakt-filter-group input,
    .jakt-filter-group select {
        height: 44px;
        padding: 8px 12px;
        font-size: 16px; /* Unngå iOS zoom */
        -webkit-appearance: none; /* Fjern iOS default styling */
        appearance: none;
    }

    /* Status-filter */
    .jakt-status-filters {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 8px;
        padding: 10px;
        background: #f8f9fa;
        border-radius: 6px;
    }

    .jakt-status-filters label {
        width: 100%;
        min-height: 38px;
        padding: 6px 8px 6px 26px;
        font-size: 13px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }



    /* Tabell responsiv */
    .jakt-table-container {
        margin-top: 15px;
        border-radius: 6px;
        overflow: hidden;
        background: white;
        box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    }

    .jakt-tider-table {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        border-radius: 0;
    }

    .jakt-tider-table thead th {
        position: sticky;
        top: 0;
        background: white;
        z-index: 1;
        padding: 12px 10px;
        font-size: 13px;
        white-space: nowrap;
    }

    .jakt-tider-table td {
        padding: 10px;
        font-size: 12px;
        min-width: 100px;
    }

    /* Status indikatorer */
    .status-indicator {
        padding: 4px 8px;
        font-size: 12px;
        white-space: nowrap;
        justify-content: center;
    }

    /* Loading state */
    .loading td {
        padding: 20px 10px;
        text-align: center;
    }

    /* Scroll hint */
    .jakt-table-container.has-overflow:after {
        content: '';
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        width: 24px;
        background: linear-gradient(to right, transparent, rgba(255,255,255,0.9));
        pointer-events: none;
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    .jakt-table-container.has-overflow:after {
        opacity: 1;
    }
}

/* Ekstra små skjermer */
@media (max-width: 480px) {
    .jakt-filter-container {
        padding: 8px;
    }

    .jakt-status-filters {
        grid-template-columns: 1fr;
        padding: 8px;
    }

    .jakt-status-filters label {
        padding: 8px 6px 8px 24px;
    }

    .jakt-tider-table td, 
    .jakt-tider-table th {
        padding: 6px 5px;
        font-size: 11px;
    }

    /* Forbedret touch targets */
    .jakt-extra-toggle {
        width: 32px;
        height: 32px;
        line-height: 32px;
    }
}

/* Forbedret scrollbar for tabellen */
.jakt-tider-table::-webkit-scrollbar {
    height: 6px;
}

.jakt-tider-table::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.jakt-tider-table::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.jakt-tider-table::-webkit-scrollbar-thumb:hover {
    background: #666;
}

/* Hint om scrolling på mobil */
@media (max-width: 768px) {
    .jakt-table-container {
        position: relative;
    }

    .jakt-table-container:after {
        content: '';
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        width: 30px;
        background: linear-gradient(to right, transparent, rgba(255,255,255,0.9));
        pointer-events: none;
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    .jakt-table-container.has-overflow:after {
        opacity: 1;
    }
}

/* Print-optimalisering */
@media print {
    .jakt-filter-container {
        display: none;
    }

    .jakt-tider-table {
        width: 100%;
        border-collapse: collapse;
    }

    .jakt-tider-table th,
    .jakt-tider-table td {
        border: 1px solid #000;
        padding: 8px;
        font-size: 12px;
    }

    .status-indicator {
        border: 1px solid #000;
    }

    .jakt-extra-toggle {
        display: none;
    }
}

/* Tabell-container */
.jakt-table-container {
    overflow-x: auto;
    margin-top: 20px;
}

/* Tabell */
.jakt-tider-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Tabellhode */
.jakt-tider-table thead th {
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid rgba(0,0,0,0.1);
}

/* Tabellceller */
.jakt-tider-table td {
    padding: 10px 15px;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
}

/* Hover-effekt på rader */
.jakt-tider-table tbody tr:hover {
    background-color: rgba(0,0,0,0.02);
}

/* Pil for ekstra info */
.jakt-extra-toggle {
    display: inline-block;
    width: 24px;
    height: 24px;
    line-height: 24px;
    text-align: center;
    text-decoration: none;
    color: #666;
    border-radius: 50%;
    background: #f0f0f0;
}

.jakt-extra-toggle:hover {
    background: #e0e0e0;
    color: #333;
}

/* Ekstra info rad */
tr[id^="extra-row-"] td {
    background: #f8f9fa;
    padding: 15px;
    font-size: 13px;
}

/* Status dots */
.status-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 8px;
}

.status-dot.jaktbar {
    background-color: #28a745;
}

.status-dot.snart-slutt {
    background-color: #ffc107;
}

.status-dot.ikke-jaktbar {
    background-color: #dc3545;
}

/* Enkel og ren checkbox styling */
.jakt-status-filters input[type="checkbox"] {
    margin-right: 8px;
    width: 16px;
    height: 16px;
    accent-color: currentColor;
    cursor: pointer;
}

.jakt-status-filters label {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    cursor: pointer;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    transition: all 0.2s ease;
    gap: 8px;
}

.jakt-status-filters label:hover {
    background: #e9ecef;
    border-color: #adb5bd;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Forbedret hover-effekter */
.jakt-filter-group input:hover,
.jakt-filter-group select:hover {
    border-color: #2271b1;
}

.jakt-status-filters label:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Animasjoner */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.jakt-status-filters label {
    animation: fadeIn 0.3s ease;
}

/* Loading state */
.jakt-filter-container.loading {
    position: relative;
}

.jakt-filter-container.loading:after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.3);
    border-radius: 8px;
}

/* Restriksjons-varsel styling */
.restriction-warning {
    display: inline-block;
    margin-left: 5px;
    font-size: 16px;
    cursor: pointer;
    color: #ffc107;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
    transition: transform 0.2s ease;
}

.restriction-warning:hover {
    transform: scale(1.1);
}

/* Restriksjons-modal for mobil */
.restriction-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
}

.restriction-modal {
    background: white;
    border-radius: 8px;
    max-width: 90vw;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.restriction-modal-header {
    background: #ffc107;
    color: #000;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e0e0e0;
}

.restriction-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.restriction-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    color: #000;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s ease;
}

.restriction-modal-close:hover {
    background: rgba(0,0,0,0.1);
}

.restriction-modal-content {
    padding: 20px;
    max-height: 60vh;
    overflow-y: auto;
    line-height: 1.6;
    font-size: 14px;
}

/* Restriksjons-info under filteret */
.jakt-restriction-info {
    margin-top: 8px;
    padding: 6px 10px;
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 4px;
    color: #856404;
}

.jakt-restriction-info .restriction-warning {
    margin-left: 0;
    margin-right: 5px;
}

/* Forbedret responsiv design */
@media (max-width: 768px) {
    .jakt-filter-top {
        grid-template-columns: 1fr;
    }
    
    .jakt-status-filters {
        padding: 12px;
    }
    
    .jakt-status-filters label {
        width: 100%;
        justify-content: flex-start;
    }
    
    .status-dot {
        margin-right: 12px;
    }
}

/* Widget-spesifikke stiler */
.jakt-tider-widget-wrapper {
    font-size: 13px;
}

.jakt-tider-widget-wrapper .jakt-filter-container {
    padding: 10px;
}

.jakt-tider-widget-wrapper .jakt-filter-top {
    grid-template-columns: 1fr;
    gap: 8px;
}

.jakt-tider-widget-wrapper .jakt-status-filters {
    padding: 8px;
}

.jakt-tider-widget-wrapper .jakt-tider-table {
    font-size: 12px;
}

.jakt-tider-widget-wrapper .jakt-tider-table td,
.jakt-tider-widget-wrapper .jakt-tider-table th {
    padding: 6px 8px;
}

.jakt-tider-widget-wrapper .status-indicator {
    padding: 2px 8px;
    font-size: 11px;
}

/* TagDiv kompatibilitet */
.td_block_jakttider .td-block-inner {
    margin-bottom: 0;
}

.td_block_jakttider .jakt-tider-wrapper {
    margin: 0;
}

/* Periode fargemarkering */
.period-display.period-active {
    color: #28a745;
    font-weight: 600;
}

.period-display.period-ending-soon {
    color: #ffc107;
    font-weight: 600;
}

.period-display.period-inactive {
    color: #6c757d;
}

/* Klikkbare rader */
.data-row.has-extra-info.clickable {
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.data-row.has-extra-info.clickable:hover {
    background-color: #f8f9fa;
}

.expand-icon {
    transition: transform 0.2s ease;
    color: #6c757d;
}

.expand-icon:hover {
    color: #495057;
}

/* Ekstra info innhold */
.extra-info-content {
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    margin: 10px 0;
}

.extra-info-text {
    margin-bottom: 15px;
    line-height: 1.6;
}

.extra-info-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    border-top: 1px solid #dee2e6;
    padding-top: 15px;
}

.edit-row-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 15px;
    background: #0073aa;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: background-color 0.2s ease;
}

.edit-row-btn:hover {
    background: #005a87;
    color: white;
}

.edit-row-btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* Sorteringsknapper */
.sort-order-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 12px;
    background: #f1f1f1;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 38px;
}

.sort-order-btn:hover {
    background: #e0e0e0;
    border-color: #ccc;
}

.sort-order-btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.sort-order-btn .sort-text {
    font-size: 13px;
    font-weight: 500;
}

/* Juster filter-layouten for nye sorteringsknapper */
.jakt-filter-top {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr auto;
    gap: 10px;
    align-items: end;
}

/* Mobile tilpasninger for nye funksjoner */
@media (max-width: 768px) {
    .jakt-filter-top {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .sort-order-btn {
        justify-content: center;
        width: 100%;
    }
    
    .extra-info-actions {
        flex-direction: column;
    }
    
    .edit-row-btn {
        justify-content: center;
        width: 100%;
        padding: 12px 15px;
    }
    
    /* Touch-vennlige klikkområder */
    .data-row.has-extra-info.clickable {
        min-height: 44px;
    }
    
    .expand-icon {
        font-size: 20px;
        padding: 5px;
    }
}
