/* Путь: /css/main.css */

/* Стили для формы входа */
.login-form {
    max-width: 400px;
    margin: 2rem auto;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border-radius: 4px;
    font-size: 1rem;
}

.form-actions {
    margin-top: 2rem;
    text-align: center;
}

.login-btn {
    padding: 0.75rem 2rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.error-message {
    background-color: #ffebee;
    color: #c62828;
    padding: 0.75rem;
    margin-bottom: 1.5rem;
    border-radius: 4px;
    border-left: 4px solid #c62828;
}

/* Темная тема для формы входа */
.tg-theme-dark .login-form {
    background-color: #333;
}

.tg-theme-dark .error-message {
    background-color: #3e2723;
    color: #ffcdd2;
    border-left-color: #c62828;
}

/* Уведомления */
.alert {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 20px;
    border-radius: 5px;
    color: white;
    font-weight: bold;
    z-index: 1000;
    animation: fadeIn 0.3s, fadeOut 0.3s 2.7s;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.alert.error {
    background-color: #f44336;
}

.alert.success {
    background-color: #4CAF50;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translate(-50%, -10px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

@keyframes fadeOut {
    from { opacity: 1; transform: translate(-50%, 0); }
    to { opacity: 0; transform: translate(-50%, -10px); }
}

/* Основная форма минут */
.minutes-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

/* Группа ввода минут с кнопками +/- */
.minutes-input-group {
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: 15px;
    justify-content: center;
}

.minutes-input-group input {
    width: 120px;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-left: none;
    border-right: none;
    font-size: 18px;
    font-weight: bold;
    text-align: center;
    transition: all 0.3s ease;
}

.minutes-input-group input:focus {
    outline: none;
    border-color: #007bff;
    background-color: #f0f8ff;
}

/* Убираем стрелки у input type="number" - полная кроссбраузерная версия */
/* Chrome, Safari, Edge, Opera */
.minutes-input-group input[type="number"]::-webkit-inner-spin-button,
.minutes-input-group input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Firefox */
.minutes-input-group input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield; /* Стандартное свойство для будущей совместимости */
}

.minutes-input-group input[type="number"] {
    -moz-appearance: textfield;
}

/* Кнопки +/- рядом с полем ввода */
.input-btn {
    width: 50px;
    height: 50px;
    border: 2px solid #e0e0e0;
    background-color: #f8f9fa;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.minus-btn {
    border-radius: 8px 0 0 8px;
    color: #dc3545;
}

.plus-btn {
    border-radius: 0 8px 8px 0;
    color: #28a745;
}

.input-btn:hover {
    transform: scale(1.05);
}

.minus-btn:hover {
    background-color: #fff5f5;
    border-color: #dc3545;
}

.plus-btn:hover {
    background-color: #f0fff4;
    border-color: #28a745;
}

.input-btn:active {
    transform: scale(0.95);
}

/* Быстрые кнопки для изменения количества */
.quick-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    justify-content: center;
}

.quick-subtract-group,
.quick-add-group {
    display: flex;
    gap: 5px;
}

.quick-btn {
    min-width: 45px;
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

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

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

.quick-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
}

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

.quick-btn.positive:hover {
    background-color: #218838;
}

.quick-btn.negative:hover {
    background-color: #c82333;
}

/* Поле комментария */
#comment-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 16px;
    transition: all 0.3s ease;
}

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

/* Стили для быстрых тегов комментариев */
.comment-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    margin-bottom: 15px;
}

.tag-btn {
    padding: 6px 12px;
    background-color: #e3f2fd;
    color: #1976d2;
    border: 1px solid #90caf9;
    border-radius: 16px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.tag-btn:hover {
    background-color: #bbdefb;
    border-color: #64b5f6;
    transform: translateY(-1px);
}

.tag-btn:active {
    background-color: #90caf9;
    transform: translateY(0);
}

.tag-btn.selected {
    background-color: #1976d2;
    color: white;
    border-color: #1976d2;
}

/* Кнопка "Обновить" */
.update-btn {
    width: 100%;
    padding: 12px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(102, 126, 234, 0.4);
}

.update-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(102, 126, 234, 0.4);
}

.update-btn:active {
    transform: translateY(0);
}

/* Темная тема для новых элементов */
.tg-theme-dark .minutes-input-group input {
    background-color: #2a2a2a;
    border-color: #444;
    color: #fff;
}

.tg-theme-dark .minutes-input-group input:focus {
    background-color: #333;
    border-color: #667eea;
}

.tg-theme-dark .input-btn {
    background-color: #2a2a2a;
    border-color: #444;
}

.tg-theme-dark .minus-btn:hover {
    background-color: #3a2a2a;
}

.tg-theme-dark .plus-btn:hover {
    background-color: #2a3a2a;
}

.tg-theme-dark .quick-btn.positive {
    background-color: #1e7e34;
}

.tg-theme-dark .quick-btn.negative {
    background-color: #bd2130;
}

.tg-theme-dark .quick-btn.positive:hover {
    background-color: #28a745;
}

.tg-theme-dark .quick-btn.negative:hover {
    background-color: #dc3545;
}

.tg-theme-dark #comment-input {
    background-color: #2a2a2a;
    border-color: #444;
    color: #fff;
}

.tg-theme-dark #comment-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.tg-theme-dark .tag-btn {
    background-color: rgba(33, 150, 243, 0.15);
    color: #90caf9;
    border-color: rgba(144, 202, 249, 0.3);
}

.tg-theme-dark .tag-btn:hover {
    background-color: rgba(33, 150, 243, 0.25);
    border-color: rgba(144, 202, 249, 0.5);
}

.tg-theme-dark .tag-btn.selected {
    background-color: #1976d2;
    color: white;
    border-color: #1976d2;
}

.tg-theme-dark .update-btn {
    background: linear-gradient(135deg, #4a5aa8 0%, #5a3b82 100%);
}
/* Быстрые кнопки для изменения количества с кнопкой сброса */
.quick-buttons {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
    justify-content: center;
    align-items: stretch;
}

.quick-buttons-wrapper {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.quick-subtract-group,
.quick-add-group {
    display: flex;
    gap: 4px;
}

.quick-btn {
    min-width: 38px;
    padding: 6px 8px;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 3px rgba(0, 0, 0, 0.1);
}

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

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

.quick-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 5px rgba(0, 0, 0, 0.15);
}

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

.quick-btn.positive:hover {
    background-color: #218838;
}

.quick-btn.negative:hover {
    background-color: #c82333;
}

/* Кнопка сброса */
.reset-btn {
    padding: 8px 16px;
    background: linear-gradient(135deg, #868e96 0%, #6c757d 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
    align-self: stretch;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.reset-btn:hover {
    background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

.reset-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 3px rgba(0, 0, 0, 0.15);
}

/* Темная тема для кнопки сброса */
.tg-theme-dark .reset-btn {
    background: linear-gradient(135deg, #495057 0%, #343a40 100%);
}

.tg-theme-dark .reset-btn:hover {
    background: linear-gradient(135deg, #343a40 0%, #23272b 100%);
}
/* Кнопка "Записать" с анимациями */
.update-btn {
    width: 100%;
    padding: 12px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(102, 126, 234, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.update-btn .btn-icon {
    font-size: 20px;
    transition: transform 0.3s ease;
}

.update-btn .btn-text {
    position: relative;
    z-index: 2;
}

.update-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(102, 126, 234, 0.4);
}

.update-btn:hover .btn-icon {
    transform: rotate(-10deg) scale(1.1);
}

.update-btn:active {
    transform: translateY(0);
}

/* Состояние для положительного баланса - зеленая переливающаяся */
.update-btn.positive {
    background: linear-gradient(135deg, #11998e, #38ef7d);
    animation: shimmer-green 2s infinite;
    box-shadow: 0 4px 15px rgba(56, 239, 125, 0.4);
}

.update-btn.positive .btn-icon {
    animation: bounce-icon 1.5s infinite;
}

@keyframes shimmer-green {
    0% {
        background: linear-gradient(135deg, #11998e, #38ef7d);
        box-shadow: 0 4px 15px rgba(56, 239, 125, 0.4);
    }
    50% {
        background: linear-gradient(135deg, #38ef7d, #11998e);
        box-shadow: 0 4px 20px rgba(56, 239, 125, 0.6);
    }
    100% {
        background: linear-gradient(135deg, #11998e, #38ef7d);
        box-shadow: 0 4px 15px rgba(56, 239, 125, 0.4);
    }
}

/* Состояние для отрицательного баланса - красная с молниями */
.update-btn.negative {
    background: linear-gradient(135deg, #eb3349, #f45c43);
    animation: pulse-red 1.5s infinite;
    box-shadow: 0 4px 15px rgba(235, 51, 73, 0.4);
}

.update-btn.negative::before,
.update-btn.negative::after {
    content: '⚡';
    position: absolute;
    font-size: 24px;
    animation: lightning 2s infinite;
    z-index: 1;
}

.update-btn.negative::before {
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    animation-delay: 0s;
}

.update-btn.negative::after {
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    animation-delay: 1s;
}

@keyframes pulse-red {
    0% {
        background: linear-gradient(135deg, #eb3349, #f45c43);
        box-shadow: 0 4px 15px rgba(235, 51, 73, 0.4);
    }
    50% {
        background: linear-gradient(135deg, #f45c43, #eb3349);
        box-shadow: 0 4px 25px rgba(235, 51, 73, 0.7);
    }
    100% {
        background: linear-gradient(135deg, #eb3349, #f45c43);
        box-shadow: 0 4px 15px rgba(235, 51, 73, 0.4);
    }
}

@keyframes lightning {
    0%, 100% {
        opacity: 0;
        transform: translateY(-50%) scale(0.5);
    }
    50% {
        opacity: 1;
        transform: translateY(-50%) scale(1.2);
    }
}

@keyframes bounce-icon {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    25% {
        transform: translateY(-3px) rotate(-5deg);
    }
    75% {
        transform: translateY(3px) rotate(5deg);
    }
}

/* Темная тема для кнопки записать */
.tg-theme-dark .update-btn {
    background: linear-gradient(135deg, #4a5aa8 0%, #5a3b82 100%);
}

.tg-theme-dark .update-btn.positive {
    background: linear-gradient(135deg, #0f7938, #28a745);
}

.tg-theme-dark .update-btn.negative {
    background: linear-gradient(135deg, #bd2130, #dc3545);
}
/* Дополнительные стили для кнопки с числом */
.update-btn {
    width: 100%;
    padding: 12px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(102, 126, 234, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
    min-height: 50px; /* Фиксированная минимальная высота */
}

.update-btn .btn-text {
    position: relative;
    z-index: 2;
    font-size: 17px;
    white-space: nowrap;
}

/* Увеличиваем размер текста для больших чисел */
.update-btn.positive .btn-text,
.update-btn.negative .btn-text {
    font-weight: 900;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Адаптация для маленьких экранов */
@media (max-width: 480px) {
    .update-btn .btn-text {
        font-size: 16px;
    }
}