/* 
 * PROSTY CSS - AMATORSKI LAYOUT
 * Na razie funkcjonalność > wygląd
 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background: #f0f0f0;
    color: #333;
    line-height: 1.6;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    background: #333;
    color: white;
    padding: 20px 0;
    margin-bottom: 30px;
}

header .container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

header .header-top {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

header h1 {
    font-size: 24px;
}

/* Wyszukiwarka */
.search-form {
    display: flex;
    gap: 10px;
    flex: 1;
    max-width: 500px;
    position: relative;
    z-index: 1000; /* NAD overlay (998) */
}

/* Overlay - przyciemnienie i rozmycie tła */
.search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 998; /* Pod wyszukiwarką (1000) */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.search-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Autocomplete dropdown */
.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 60px;
    background: white;
    border: 1px solid #e0e0e0;
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 500px;
    overflow-y: auto;
    box-shadow: 0 8px 16px rgba(0,0,0,0.15);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.25s ease, visibility 0.25s ease, transform 0.25s ease;
}

.search-results.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.search-result-item {
    padding: 14px 18px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: background 0.15s ease;
    text-decoration: none;
    color: inherit;
}

.search-result-item:hover {
    background: #f8f9fa;
}

.search-result-item:last-child {
    border-bottom: none;
    border-radius: 0 0 8px 8px;
}

.search-result-item:first-child:hover {
    border-radius: 0;
}

.search-result-image {
    width: 55px;
    height: 55px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
    flex-shrink: 0;
}

.search-result-info {
    flex: 1;
    min-width: 0;
}

.search-result-name {
    font-weight: 500;
    color: #202124;
    margin-bottom: 4px;
    font-size: 15px;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-result-price {
    color: #137333;
    font-weight: 600;
    font-size: 14px;
}

.search-result-stock {
    color: #5f6368;
    font-size: 13px;
    margin-left: 8px;
}

.search-no-results {
    padding: 32px 20px;
    text-align: center;
    color: #5f6368;
    font-size: 14px;
}

.search-input {
    flex: 1;
    padding: 11px 16px;
    border: 1px solid transparent;
    border-radius: 5px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-input:focus {
    border-color: #4CAF50;
    box-shadow: 0 1px 6px rgba(76, 175, 80, 0.2);
}

.search-input.has-results {
    border-radius: 5px 5px 0 0;
    border-bottom: 1px solid #e0e0e0;
}

.search-button {
    padding: 10px 20px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s;
}

.search-button:hover {
    background: #45a049;
}

header nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

header nav a {
    color: white;
    text-decoration: none;
    padding: 8px 15px;
    background: #555;
    border-radius: 3px;
}

header nav a:hover {
    background: #777;
}

/* Flash Messages */
.flash-message {
    padding: 15px 20px;
    margin: 20px 0;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

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

.flash-warning {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
}

.flash-info {
    background: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
}

.flash-icon {
    font-size: 20px;
    margin-right: 10px;
    font-weight: bold;
}

.flash-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: inherit;
    opacity: 0.5;
}

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

/* Forms */
.form-box {
    background: white;
    padding: 30px;
    border-radius: 5px;
    max-width: 500px;
    margin: 50px auto;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.form-box h2 {
    margin-bottom: 20px;
    text-align: center;
    color: #333;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #555;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"] {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 14px;
}

.form-group input:focus {
    outline: none;
    border-color: #4CAF50;
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: #666;
    font-size: 12px;
}

.error-message {
    color: #f44336;
    font-size: 13px;
    margin-top: 5px;
}

/* Buttons */
.btn {
    padding: 12px 25px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: #4CAF50;
    color: white;
}

.btn-primary:hover {
    background: #45a049;
}

.btn-secondary {
    background: #666;
    color: white;
}

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

.btn-full {
    width: 100%;
}

/* Products */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.product-card {
    background: white;
    border-radius: 5px;
    padding: 15px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.product-card img {
    width: 100%;
    border-radius: 3px;
    margin-bottom: 10px;
}

.product-card h3 {
    margin-bottom: 10px;
    font-size: 18px;
}

.product-card .price {
    font-size: 22px;
    color: #4CAF50;
    font-weight: bold;
    margin: 10px 0;
}

.product-card .description {
    color: #666;
    font-size: 14px;
    margin-bottom: 15px;
}

/* Cart */
.cart-table {
    background: white;
    border-radius: 5px;
    padding: 20px;
    margin: 20px 0;
}

.cart-table table {
    width: 100%;
    border-collapse: collapse;
}

.cart-table th,
.cart-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.cart-table th {
    background: #f5f5f5;
    font-weight: bold;
}

.cart-total {
    text-align: right;
    font-size: 20px;
    font-weight: bold;
    margin-top: 20px;
    color: #4CAF50;
}

/* Footer */
footer {
    background: #333;
    color: white;
    text-align: center;
    padding: 20px 0;
    margin-top: 50px;
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.mt-10 {
    margin-top: 10px;
}

.mt-20 {
    margin-top: 20px;
}

.mb-20 {
    margin-bottom: 20px;
}

/* Responsive */
@media (max-width: 768px) {
    header .header-top {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-form {
        max-width: 100%;
    }
    
    header nav {
        justify-content: center;
    }
    
    header nav a {
        flex: 1;
        text-align: center;
        min-width: 120px;
    }
    
    .products-grid {
        grid-template-columns: 1fr;
    }
}