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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 800px;
    margin: 0 auto;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.date {
    font-size: 1.1rem;
    opacity: 0.9;
}

.habits-container {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.habit-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    margin-bottom: 15px;
    background: #f8f9fa;
    border-radius: 12px;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.habit-item:hover {
    background: #e9ecef;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.habit-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 15px;
}

.habit-name {
    font-size: 1.2rem;
    font-weight: 500;
    color: #2d3748;
}

.habit-emoji {
    font-size: 1.5rem;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    width: 60px;
    height: 32px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.4s;
    border-radius: 34px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 24px;
    width: 24px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: #667eea;
}

input:checked + .toggle-slider:before {
    transform: translateX(28px);
}

input:disabled + .toggle-slider {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Counter Controls */
.counter-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.counter-button {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 2px solid #e9ecef;
    background: #f8f9fa;
    color: #495057;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0;
}

.counter-button:hover {
    background: #e9ecef;
    border-color: #667eea;
    color: #667eea;
    transform: scale(1.05);
}

.counter-button:active {
    transform: scale(0.95);
    background: #dee2e6;
}

.counter-value {
    min-width: 30px;
    text-align: center;
    font-size: 1.2rem;
    font-weight: 600;
    color: #2d3748;
    padding: 0 5px;
}

.habit-item.completed {
    background: #d4edda;
    border-color: #28a745;
}

.habit-item.completed .habit-name {
    color: #155724;
    text-decoration: line-through;
    opacity: 0.8;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 1.1rem;
}

.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 20px;
    border-radius: 12px;
    margin-top: 20px;
    border: 2px solid #f5c6cb;
    line-height: 1.8;
    font-size: 0.95rem;
}

.error-message h2 {
    margin-bottom: 15px;
    color: #721c24;
}

.error-message code {
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 0.9em;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.empty-state h2 {
    margin-bottom: 10px;
    color: #999;
}

.category-section {
    margin-bottom: 35px;
}

.category-section:last-of-type {
    margin-bottom: 25px;
}

.energy-question-section {
    margin-bottom: 35px;
    margin-top: 20px;
}

.energy-question-item {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 25px;
    border: 2px solid #e9ecef;
}

.energy-question-text {
    margin-bottom: 20px;
}

.energy-question-label {
    font-size: 1.1rem;
    font-weight: 500;
    color: #2d3748;
    line-height: 1.6;
}

.energy-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.energy-option {
    display: flex;
    align-items: center;
    padding: 15px;
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.energy-option:hover {
    background: #f8f9fa;
    border-color: #667eea;
    transform: translateX(5px);
}

.energy-option.selected {
    background: #e7f3ff;
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.energy-option input[type="radio"] {
    margin-right: 12px;
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #667eea;
}

.energy-option-label {
    font-size: 1rem;
    color: #2d3748;
    flex: 1;
    cursor: pointer;
}

.energy-option.selected .energy-option-label {
    color: #667eea;
    font-weight: 500;
}

.category-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: #667eea;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e9ecef;
}

.submit-section {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 2px solid #e9ecef;
    text-align: center;
}

.submit-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.submit-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.submit-button:active:not(:disabled) {
    transform: translateY(0);
}

.submit-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.success-message {
    background: #d4edda;
    color: #155724;
    padding: 20px;
    border-radius: 12px;
    margin-top: 20px;
    border: 2px solid #c3e6cb;
    line-height: 1.8;
    font-size: 0.95rem;
}

/* Popup стили */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.popup-content {
    background: white;
    border-radius: 20px;
    padding: 40px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: popupSlideIn 0.3s ease-out;
}

@keyframes popupSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.popup-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    animation: popupBounce 0.5s ease-out;
}

@keyframes popupBounce {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

.popup-title {
    font-size: 1.8rem;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 15px;
}

.popup-message {
    font-size: 1.1rem;
    color: #666;
    margin-bottom: 30px;
    line-height: 1.6;
}

.popup-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 40px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.popup-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.popup-button:active {
    transform: translateY(0);
}

@media (max-width: 600px) {
    header h1 {
        font-size: 2rem;
    }

    .habit-item {
        padding: 15px;
    }

    .habit-name {
        font-size: 1rem;
    }

    .popup-content {
        padding: 30px 20px;
    }

    .popup-icon {
        font-size: 3rem;
    }

    .popup-title {
        font-size: 1.5rem;
    }

    .popup-message {
        font-size: 1rem;
    }

    .counter-button {
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }

    .counter-value {
        font-size: 1.1rem;
        min-width: 25px;
    }

    .energy-question-item {
        padding: 20px;
    }

    .energy-question-label {
        font-size: 1rem;
    }

    .energy-option {
        padding: 12px;
    }

    .energy-option-label {
        font-size: 0.95rem;
    }
}
