/* Kompleksowe poprawki CSS dla lepszego UX/UI */
/* ========================================== */

/* 1. RESET I PODSTAWY */
/* ========================================== */

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 2. ULEPSZENIE RESPONSYWNOŚCI */
/* ========================================== */

@media (max-width: 768px) {
    .ec-header-search {
        padding: 0 15px;
    }
    
    .ec-checkout-wrap {
        padding: 20px 15px;
        margin-bottom: 20px;
    }
    
    .ec-product-inner {
        margin-bottom: 20px;
    }
    
    .container {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    /* Mobile navigation improvements */
    .ec-header-bottom {
        padding: 10px 0;
    }
    
    .header-logo img {
        max-height: 35px;
    }
    
    /* Mobile search */
    .header-search .form-control {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 10px 15px;
    }
    
    /* Touch-friendly buttons */
    .btn, .ec-btn-primary, .add-to-cart {
        min-height: 44px;
        padding: 10px 20px;
    }
}

@media (max-width: 576px) {
    .section-space-p {
        padding: 30px 0;
    }
    
    .ec-product-inner {
        margin-bottom: 15px;
    }
    
    .ec-pro-content {
        padding: 15px 10px;
    }
}

/* 3. LEPSZE ANIMACJE I PRZEJŚCIA */
/* ========================================== */

.ec-product-inner {
    transition: transform 0.3s ease, box-shadow 0.3s ease, opacity 0.3s ease;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

.ec-product-inner:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.15);
}

.ec-pro-image {
    position: relative;
    overflow: hidden;
}

.ec-pro-image img {
    transition: transform 0.4s ease;
    width: 100%;
    height: auto;
}

.ec-product-inner:hover .ec-pro-image img {
    transform: scale(1.05);
}

/* Hover overlay for products */
.ec-pro-image::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(255, 107, 53, 0.1), rgba(247, 147, 30, 0.1));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.ec-product-inner:hover .ec-pro-image::after {
    opacity: 1;
}

/* 4. POPRAWA PRZYCISKÓW */
/* ========================================== */

.btn-primary, .ec-btn-primary, .add-to-cart {
    background: linear-gradient(45deg, #ff6b35, #f7931e);
    border: none;
    transition: all 0.3s ease;
    border-radius: 8px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
}

.btn-primary::before, .ec-btn-primary::before, .add-to-cart::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;
}

.btn-primary:hover::before, .ec-btn-primary:hover::before, .add-to-cart:hover::before {
    left: 100%;
}

.btn-primary:hover, .ec-btn-primary:hover, .add-to-cart:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 107, 53, 0.4);
    background: linear-gradient(45deg, #f7931e, #ff6b35);
}

.btn-primary:active, .ec-btn-primary:active, .add-to-cart:active {
    transform: translateY(0);
}

/* Secondary buttons */
.btn-secondary {
    background: transparent;
    border: 2px solid #ff6b35;
    color: #ff6b35;
    transition: all 0.3s ease;
    border-radius: 8px;
    font-weight: 600;
}

.btn-secondary:hover {
    background: #ff6b35;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.3);
}

/* 5. ULEPSZENIE FORMULARZY */
/* ========================================== */

.form-control {
    border-radius: 8px;
    border: 2px solid #e0e0e0;
    transition: all 0.3s ease;
    padding: 12px 15px;
    font-size: 14px;
    background: #fff;
    position: relative;
}

.form-control:focus {
    border-color: #ff6b35;
    box-shadow: 0 0 0 0.2rem rgba(255, 107, 53, 0.25);
    outline: none;
}

.form-control:hover {
    border-color: #ccc;
}

/* Floating labels effect */
.form-floating {
    position: relative;
}

.form-floating label {
    position: absolute;
    top: 12px;
    left: 15px;
    font-size: 14px;
    color: #999;
    pointer-events: none;
    transition: all 0.3s ease;
}

.form-floating .form-control:focus + label,
.form-floating .form-control:not(:placeholder-shown) + label {
    top: -8px;
    left: 10px;
    font-size: 12px;
    color: #ff6b35;
    background: white;
    padding: 0 5px;
}

/* Custom select styling */
select.form-control {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23333' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px 12px;
}

/* 6. LOADING STATES */
/* ========================================== */

.btn-loading {
    position: relative;
    pointer-events: none;
    color: transparent !important;
}

.btn-loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    margin: auto;
    border: 2px solid transparent;
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 1s ease infinite;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Page loading overlay */
.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 1;
    visibility: visible;
    transition: all 0.3s ease;
}

.page-loader.hidden {
    opacity: 0;
    visibility: hidden;
}

.loader-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #ff6b35;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* 7. LEPSZE POWIADOMIENIA */
/* ========================================== */

.toast-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #28a745;
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    z-index: 9999;
    animation: slideIn 0.3s ease;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    max-width: 350px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast-notification.toast-error {
    background: #dc3545;
}

.toast-notification.toast-warning {
    background: #ffc107;
    color: #000;
}

.toast-notification.toast-info {
    background: #17a2b8;
}

.toast-notification i {
    font-size: 18px;
}

.toast-close {
    margin-left: auto;
    background: none;
    border: none;
    color: currentColor;
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    opacity: 0.7;
}

.toast-close:hover {
    opacity: 1;
}

@keyframes slideIn {
    from { 
        transform: translateX(100%); 
        opacity: 0; 
    }
    to { 
        transform: translateX(0); 
        opacity: 1; 
    }
}

@keyframes slideOut {
    from { 
        transform: translateX(0); 
        opacity: 1; 
    }
    to { 
        transform: translateX(100%); 
        opacity: 0; 
    }
}

/* 8. SEARCH IMPROVEMENTS */
/* ========================================== */

.header-search {
    position: relative;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.search-result-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.search-result-item:hover {
    background-color: #f8f9fa;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-image {
    width: 45px;
    height: 45px;
    object-fit: cover;
    border-radius: 6px;
    margin-right: 12px;
    border: 1px solid #eee;
}

.search-result-info {
    flex: 1;
}

.search-result-name {
    font-weight: 500;
    font-size: 14px;
    color: #333;
    margin-bottom: 2px;
    line-height: 1.3;
}

.search-result-price {
    font-size: 13px;
    color: #ff6b35;
    font-weight: bold;
}

.search-no-results {
    padding: 20px;
    text-align: center;
    color: #666;
    font-style: italic;
}

/* Search loading */
.search-loading {
    padding: 20px;
    text-align: center;
    color: #666;
}

.search-loading::after {
    content: "...";
    animation: dots 1.5s steps(5, end) infinite;
}

@keyframes dots {
    0%, 20% { content: "."; }
    40% { content: ".."; }
    60%, 100% { content: "..."; }
}

/* 9. CART IMPROVEMENTS */
/* ========================================== */

.cart-item {
    transition: all 0.3s ease;
    border-radius: 8px;
    margin-bottom: 10px;
    padding: 15px;
    background: #fff;
    border: 1px solid #f0f0f0;
}

.cart-item:hover {
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.cart-item.removing {
    animation: slideOut 0.3s ease forwards;
    transform: translateX(100%);
    opacity: 0;
}

.quantity-input {
    display: flex;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
    width: 120px;
}

.quantity-btn {
    background: #f8f9fa;
    border: none;
    padding: 8px 12px;
    cursor: pointer;
    transition: background-color 0.2s;
    font-size: 16px;
    line-height: 1;
}

.quantity-btn:hover {
    background: #e9ecef;
}

.quantity-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.quantity-number {
    flex: 1;
    text-align: center;
    border: none;
    padding: 8px 4px;
    font-size: 14px;
    width: 50px;
}

/* Cart total summary */
.cart-summary {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    padding: 20px;
    border-radius: 10px;
    margin-top: 20px;
}

.cart-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding: 8px 0;
}

.cart-summary-row.total {
    border-top: 2px solid #dee2e6;
    padding-top: 15px;
    margin-top: 15px;
    font-weight: bold;
    font-size: 18px;
}

/* 10. PRODUCT IMPROVEMENTS */
/* ========================================== */

.ec-pro-content {
    padding: 15px;
    background: white;
}

.ec-pro-title a {
    color: #333;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
    display: block;
    margin-bottom: 8px;
    line-height: 1.4;
}

.ec-pro-title a:hover {
    color: #ff6b35;
}

.ec-pro-price {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.new-price {
    color: #ff6b35;
    font-weight: bold;
    font-size: 16px;
}

.old-price {
    color: #999;
    text-decoration: line-through;
    font-size: 14px;
}

.discount-badge {
    background: #dc3545;
    color: white;
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold;
}

/* Product rating */
.ec-pro-rating {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 10px;
}

.rating-stars {
    color: #ffc107;
    font-size: 14px;
}

.rating-count {
    color: #666;
    font-size: 12px;
}

/* 11. MOBILE-SPECIFIC IMPROVEMENTS */
/* ========================================== */

@media (max-width: 768px) {
    .toast-notification {
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .search-results {
        border-radius: 0 0 8px 8px;
        max-height: 50vh;
    }
    
    /* Mobile cart */
    .ec-side-cart {
        width: 100% !important;
    }
    
    /* Mobile menu improvements */
    .ec-mobile-menu {
        width: 100% !important;
    }
    
    /* Touch-friendly navigation */
    .ec-nav-panel-icons a {
        min-height: 44px;
        min-width: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* 12. ACCESSIBILITY IMPROVEMENTS */
/* ========================================== */

/* Focus states */
button:focus, 
.btn:focus, 
input:focus, 
select:focus, 
textarea:focus,
a:focus {
    outline: 2px solid #ff6b35;
    outline-offset: 2px;
}

/* Skip link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: #000;
    color: white;
    padding: 8px;
    text-decoration: none;
    border-radius: 4px;
    z-index: 10000;
}

.skip-link:focus {
    top: 6px;
}

/* Screen reader only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* 13. PERFORMANCE OPTIMIZATIONS */
/* ========================================== */

/* Lazy loading placeholder */
img.lazy {
    opacity: 0;
    transition: opacity 0.3s;
}

img.lazy.loaded {
    opacity: 1;
}

.lazy-placeholder {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* 14. DARK MODE SUPPORT */
/* ========================================== */

@media (prefers-color-scheme: dark) {
    .auto-dark {
        background-color: #1a1a1a;
        color: #e0e0e0;
    }
    
    .auto-dark .form-control {
        background-color: #2d2d2d;
        border-color: #444;
        color: #e0e0e0;
    }
    
    .auto-dark .toast-notification {
        background: #2d2d2d;
        color: #e0e0e0;
    }
}

/* 15. PRINT STYLES */
/* ========================================== */

@media print {
    .no-print,
    .ec-header,
    .ec-footer,
    .toast-notification,
    .page-loader {
        display: none !important;
    }
    
    .ec-product-inner {
        break-inside: avoid;
        margin-bottom: 20px;
    }
}

/* 16. ADVANCED ANIMATIONS */
/* ========================================== */

/* Stagger animation for product lists */
.ec-product-inner {
    opacity: 0;
    animation: fadeInUp 0.6s ease forwards;
}

.ec-product-inner:nth-child(1) { animation-delay: 0.1s; }
.ec-product-inner:nth-child(2) { animation-delay: 0.2s; }
.ec-product-inner:nth-child(3) { animation-delay: 0.3s; }
.ec-product-inner:nth-child(4) { animation-delay: 0.4s; }
.ec-product-inner:nth-child(5) { animation-delay: 0.5s; }
.ec-product-inner:nth-child(6) { animation-delay: 0.6s; }

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Pulse animation for new/sale badges */
.new-badge, .sale-badge {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Shake animation for errors */
.shake {
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* 17. CUSTOM SCROLLBARS */
/* ========================================== */

/* Webkit browsers */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(45deg, #ff6b35, #f7931e);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(45deg, #f7931e, #ff6b35);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: #ff6b35 #f1f1f1;
}

/* 18. UTILITY CLASSES */
/* ========================================== */

.text-gradient {
    background: linear-gradient(45deg, #ff6b35, #f7931e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.shadow-sm { box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
.shadow { box-shadow: 0 4px 6px rgba(0,0,0,0.1); }
.shadow-lg { box-shadow: 0 10px 15px rgba(0,0,0,0.1); }

.border-radius-sm { border-radius: 4px; }
.border-radius { border-radius: 8px; }
.border-radius-lg { border-radius: 12px; }

.transition-all { transition: all 0.3s ease; }
.transition-fast { transition: all 0.15s ease; }
.transition-slow { transition: all 0.5s ease; }
