/* Tally Plugin - Pagination, Delete Button and Search Styles */

/* Prevent horizontal overflow */
* {
    box-sizing: border-box;
}

body {
    overflow-x: hidden;
}

/* Ensure containers don't exceed viewport width */
.search-container,
.pagination-info,
.pagination-controls,
.per-page-controls {
    max-width: 100%;
    overflow-x: hidden;
}

/* Search Form Styles */
.search-container {
    margin: 20px 0;
    padding: 25px;
    background: linear-gradient(145deg, #2A2A2A, #1E1E1E);
    border-radius: 15px;
    border: 2px solid #4CAF50;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.search-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(76, 175, 80, 0.1), transparent);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

.search-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: relative;
    z-index: 1;
}

.search-input-group {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    background: rgba(0, 0, 0, 0.2);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid rgba(76, 175, 80, 0.3);
    backdrop-filter: blur(10px);
}

.search-input-group label {
    color: #4CAF50;
    font-family: 'Cascadia Code', 'Fira Code', monospace;
    font-size: 18px;
    font-weight: 700;
    text-shadow: 
        0 1px 2px rgba(0, 0, 0, 0.8),
        0 0 10px rgba(76, 175, 80, 0.3);
    white-space: nowrap;
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-input-group label::before {
    content: '🔍';
    font-size: 16px;
    animation: pulse 2s infinite;
}

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

.search-input {
    flex: 1;
    min-width: 250px;
    padding: 15px 20px;
    background: linear-gradient(145deg, #1E1E1E, #2A2A2A);
    color: #FFFFFF;
    border: 2px solid #4CAF50;
    border-radius: 12px;
    font-family: 'Cascadia Code', 'Fira Code', monospace;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    position: relative;
}

.search-input::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent, rgba(76, 175, 80, 0.1), transparent);
    border-radius: 12px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.search-input:focus::before {
    opacity: 1;
}

.search-input:focus {
    outline: none;
    border-color: #66BB6A;
    box-shadow: 
        0 0 20px rgba(76, 175, 80, 0.4),
        0 8px 25px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transform: translateY(-2px) scale(1.02);
}

.search-input::placeholder {
    color: #888;
    font-style: italic;
    transition: all 0.3s ease;
}

.search-input:focus::placeholder {
    color: #aaa;
    transform: translateX(5px);
}

.search-btn {
    background: linear-gradient(145deg, #4CAF50, #45A049);
    color: #FFFFFF;
    border: none;
    padding: 15px 25px;
    border-radius: 12px;
    font-family: 'Cascadia Code', 'Fira Code', monospace;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        0 6px 20px rgba(76, 175, 80, 0.3),
        0 2px 8px rgba(0, 0, 0, 0.4);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
    position: relative;
    overflow: hidden;
    min-width: 120px;
}

.search-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.search-btn:hover::before {
    left: 100%;
}

.search-btn:hover {
    background: linear-gradient(145deg, #66BB6A, #4CAF50);
    transform: translateY(-3px) scale(1.05);
    box-shadow: 
        0 10px 30px rgba(76, 175, 80, 0.4),
        0 4px 15px rgba(0, 0, 0, 0.5);
}

.search-btn:active {
    transform: translateY(-1px) scale(1.02);
    box-shadow: 
        0 4px 15px rgba(76, 175, 80, 0.3),
        0 2px 8px rgba(0, 0, 0, 0.4);
}

.clear-search-btn {
    background: linear-gradient(145deg, #E94560, #D32F2F);
    color: #FFFFFF;
    text-decoration: none;
    padding: 15px 25px;
    border-radius: 12px;
    font-family: 'Cascadia Code', 'Fira Code', monospace;
    font-size: 16px;
    font-weight: 700;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        0 6px 20px rgba(233, 69, 96, 0.3),
        0 2px 8px rgba(0, 0, 0, 0.4);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
    display: inline-block;
    position: relative;
    overflow: hidden;
    min-width: 120px;
    text-align: center;
}

.clear-search-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.clear-search-btn:hover::before {
    left: 100%;
}

.clear-search-btn:hover {
    background: linear-gradient(145deg, #FF5722, #E94560);
    transform: translateY(-3px) scale(1.05);
    box-shadow: 
        0 10px 30px rgba(233, 69, 96, 0.4),
        0 4px 15px rgba(0, 0, 0, 0.5);
    color: #FFFFFF;
    text-decoration: none;
}

.clear-search-btn:active {
    transform: translateY(-1px) scale(1.02);
    box-shadow: 
        0 4px 15px rgba(233, 69, 96, 0.3),
        0 2px 8px rgba(0, 0, 0, 0.4);
}

.search-info {
    color: #E94560;
    font-weight: bold;
    font-style: italic;
    background: rgba(233, 69, 96, 0.1);
    padding: 8px 15px;
    border-radius: 8px;
    border-left: 4px solid #E94560;
    margin-top: 10px;
    display: inline-block;
    animation: fadeIn 0.5s ease;
}

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

@media (max-width: 768px) {
    .search-container {
        margin: 15px 10px;
        padding: 15px;
    }
    
    .search-input-group {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
        padding: 15px;
    }
    
    .search-input-group label {
        font-size: 16px;
        text-align: center;
    }
    
    .search-input {
        min-width: auto;
        width: 100%;
        padding: 12px 15px;
        font-size: 14px;
    }
    
    .search-btn,
    .clear-search-btn {
        width: 100%;
        text-align: center;
        padding: 12px 20px;
        font-size: 14px;
    }
    
    .pagination-controls {
        gap: 3px;
        padding: 15px 10px;
        margin: 15px 10px;
    }
    
    .pagination-btn {
        padding: 6px 8px;
        font-size: 12px;
        min-width: 30px;
    }
    
    .per-page-controls {
        flex-direction: column;
        gap: 5px;
        padding: 15px 10px;
        margin: 15px 10px;
    }
    
    .pagination-info {
        margin: 15px 10px;
        padding: 15px;
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .search-container {
        margin: 10px 5px;
        padding: 10px;
    }
    
    .search-input-group {
        padding: 10px;
        gap: 10px;
    }
    
    .search-input-group label {
        font-size: 14px;
    }
    
    .search-input {
        padding: 10px 12px;
        font-size: 13px;
    }
    
    .search-btn,
    .clear-search-btn {
        padding: 10px 15px;
        font-size: 13px;
    }
    
    .pagination-controls {
        padding: 10px 5px;
        margin: 10px 5px;
        gap: 2px;
    }
    
    .pagination-btn {
        padding: 4px 6px;
        font-size: 11px;
        min-width: 25px;
    }
    
    .per-page-controls {
        padding: 10px 5px;
        margin: 10px 5px;
    }
    
    .pagination-info {
        margin: 10px 5px;
        padding: 10px;
        font-size: 14px;
    }
}

/* Delete Document Button Styles */
.delete-document-btn {
    background-color: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
}

/* Row removal animation */
tr[id^="row-"] {
    transition: all 0.3s ease;
}

tr[id^="row-"].removing {
    opacity: 0;
    transform: translateX(-100%);
    background-color: rgba(220, 53, 69, 0.1);
}

.delete-document-btn:hover {
    background-color: #c82333;
    transform: scale(1.05);
}

.delete-document-btn:active {
    transform: scale(0.95);
}

.delete-document-btn i {
    font-size: 14px;
}

.delete-document-btn:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
    transform: none;
}

.delete-document-btn:disabled:hover {
    background-color: #6c757d;
    transform: none;
}

/* Confirmation Modal Styles */
.delete-confirmation-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

.delete-confirmation-content {
    background-color: #2A2A2A;
    margin: 15% auto;
    padding: 20px;
    border: 2px solid #E94560;
    border-radius: 8px;
    width: 90%;
    max-width: 400px;
    color: #E0E0E0;
    font-family: 'Cascadia Code', 'Fira Code', monospace;
}

.delete-confirmation-header {
    color: #E94560;
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 15px;
    text-align: center;
}

.delete-confirmation-message {
    margin-bottom: 20px;
    line-height: 1.5;
}

.delete-confirmation-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.delete-confirm-btn {
    background-color: #dc3545;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s ease;
}

.delete-confirm-btn:hover {
    background-color: #c82333;
}

.delete-cancel-btn {
    background-color: #6c757d;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s ease;
}

.delete-cancel-btn:hover {
    background-color: #5a6268;
}

/* Loading Spinner */
.delete-loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #E94560;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

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

/* Success/Error Messages */
.delete-message {
    padding: 10px;
    margin: 10px 0;
    border-radius: 4px;
    font-weight: bold;
    text-align: center;
}

.delete-message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.delete-message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Pagination Styles */
.pagination-info {
    background: linear-gradient(145deg, #2A2A2A, #1E1E1E);
    padding: 20px 25px;
    margin: 25px auto;
    border-radius: 15px;
    border: 2px solid #4CAF50;
    color: #4CAF50;
    font-family: 'Cascadia Code', 'Fira Code', monospace;
    font-size: 18px;
    font-weight: 700;
    text-align: center;
    width: fit-content;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.4),
        0 0 20px rgba(76, 175, 80, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    text-shadow: 
        0 2px 4px rgba(0, 0, 0, 0.8),
        0 0 10px rgba(76, 175, 80, 0.3);
    position: relative;
    overflow: hidden;
}

.pagination-info::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(76, 175, 80, 0.1), transparent);
    animation: shimmer 4s infinite;
}

.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin: 30px auto;
    flex-wrap: wrap;
    width: 100%;
    max-width: 800px;
    padding: 20px;
    background-color: #1A1A1A;
    border-radius: 10px;
    border: 2px solid #333;
}

.pagination-btn {
    display: inline-block;
    padding: 10px 16px;
    background: linear-gradient(145deg, #2A2A2A, #1E1E1E);
    color: #FFFFFF;
    text-decoration: none;
    border: 2px solid #4CAF50;
    border-radius: 8px;
    transition: all 0.3s ease;
    font-family: 'Cascadia Code', 'Fira Code', monospace;
    font-size: 14px;
    font-weight: 600;
    min-width: 45px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.pagination-btn:hover {
    background: linear-gradient(145deg, #4CAF50, #45A049);
    color: #1E1E1E;
    border-color: #66BB6A;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(76, 175, 80, 0.3);
}

.pagination-btn.current {
    background: linear-gradient(145deg, #E94560, #D32F2F);
    color: #FFFFFF;
    border-color: #FF5722;
    font-weight: bold;
    box-shadow: 0 4px 8px rgba(233, 69, 96, 0.4);
}

.pagination-btn.prev,
.pagination-btn.next {
    background: linear-gradient(145deg, #16213E, #0D1421);
    color: #E94560;
    border-color: #E94560;
    font-weight: bold;
}

.pagination-btn.prev:hover,
.pagination-btn.next:hover {
    background: linear-gradient(145deg, #E94560, #D32F2F);
    color: #FFFFFF;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(233, 69, 96, 0.4);
}

.pagination-ellipsis {
    padding: 8px 4px;
    color: #666;
    font-family: 'Cascadia Code', 'Fira Code', monospace;
}

.per-page-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin: 20px auto;
    padding: 15px 25px;
    background: linear-gradient(145deg, #2A2A2A, #1E1E1E);
    border-radius: 10px;
    border: 2px solid #4CAF50;
    width: fit-content;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.per-page-controls label {
    color: #4CAF50;
    font-family: 'Cascadia Code', 'Fira Code', monospace;
    font-size: 16px;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.per-page-controls select {
    background: linear-gradient(145deg, #1E1E1E, #2A2A2A);
    color: #FFFFFF;
    border: 2px solid #4CAF50;
    border-radius: 8px;
    padding: 8px 15px;
    font-family: 'Cascadia Code', 'Fira Code', monospace;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

.per-page-controls select option {
    background: #2A2A2A;
    color: #FFFFFF;
    padding: 10px;
    border: none;
}

.per-page-controls select option:hover {
    background: #4CAF50;
    color: #1E1E1E;
}

.per-page-controls select option:checked {
    background: #4CAF50;
    color: #1E1E1E;
    font-weight: bold;
}

.per-page-controls select:focus {
    outline: none;
    border-color: #66BB6A;
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.3);
    transform: translateY(-1px);
}

.per-page-controls select:hover {
    border-color: #66BB6A;
    transform: translateY(-1px);
}

/* Dodatkowe style dla dropdown */
.per-page-controls select::-ms-expand {
    display: none;
}

.per-page-controls select::-webkit-scrollbar {
    width: 8px;
}

.per-page-controls select::-webkit-scrollbar-track {
    background: #1E1E1E;
    border-radius: 4px;
}

.per-page-controls select::-webkit-scrollbar-thumb {
    background: #4CAF50;
    border-radius: 4px;
}

.per-page-controls select::-webkit-scrollbar-thumb:hover {
    background: #66BB6A;
}

/* Fallback dla starszych przeglądarek */
.per-page-controls select option {
    background-color: #2A2A2A !important;
    color: #FFFFFF !important;
}

.per-page-controls select option:focus {
    background-color: #4CAF50 !important;
    color: #1E1E1E !important;
}

@media (max-width: 768px) {
    .pagination-controls {
        gap: 3px;
    }
    
    .pagination-btn {
        padding: 6px 8px;
        font-size: 12px;
        min-width: 30px;
    }
    
    .per-page-controls {
        flex-direction: column;
        gap: 5px;
    }
}