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

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

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

h1, h2, h3 {
    text-align: center;
    margin-bottom: 30px;
    color: #2c3e50;
}

h1 {
    font-size: 2.5em;
}

/* Стили авторизации */
.auth-section {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 25px;
    border-radius: 12px;
    margin-bottom: 30px;
    text-align: center;
}

.auth-form {
    max-width: 400px;
    margin: 0 auto;
}

.register-form {
    display: none;
    margin-top: 20px;
    padding: 20px;
    background: white;
    border-radius: 8px;
    border: 1px solid #ddd;
}

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

label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #495057;
    font-size: 14px;
}

input, select {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}

input:focus, select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0,123,255,0.1);
}

button {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    padding: 15px 30px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: transform 0.2s, box-shadow 0.2s;
    margin: 5px;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,123,255,0.3);
}

.btn-secondary {
    background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%);
}

.user-info {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Основной контент */
.main-content {
    display: none;
}

.form-section {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 25px;
    border-radius: 12px;
    margin-bottom: 30px;
    border: 1px solid #dee2e6;
}

/* Новые стили для банков и категорий */
.banks-categories-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 25px;
}

.banks-list, .categories-list {
    background: white;
    padding: 20px;
    border-radius: 10px;
    border: 2px solid #e9ecef;
    max-height: 300px;
    overflow-y: auto;
}

.banks-list h3, .categories-list h3 {
    margin-bottom: 15px;
    color: #2c3e50;
    font-size: 1.2em;
    text-align: left;
    border-bottom: 2px solid #007bff;
    padding-bottom: 8px;
}

.banks-grid, .categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
}

.bank-item, .category-item {
    background: #f8f9fa;
    padding: 10px 15px;
    border-radius: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    font-size: 14px;
}

.bank-item:hover, .category-item:hover {
    background: #007bff;
    color: white;
    transform: translateY(-2px);
}

.bank-item.selected, .category-item.selected {
    background: #28a745;
    color: white;
    border-color: #1e7e34;
}

.suggestions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.suggestion-chip {
    background: #e9ecef;
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 14px;
    border: 1px solid #ddd;
}

.suggestion-chip:hover {
    background: #007bff;
    color: white;
}

.custom-input {
    display: none;
    gap: 10px;
    margin-top: 10px;
}

.custom-input input {
    flex: 1;
}

.filters {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.filter-group {
    flex: 1;
    min-width: 200px;
}

.bank-group {
    margin-bottom: 30px;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.3s ease;
}

.bank-group:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.bank-header {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: background 0.3s ease;
}

.bank-header:hover {
    background: linear-gradient(135deg, #34495e 0%, #2c3e50 100%);
}

.bank-name {
    font-size: 1.2em;
    font-weight: bold;
}

.bank-cashback-count {
    background: rgba(255,255,255,0.2);
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.9em;
}

.bank-content {
    background: white;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.bank-content.expanded {
    max-height: 2000px;
}

.cashback-item {
    padding: 20px;
    border-bottom: 1px solid #f1f3f4;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
    position: relative;
}

.cashback-item:hover {
    background-color: #f8f9fa;
    transform: translateX(5px);
}

.cashback-item:last-child {
    border-bottom: none;
}

.cashback-info {
    flex: 1;
}

.cashback-category {
    font-weight: bold;
    color: #2c3e50;
    font-size: 1.1em;
    margin-bottom: 5px;
}

.cashback-percent {
    font-size: 1.8em;
    font-weight: bold;
    color: #28a745;
    text-align: right;
    min-width: 80px;
}

.cashback-actions {
    display: flex;
    gap: 10px;
    margin-left: 20px;
}

.btn-delete {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
}

.btn-edit {
    background: linear-gradient(135deg, #ffc107 0%, #e0a800 100%);
    color: #212529;
}

.empty-state {
    text-align: center;
    color: #6c757d;
    padding: 60px 20px;
    font-style: italic;
    font-size: 1.1em;
}

/* Стили для лучших предложений */
.best-offer {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border: 2px solid #28a745;
    border-radius: 8px;
    position: relative;
    animation: pulse 2s infinite;
}

.best-offer::before {
    content: '🔥 ЛУЧШЕЕ ПРЕДЛОЖЕНИЕ';
    position: absolute;
    top: -1px;
    right: 15px;
    background: #28a745;
    color: white;
    padding: 3px 10px;
    border-radius: 15px;
    font-size: 0.7em;
    font-weight: bold;
    z-index: 1;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(40, 167, 69, 0); }
    100% { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0); }
}

.category-highlight {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    border-left: 4px solid #ffc107;
}

.stats {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 25px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.stat-item {
    text-align: center;
    padding: 15px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

.stat-item:hover {
    transform: translateY(-3px);
}

.stat-value {
    font-size: 2em;
    font-weight: bold;
    color: #007bff;
}

.stat-label {
    color: #6c757d;
    font-size: 0.9em;
}

.loading {
    text-align: center;
    padding: 20px;
    color: #6c757d;
}

.error {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 8px;
    margin: 10px 0;
    border: 1px solid #f5c6cb;
}

/* Кнопка добавления нового банка/категории */
.add-new-btn {
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
    padding: 8px 15px;
    font-size: 12px;
    margin-top: 10px;
}

.add-new-section {
    display: none;
    margin-top: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px dashed #6c757d;
}

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

.temp-message {
    font-weight: bold;
    position: fixed;
    top: 20px;
    right: 20px;
    background: #28a745;
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    animation: slideIn 0.3s ease;
}

.temp-message.error {
    background: #dc3545;
}

@media (max-width: 768px) {
    .filters {
        flex-direction: column;
    }
    
    .cashback-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .cashback-percent {
        text-align: left;
    }
    
    .cashback-actions {
        width: 100%;
        justify-content: flex-end;
    }
    
    .bank-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .suggestions {
        flex-direction: column;
    }
    
    .container {
        padding: 15px;
    }
    
    button {
        padding: 12px 20px;
        font-size: 14px;
    }
    
    .banks-categories-section {
        grid-template-columns: 1fr;
    }
    
    .banks-grid, .categories-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }


}

/* Добавляем стили для сворачиваемых секций */
.collapsible-section {
    background: white;
    border-radius: 12px;
    margin-bottom: 25px;
    border: 2px solid #e9ecef;
    overflow: hidden;
    transition: all 0.3s ease;
}

.collapsible-section:hover {
    border-color: #007bff;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.section-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 20px 25px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.3s ease;
    user-select: none;
}

.section-header:hover {
    background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
}

.section-header h2 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.4em;
}

.toggle-icon {
    font-size: 1.2em;
    color: #6c757d;
    transition: transform 0.3s ease;
    font-weight: bold;
}

.toggle-icon.rotated {
    transform: rotate(180deg);
}

.section-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease;
    background: white;
}

/* Убираем класс .expanded, так как теперь управляем через style */
/* .section-content.expanded {
    max-height: 1000px;
} */

/* Адаптивность для мобильных */
@media (max-width: 768px) {
    .section-header {
        padding: 15px 20px;
    }
    
    .section-header h2 {
        font-size: 1.2em;
    }
}

/* Остальные существующие стили остаются без изменений */

/* Стили для маленьких кнопок удаления в банках и категориях */
.btn-delete-small {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 12px;
    width: 10px;
    height: 10px;
    font-size: 10px;
    font-weight: bold;
    cursor: pointer;
    margin-left: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    opacity: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.btn-delete-small:hover {
    background: #c82333;
    transform: scale(1.15);
    opacity: 1;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.bank-item, .category-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
    padding: 8px 12px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    font-size: 12px;
    min-height: 36px;
    margin: 2px;
}

.bank-item:hover, .category-item:hover {
    background: #007bff;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,123,255,0.3);
}

.bank-item.selected, .category-item.selected {
    background: #28a745;
    color: white;
    border-color: #1e7e34;
    box-shadow: 0 2px 8px rgba(40,167,69,0.3);
}

.bank-name, .category-name {
    flex: 1;
    text-align: center;
    pointer-events: none;
    font-weight: 500;
}

/* Убедимся, что текст не выделяется при клике */
.bank-item, .category-item {
    user-select: none;
    -webkit-user-select: none;
}

/* Адаптивность для мобильных */
@media (max-width: 768px) {
    .btn-delete-small {
        width: 16px;
        height: 16px;
        font-size: 9px;
        margin-left: 4px;
    }
    
    .bank-item, .category-item {
        padding: 6px 10px;
        font-size: 13px;
        min-height: 32px;
    }
}
