/* ==========================================================================
   FazaRadar Frontend Filter Styles (v2.7.0)
   ========================================================================== */

.itwp-filter-wrapper {
    max-width: 100%;
    width: 100%;
    margin: 2rem auto;
    padding: 0;
}

.itwp-filter-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 0;
    background: transparent;
}

.itwp-filters-left {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    flex: 1;
}

.itwp-filter {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    font-size: 14px;
    min-width: 150px;
    height: 38px;
    line-height: 1.5;
    transition: border-color 0.3s;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.itwp-filter:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.1);
}

.itwp-filter-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
}

.itwp-refresh-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    transition: all 0.3s;
    color: #555;
}

.itwp-refresh-btn:hover {
    background: #f0f0f0;
    border-color: #0073aa;
    color: #0073aa;
}

.itwp-refresh-btn:active {
    transform: rotate(180deg);
}

.itwp-refresh-btn:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.1);
}

.itwp-refresh-btn svg {
    transition: transform 0.3s;
}

.itwp-refresh-btn.spinning svg {
    animation: spin 0.5s linear;
}

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

.itwp-search-input {
    padding: 0.5rem 2.5rem 0.5rem 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    min-width: 250px;
    height: 38px;
    line-height: 1.5;
    transition: all 0.3s;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.itwp-search-input:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.1);
}

.itwp-search-icon {
    position: absolute;
    right: 1rem;
    font-size: 18px;
    opacity: 0.5;
    pointer-events: none;
}

/* Rezultati */
#itwp-results-container {
    min-height: 100px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

#itwp-results-container .itwp-gantt-wrap {
    min-width: 100%;
}

/* Horizontal scroll only for tablet and mobile */
@media screen and (max-width: 1024px) {
    #itwp-results-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    #itwp-results-container .itwp-gantt-wrap {
        width: max-content;
    }
}

.itwp-results-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    color: #666;
    font-size: 16px;
    min-height: 200px;
    padding: 2rem;
}

.itwp-error {
    color: #d63638;
    text-align: center;
    font-size: 16px;
    padding: 2rem;
}

/* Status badge za filterirane rezultate */
.itwp-status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.itwp-status-u-toku {
    background: #fff3cd;
    color: #856404;
}

.itwp-status-realizovano {
    background: #d4edda;
    color: #155724;
}

/* ==========================================================================
   Page Length Selector & Print Button (v2.8.27)
   ========================================================================== */

.itwp-page-length-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 14px;
    color: #333;
    font-weight: 500;
    white-space: nowrap;
}

.itwp-page-length-select {
    min-width: 70px !important;
    width: auto !important;
}

.itwp-print-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0 1rem;
    height: 38px;
    border: 1px solid #2271b1;
    border-radius: 4px;
    background: linear-gradient(to bottom, #2271b1, #135e96);
    color: #fff;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
    font-weight: 500;
    text-shadow: 0 -1px 1px rgba(0,0,0,0.2);
    white-space: nowrap;
}

.itwp-print-btn:hover {
    background: linear-gradient(to bottom, #135e96, #0a4d7a);
    border-color: #0a4d7a;
}

.itwp-print-btn:active {
    background: #0a4d7a;
    box-shadow: inset 0 2px 0 rgba(0,0,0,0.1);
}

.itwp-print-btn:focus {
    outline: none;
    border-color: #0a4d7a;
    box-shadow: 0 0 0 2px rgba(34, 113, 177, 0.3);
}

.itwp-print-btn svg {
    flex-shrink: 0;
}

/* ==========================================================================
   Pagination Styles (v2.8.27)
   ========================================================================== */

.itwp-pagination-wrap {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-top: 1rem;
    padding: 0.75rem 0;
    gap: 0.5rem;
}

.itwp-pagination-info {
    font-size: 14px;
    color: #666;
    margin-right: 1rem;
}

.itwp-pagination-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    color: #333;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.itwp-pagination-btn:hover {
    background: #f0f0f0;
    border-color: #0073aa;
    color: #0073aa;
}

.itwp-pagination-btn.active {
    background: #0073aa;
    border-color: #0073aa;
    color: #fff;
}

.itwp-pagination-btn:disabled,
.itwp-pagination-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.itwp-pagination-ellipsis {
    padding: 0 0.5rem;
    color: #666;
}

/* ==========================================================================
   Checkbox "Samo aktivni zadaci" (v2.9.00)
   ========================================================================== */
.itwp-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 14px;
    color: #333;
    cursor: pointer;
    white-space: nowrap;
    padding: 0.5rem 0;
}

.itwp-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #0073aa;
}

.itwp-checkbox-label span {
    user-select: none;
}

/* ==========================================================================
   "Samo aktivni" mode - Hide columns 5, 7, 8 and inactive rows
   ========================================================================== */
.itwp-active-only-mode .itwp-col-predvidjeno,
.itwp-active-only-mode .itwp-col-odstupanje,
.itwp-active-only-mode .itwp-col-zavrseno,
.itwp-active-only-mode th:nth-child(5),
.itwp-active-only-mode td:nth-child(5),
.itwp-active-only-mode th:nth-child(7),
.itwp-active-only-mode td:nth-child(7),
.itwp-active-only-mode th:nth-child(8),
.itwp-active-only-mode td:nth-child(8) {
    display: none !important;
}

/* Hide inactive rows (not started or finished) */
.itwp-active-only-mode .itwp-row-inactive {
    display: none !important;
}

/* ==========================================================================
   Separator Row (v2.9.00)
   Header red pre zadataka svake stavke - identičan glavnom header-u
   ========================================================================== */
.itwp-separator-row {
    background: #f0f0f0 !important;
}

.itwp-separator-row th {
    padding: 5px 5px !important;
    text-align: center !important;
    font-weight: bold !important;
    border-bottom: 2px solid #ddd !important;
    background: #4e4a4aff !important;
}

/* ==========================================================================
   Hidden Status Column (v2.9.00)
   Kolona Status je sakrivena ali ostaje u kodu za buducu upotrebu
   ========================================================================== */
.itwp-status-column {
    display: none !important;
    width: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    visibility: hidden !important;
}

/* ==========================================================================
   Print Styles - A4 Landscape (v2.8.27)
   ========================================================================== */

@media print {
    /* Hide non-printable elements */
    .itwp-filter-container,
    .itwp-pagination-wrap,
    .itwp-status-column,
    .itwp-separator-row,
    .itwp-separator-row th,
    tr.itwp-separator-row,
    tr.itwp-separator-row th,
    .itwp-gantt-table .itwp-separator-row,
    .itwp-gantt-table tr.itwp-separator-row,
    .itwp-gantt-table th:last-child,
    .itwp-gantt-table td:last-child {
        display: none !important;
        visibility: hidden !important;
        height: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
        border: none !important;
    }
    
    /* Page setup - A4 Landscape with minimal margins */
    @page {
        size: A4 landscape;
        margin: 5mm;
    }
    
    /* Page break AFTER each Stavka row (not before) */
    .itwp-stavka-row {
        page-break-after: always;
        break-after: page;
    }
    
    /* Last stavka row should not have page break */
    tbody tr.itwp-stavka-row:last-child {
        page-break-after: avoid;
        break-after: avoid;
    }
    
    /* Keep task and step rows together */
    .itwp-zadatak-row,
    .itwp-korak-row {
        page-break-before: avoid;
        break-before: avoid;
        page-break-after: avoid;
        break-after: avoid;
    }
    
    /* Full width table for print */
    .itwp-gantt-wrap {
        width: 100% !important;
        max-width: none !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    
    .itwp-gantt-table {
        width: 100% !important;
        font-size: 10pt !important;
        border-collapse: collapse !important;
    }
    
    /* Header styling - black text on white background with borders */
    .itwp-gantt-table th {
        padding: 6px 8px !important;
        border: 1px solid black !important;
        background: white !important;
        color: black !important;
        font-weight: bold !important;
        text-align: center !important;
        font-size: 10pt !important;
    }
    
    /* All cells - white background, black text, black borders */
    .itwp-gantt-table td {
        padding: 4px 6px !important;
        border: 1px solid black !important;
        background: white !important;
        color: black !important;
        text-align: center !important;
    }
    
    /* Stavka rows - bold text, same font size as header */
    .itwp-stavka-row td {
        font-weight: bold !important;
        font-size: 10pt !important;
        background: white !important;
        color: black !important;
    }
    
    /* Left align for Stavka/Zadatak/Korak column (2nd column) */
    .itwp-gantt-table th:nth-child(2),
    .itwp-gantt-table td:nth-child(2) {
        text-align: left !important;
        padding-left: 8px !important;
    }
    
    /* Left align for Odgovorno lice column (3rd column) */
    .itwp-gantt-table th:nth-child(3),
    .itwp-gantt-table td:nth-child(3) {
        text-align: left !important;
        padding-left: 8px !important;
    }
    
    /* Remove all color classes for print - force white background and black text */
    .itwp-stavka-td,
    .itwp-zadatak-td,
    .itwp-korak-td,
    [class*="itwp-odstupanje-"],
    [class*="itwp-akumulirano-"],
    [class*="itwp-status-"],
    [class*="itwp-dana-"] {
        background: white !important;
        color: black !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color-adjust: exact !important;
    }
    
    /* Hide body background for cleaner print */
    body {
        background: white !important;
    }
}

/* Responsive Design */
@media (max-width: 1024px) {
    .itwp-filter-container {
        flex-direction: column;
        align-items: stretch;
    }
    
    .itwp-filters-left {
        width: 100%;
    }
    
    .itwp-filter-right {
        width: 100%;
        justify-content: flex-end;
        flex-wrap: wrap;
    }
    
    .itwp-search-input {
        width: 100%;
    }
    
    /* Reduce header font size on tablet - match task row font size */
    .itwp-gantt-table th,
    .itwp-separator-row th {
        font-size: 14px !important;
    }
}

@media (max-width: 768px) {
    .itwp-filter {
        width: 100%;
        min-width: unset;
    }
    
    .itwp-search-input {
        min-width: unset;
    }
    
    .itwp-page-length-label {
        width: 100%;
        justify-content: flex-start;
    }
    
    .itwp-print-btn {
        flex: 1;
    }
    
    /* Reduce header font size on mobile - match task row font size */
    .itwp-gantt-table th,
    .itwp-separator-row th {
        font-size: 14px !important;
    }
}

@media (max-width: 480px) {
    .itwp-filter-wrapper {
        padding: 0 0.5rem;
    }
    
    .itwp-filters-left {
        gap: 0.5rem;
    }
    
    .itwp-filter-right {
        gap: 0.5rem;
    }
}
