/* BestTopPrint - Custom Styles */

/* Toast Notifications */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    min-width: 300px;
    max-width: 500px;
    padding: 16px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 9999;
    transform: translateX(400px);
    opacity: 0;
    transition: all 0.3s ease;
}

.toast-show {
    transform: translateX(0);
    opacity: 1;
}

.toast-icon {
    flex-shrink: 0;
}

.toast-message {
    flex: 1;
    font-size: 14px;
    line-height: 1.5;
}

.toast-close {
    flex-shrink: 0;
    padding: 4px;
    border: none;
    background: transparent;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.toast-close:hover {
    opacity: 1;
}

.toast-success {
    border-left: 4px solid #10b981;
}

.toast-success .toast-icon {
    color: #10b981;
}

.toast-error {
    border-left: 4px solid #ef4444;
}

.toast-error .toast-icon {
    color: #ef4444;
}

.toast-warning {
    border-left: 4px solid #f59e0b;
}

.toast-warning .toast-icon {
    color: #f59e0b;
}

.toast-info {
    border-left: 4px solid #3b82f6;
}

.toast-info .toast-icon {
    color: #3b82f6;
}

/* Dialog Overlay - Professional Design */
.dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998;
    opacity: 0;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.dialog-overlay.dialog-show {
    opacity: 1;
}

.dialog-container {
    background: white;
    border-radius: 16px;
    max-width: 440px;
    width: 90%;
    padding: 32px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    transform: scale(0.95) translateY(20px);
    opacity: 0;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.dialog-show .dialog-container {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* Dialog Icon */
.dialog-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dialog-icon svg {
    width: 32px;
    height: 32px;
}

/* Dialog Types */
.dialog-info .dialog-icon {
    background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
    color: #0284c7;
}

.dialog-warning .dialog-icon {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #d97706;
}

.dialog-danger .dialog-icon {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #dc2626;
}

.dialog-success .dialog-icon {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #059669;
}

/* Dialog Content */
.dialog-content {
    text-align: center;
    margin-bottom: 32px;
}

.dialog-title {
    font-size: 20px;
    font-weight: 600;
    color: #111827;
    margin: 0 0 12px 0;
    line-height: 1.3;
}

.dialog-message {
    font-size: 15px;
    color: #6b7280;
    line-height: 1.6;
    margin: 0;
}

/* Dialog Input */
.dialog-input-wrapper {
    margin-top: 20px;
    text-align: left;
}

.dialog-input {
    width: 100%;
    padding: 12px 16px;
    font-size: 15px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    outline: none;
    transition: all 0.2s;
    background: #f9fafb;
}

.dialog-input:focus {
    border-color: #3b82f6;
    background: white;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.dialog-input-error-state {
    border-color: #ef4444 !important;
    background: #fef2f2 !important;
}

.dialog-input-error-state:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1) !important;
}

.dialog-input-error {
    display: none;
    color: #ef4444;
    font-size: 13px;
    margin-top: 8px;
    font-weight: 500;
}

/* Dialog Actions */
.dialog-actions {
    display: flex;
    gap: 12px;
    justify-content: stretch;
}

.dialog-btn {
    flex: 1;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    outline: none;
}

.dialog-btn-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.dialog-btn-primary:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
    transform: translateY(-1px);
}

.dialog-btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

.dialog-btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.dialog-btn-danger:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
    transform: translateY(-1px);
}

.dialog-btn-danger:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.3);
}

.dialog-btn-secondary {
    background: #f3f4f6;
    color: #374151;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.dialog-btn-secondary:hover {
    background: #e5e7eb;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.dialog-btn-secondary:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Responsive */
@media (max-width: 640px) {
    .dialog-container {
        padding: 24px;
        max-width: 95%;
    }

    .dialog-icon {
        width: 48px;
        height: 48px;
        margin-bottom: 20px;
    }

    .dialog-icon svg {
        width: 28px;
        height: 28px;
    }

    .dialog-title {
        font-size: 18px;
    }

    .dialog-message {
        font-size: 14px;
    }

    .dialog-actions {
        flex-direction: column;
    }

    .dialog-btn {
        width: 100%;
    }
}

/* Legacy Modal Support (for backward compatibility) */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.modal-show {
    opacity: 1;
}

.modal-content {
    background: white;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

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

.modal-header {
    padding: 24px;
    border-bottom: 1px solid #e5e7eb;
    position: relative;
    flex-shrink: 0;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    flex-shrink: 0;
}

.modal-confirm .modal-content {
    max-width: 400px;
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.modal-close:hover {
    opacity: 1;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 14px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    opacity: 0.9;
}

.btn-secondary {
    background: #f3f4f6;
    color: #374151;
}

.btn-secondary:hover {
    background: #e5e7eb;
}

/* Loading Spinner */
.spinner {
    border: 3px solid #f3f4f6;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}

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

/* Product Card */
.product-card {
    transition: transform 0.2s, box-shadow 0.2s;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
}

.product-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
}

/* Product Description - 2 line limit with tooltip and fixed height */
.product-description {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
    min-height: 42px; /* Fixed height for 2 lines (14px * 1.4 * 2 ≈ 39.2px + padding) */
    position: relative;
    cursor: default;
    margin-bottom: 1rem;
}

.product-description.has-tooltip:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    line-height: 1.4;
    white-space: pre-wrap;
    word-wrap: break-word;
    z-index: 1000;
    margin-bottom: 8px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
    pointer-events: none;
    max-width: 100%;
    transform: translateZ(0); /* Tworzy nowy kontekst stosowania, aby uniknąć przycinania */
    overflow: visible !important;
}

.product-description.has-tooltip:hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 20px;
    border: 6px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.9);
    margin-bottom: -4px;
    z-index: 1001;
    pointer-events: none;
    transform: translateZ(0); /* Tworzy nowy kontekst stosowania, aby uniknąć przycinania */
}

/* Admin Gradient */
.admin-gradient {
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* Walidacja formularzy */
.field-error {
    display: block;
    color: #dc2626;
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

input.error,
select.error,
textarea.error {
    border-color: #dc2626 !important;
    background-color: #fef2f2 !important;
}

input.error:focus,
select.error:focus,
textarea.error:focus {
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1) !important;
}

/* Success styling for valid fields */
input.success,
select.success,
textarea.success {
    border-color: #10b981 !important;
    background-color: #f0fdf4 !important;
}

input.success:focus,
select.success:focus,
textarea.success:focus {
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1) !important;
}

/* Error styling for invalid fields */
input.error,
select.error,
textarea.error {
    border-color: #dc2626 !important;
    background-color: #fef2f2 !important;
}

input.error:focus,
select.error:focus,
textarea.error:focus {
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1) !important;
}

/* Category Description Styles */
.category-description {
    margin-bottom: 1.5rem;
    transition: all 0.3s ease;
}

.category-description-content {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 1px solid #bae6fd;
    border-radius: 0.75rem;
    padding: 1rem 1.25rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
}

.category-description-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
}

.category-description-icon {
    color: #3b82f6;
    flex-shrink: 0;
    margin-right: 0.75rem;
    margin-top: 0.125rem;
}

.category-description-text {
    color: #1e40af;
    font-size: 0.875rem;
    line-height: 1.5;
    font-weight: 400;
    letter-spacing: -0.01em;
}

.category-description-text p {
    margin: 0;
}

.category-description-text p + p {
    margin-top: 0.5rem;
}

/* Animation for description appearance */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.category-description.show {
    animation: fadeInUp 0.3s ease-out;
}

/* 2FA Code Input */
.twofa-digit {
    width: 48px;
    height: 56px;
    text-align: center;
    font-size: 24px;
    font-weight: 600;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    background: #f9fafb;
    outline: none;
    transition: all 0.2s;
    font-family: monospace;
}

.twofa-digit:focus {
    border-color: #6366f1;
    background: white;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.twofa-digit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Shake animation for errors */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-8px); }
    20%, 40%, 60%, 80% { transform: translateX(8px); }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .category-description-content {
        padding: 0.875rem 1rem;
    }
    
    .category-description-text {
        font-size: 0.8125rem;
    }
}

/* ========================================
   DESKTOP STICKY SIDEBAR
   Sticky sidebar for admin panel on desktop
   ======================================== */

@media only screen and (min-width: 1025px) {

    /* Sticky sidebar for desktop - only when sidebar fits on screen */
    aside.w-64 {
        position: sticky;
        top: 156px; /* Height of header (72px) + filters (64px) + spacing (20px) */
        align-self: flex-start; /* Align to top of flex container */
        max-height: calc(100vh - 156px); /* Maximum height minus header and filters */
        overflow-y: auto; /* Enable scrolling if content is too long */
    }

    /* Sticky sidebar on product page - adjust for header + breadcrumb */
    body.product-page aside.w-64 {
        top: 144px; /* Header (72px) + breadcrumb/filters (72px) */
        max-height: calc(100vh - 144px);
    }
    
    /* Ensure sidebar content is scrollable when needed */
    aside.w-64 nav {
        max-height: 100%;
        overflow-y: auto;
    }
    
    /* Custom scrollbar for sidebar */
    aside.w-64 nav::-webkit-scrollbar {
        width: 4px;
    }
    
    aside.w-64 nav::-webkit-scrollbar-track {
        background: #f8fafc;
    }
    
    aside.w-64 nav::-webkit-scrollbar-thumb {
        background: #cbd5e1;
        border-radius: 2px;
    }
    
    aside.w-64 nav::-webkit-scrollbar-thumb:hover {
        background: #94a3b8;
    }
}

/* ========================================
   STICKY TABS FOR PRODUCT FEATURES
   Sticky tabs on product-features.php page
   ======================================== */

@media only screen and (min-width: 1025px) {
    
    /* Sticky tabs container for product features page */
    .product-features-tabs {
        position: sticky;
        top: 6.4rem; 
        z-index: 30;
        background: white;
        padding-top: 1rem;
        padding-bottom: 1rem;
        margin-top: -1rem;
        border-bottom: 1px solid #e5e7eb;
    }
    

    .product-features-tabs nav {
        background: white;
        padding: 0.5rem 0;
    }
}

/* ========================================
   STICKY TABS FOR PRODUCT FEATURES (Mobile)
   ======================================== */

@media only screen and (max-width: 1024px) {
    
    /* Sticky tabs for mobile - always visible */
    .product-features-tabs {
        position: sticky;
        top: 6.4rem; 
        z-index: 30;
        background: white;
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
        margin-top: -0.5rem;
        border-bottom: 1px solid #e5e7eb;
    }
    

    .product-features-tabs nav {
        background: white;
        padding: 0.25rem 0;
        overflow-x: auto;
        white-space: nowrap;
    }
    
    /* Hide scrollbar for tabs on mobile */
    .product-features-tabs nav::-webkit-scrollbar {
        display: none;
    }
    
    .product-features-tabs nav {
        -ms-overflow-style: none;
        scrollbar-width: none;
    }
}

/* ========================================
   STICKY FILTERS FOR COMBINATIONS
   Sticky filters on combinations.php page
   ======================================== */

@media only screen and (min-width: 1025px) {
    
    /* Sticky filters container for combinations page */
    .combinations-filters {
        position: sticky;
        top: 6.4rem; 
        z-index: 30;
        background: white;
        padding-top: 1rem;
        padding-bottom: 1rem;
        margin-top: -1rem;
        border-bottom: 1px solid #e5e7eb;
    }
    

    .combinations-filters .bg-white {
        background: white;
        padding: 0.5rem 0;
    }
}

/* ========================================
   STICKY FILTERS FOR COMBINATIONS (Mobile)
   ======================================== */

@media only screen and (max-width: 1024px) {
    
    /* Sticky filters for mobile - always visible */
    .combinations-filters {
        position: sticky;
        top: 6.4rem; 
        z-index: 30;
        background: white;
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
        margin-top: -0.5rem;
        border-bottom: 1px solid #e5e7eb;
    }
    
    .combinations-filters .bg-white {
        background: white;
        padding: 0.25rem 0;
    }
    
    /* Responsive layout for filters on mobile */
    .combinations-filters .flex {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .combinations-filters .flex > div {
        width: 100%;
    }
    
    .combinations-filters .flex-1 {
        flex: none;
    }
    
    .combinations-filters .flex.items-center {
        justify-content: space-between;
    }
    
    .combinations-filters .flex.items-center.gap-2 {
        gap: 0.5rem;
    }
}

/* ========================================
   CUSTOM SCROLLBAR STYLES
   Stylizowany scrollbar dla zakładek i innych elementów
   ======================================== */

/* Dla przeglądarek WebKit (Chrome, Safari, Edge) */
.scrollbar-thin::-webkit-scrollbar {
    height: 6px;
}

.scrollbar-thin::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.scrollbar-thin::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
    transition: background 0.2s ease;
}

.scrollbar-thin::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.scrollbar-thumb-gray-300::-webkit-scrollbar-thumb {
    background: #d1d5db;
}

.scrollbar-track-gray-100::-webkit-scrollbar-track {
    background: #f3f4f6;
}

/* Dla Firefox */
.scrollbar-thin {
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f1f5f9;
}

.scrollbar-thumb-gray-300 {
    scrollbar-color: #d1d5db #f3f4f6;
}

.scrollbar-track-gray-100 {
    scrollbar-color: #cbd5e1 #f3f4f6;
}

/* Smooth scrolling dla zakładek */
.product-features-tabs nav {
    scroll-behavior: smooth;
}

/* Gradient overlay dla lepszego UX */
.scroll-gradient-overlay {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 20px;
    background: linear-gradient(to left, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0));
    pointer-events: none;
    z-index: 10;
}

/* Custom scrollbar dla zakładek */
.custom-scrollbar {
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f1f5f9;
}

.custom-scrollbar::-webkit-scrollbar {
    height: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
    transition: background 0.2s ease;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Stylizowany scrollbar dla zakładek */
#zakladki-nav::-webkit-scrollbar {
    height: 6px;
}

#zakladki-nav::-webkit-scrollbar-track {
    background: #f3f4f6;
    border-radius: 3px;
}

#zakladki-nav::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
    transition: background 0.2s ease;
}

#zakladki-nav::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Dla Firefox */
#zakladki-nav {
    scrollbar-width: thin;
    scrollbar-color: #d1d5db #f3f4f6;
}

/* Responsywny scroll dla zakładek */
@media (max-width: 768px) {
    .product-features-tabs nav {
        padding-bottom: 4px;
    }
    
    .scrollbar-thin::-webkit-scrollbar {
        height: 4px;
    }
}

/* Wyłącz CSSowe tooltipy, ponieważ używamy JavaScriptowych tooltipów */
.product-description.has-tooltip:hover::after,
.product-description.has-tooltip:hover::before {
    display: none !important;
    content: none !important;
}

/* ========================================
   STICKY HEADER FOR PRODUCT PAGE
   ======================================== */
.sticky-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: white;
}

/* ========================================
   STICKY BREADCRUMB WITH FILTERS FOR PRODUCT PAGE
   ======================================== */
@media only screen and (min-width: 1025px) {
    body.product-page .breadcrumb-filters-sticky {
        position: sticky;
        top: 72px; /* Height of header */
        z-index: 40;
        background: white;
        padding: 1rem 0;
        margin: -1rem 0 1rem 0;
        border-bottom: 1px solid #e5e7eb;
    }
}
