/* Reset i bazowe style */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

/* Główny kontener aplikacji */
.app {
    max-width: 1200px;
    margin: 0 auto;
    min-height: 100vh;
    background: white;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.1);
}

/* Header */
.app-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem;
    text-align: center;
}

.app-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
}

.app-header h1 i {
    margin-right: 0.5rem;
    color: #ffd700;
}

/* Nawigacja zakładek */
.tab-nav {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.tab-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.tab-btn.active {
    background: white;
    color: #667eea;
    border-color: white;
}

.tab-btn i {
    margin-right: 0.5rem;
}

/* Main content */
.app-main {
    padding: 2rem;
}

/* Zakładki */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Formularze */
.add-product-form,
.add-category-form {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.form-header {
    margin-bottom: 1.5rem;
}

.form-header h2 {
    color: #333;
    font-size: 1.5rem;
    font-weight: 600;
}

.form-header h2 i {
    margin-right: 0.5rem;
    color: #667eea;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #555;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Autocomplete */
.autocomplete-container {
    position: relative;
}

.autocomplete-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #e9ecef;
    border-top: none;
    border-radius: 0 0 10px 10px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.autocomplete-suggestion {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid #f1f3f4;
    transition: background-color 0.2s ease;
}

.autocomplete-suggestion:hover {
    background-color: #f8f9fa;
}

.autocomplete-suggestion.selected {
    background-color: #667eea;
    color: white;
}

.autocomplete-suggestion:last-child {
    border-bottom: none;
}

/* Przyciski */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

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

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

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

.btn-secondary:hover {
    background: #545b62;
    transform: translateY(-2px);
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
    transform: translateY(-2px);
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
    transform: translateY(-2px);
}

/* Lista zakupów */
.shopping-list,
.history-header,
.categories-list {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.list-header,
.history-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.list-header h2,
.history-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
}

.list-header h2 i,
.history-header h2 i {
    margin-right: 0.5rem;
    color: #ffd700;
}

.list-stats,
.history-stats {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Elementy listy */
.shopping-items,
.history-items,
.categories-items {
    padding: 1rem;
}

.shopping-category {
    margin-bottom: 1.5rem;
}

.category-header {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0.5rem 0;
    border-bottom: 2px solid #f1f3f4;
}

.category-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    color: white;
    margin-right: 1rem;
}

.category-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
}

.product-item,
.history-item,
.category-item {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.product-item:hover,
.category-item:hover {
    background: #e9ecef;
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

.product-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #28a745;
}

.product-info {
    flex: 1;
}

.product-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 0.25rem;
}

.product-details {
    font-size: 0.9rem;
    color: #666;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.product-quantity,
.product-note {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.product-actions,
.category-actions {
    display: flex;
    gap: 0.5rem;
}

.action-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.action-btn:hover {
    transform: translateY(-2px);
}

.edit-btn {
    background: #ffc107;
    color: #333;
}

.edit-btn:hover {
    background: #e0a800;
}

.delete-btn {
    background: #dc3545;
    color: white;
}

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

/* Historia */
.history-item {
    background: #e8f5e8;
    border-left: 4px solid #28a745;
}

.history-date {
    font-size: 0.8rem;
    color: #666;
    margin-top: 0.25rem;
}

/* Kategorie */
.category-info {
    flex: 1;
}

.category-color-preview {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    margin-right: 1rem;
    border: 2px solid #ddd;
}

/* Stan pusty */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: #666;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state p {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.empty-state small {
    font-size: 0.9rem;
    opacity: 0.7;
}

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

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
}

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

.modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.5rem 2rem;
    border-radius: 15px 15px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.3rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.3s ease;
}

.modal-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.modal form {
    padding: 2rem;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

/* Toast notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 3000;
}

.toast {
    background: white;
    color: #333;
    padding: 1rem 1.5rem;
    border-radius: 10px;
    margin-bottom: 0.5rem;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    max-width: 350px;
    animation: toastSlideIn 0.3s ease-out;
    border-left: 4px solid #28a745;
}

.toast.error {
    border-left-color: #dc3545;
}

.toast.warning {
    border-left-color: #ffc107;
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast i {
    font-size: 1.2rem;
    color: #28a745;
}

.toast.error i {
    color: #dc3545;
}

.toast.warning i {
    color: #ffc107;
}

/* Responsywność */
@media (max-width: 768px) {
    .app-header {
        padding: 1.5rem 1rem;
    }
    
    .app-header h1 {
        font-size: 2rem;
    }
    
    .app-main {
        padding: 1rem;
    }
    
    .add-product-form,
    .add-category-form {
        padding: 1.5rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .tab-nav {
        gap: 0.5rem;
    }
    
    .tab-btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
    
    .list-header,
    .history-header {
        padding: 1rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .product-item,
    .history-item,
    .category-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .product-details {
        width: 100%;
        justify-content: flex-start;
    }
    
    .product-actions,
    .category-actions {
        width: 100%;
        justify-content: flex-end;
    }
    
    .modal-content {
        width: 95%;
        margin: 10% auto;
    }
    
    .modal-header {
        padding: 1rem 1.5rem;
    }
    
    .modal form {
        padding: 1.5rem;
    }
    
    .modal-actions {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .app-header h1 {
        font-size: 1.5rem;
    }
    
    .tab-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }
    
    .form-header h2 {
        font-size: 1.2rem;
    }
    
    .list-header h2,
    .history-header h2 {
        font-size: 1.2rem;
    }
}