* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Vazirmatn', system-ui, -apple-system, sans-serif;
}

:root {
    --bg-color: #f5f5f5;
    --text-color: #333;
    --card-bg: #fff;
    --border-color: #e0e0e0;
    --primary-color: #3498db;
    --primary-hover: #2980b9;
    --success-color: #2ecc71;
    --edit-color: #f39c12;
    --delete-color: #e74c3c;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    transition: background-color 0.3s ease;
}

body.dark-mode {
    --bg-color: #1a1a1a;
    --text-color: #fff;
    --card-bg: #2d2d2d;
    --border-color: #404040;
    --primary-color: #3498db;
    --primary-hover: #2980b9;
    --success-color: #27ae60;
    --edit-color: #d35400;
    --delete-color: #c0392b;
}

.container {
    max-width: 1000px;
    margin: 2rem auto;
    padding: 0 1rem;
    position: relative;
}

.top-add-habit {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #f0f0f0;
    color: #666;
    border: 1px solid var(--border-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    z-index: 999;
}

.top-add-habit:hover {
    background: #e0e0e0;
    transform: scale(1.05);
}

header {
    text-align: center;
    margin: 4rem auto 2rem;
    padding-top: 1rem;
}

h1 {
    color: var(--text-color);
    font-size: 2rem;
    margin-bottom: 1.5rem;
}

.habit-form {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

input[type="text"] {
    flex: 1;
    padding: 0.8rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    background-color: var(--card-bg);
    color: var(--text-color);
    transition: all 0.3s ease;
}

input[type="text"]:focus {
    outline: none;
    border-color: #3498db;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s ease;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-mode {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 auto;
    transition: all 0.3s ease;
}

.btn-mode:hover {
    background: var(--border-color);
}

.btn-collapse {
    background: transparent;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    transition: transform 0.3s ease;
}

.btn-collapse.collapsed {
    transform: rotate(-90deg);
}

.habit-item {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
}

.habit-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.habit-title {
    font-size: 1.2rem;
    color: var(--text-color);
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    display: flex;
    visibility: hidden;
    transition: all 0.3s ease-in-out;
}

.modal.show {
    visibility: visible;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: var(--card-bg);
    padding: 2rem;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    text-align: center;
    position: relative;
    border: 1px solid var(--border-color);
    transform: scale(0.7);
    opacity: 0;
    transition: all 0.3s ease-in-out;
}

.modal-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1.5rem;
}

.modal h2 {
    color: var(--text-color);
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.modal.show .modal-content {
    transform: scale(1);
    opacity: 1;
}

.animation-container {
    position: fixed;
    top: 4rem;
    left: 1rem;
    width: 40px;
    height: 40px;
    z-index: 1001;
    border-radius: 50%;
    overflow: hidden;
}

#tg-login-info {
    position: fixed;
    top: 2rem;
    left: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--card-bg);
    padding: 0.75rem 1rem;
    border-radius: 50px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    font-size: 0.8rem;
    color: var(--text-color);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

header h1 {
    margin-top: 3rem;
    margin-bottom: 2rem;
}
#tg-login-info img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary-color);
}

#tg-login-info:hover {
    opacity: 1;
}

.modal-quote {
    font-size: 1.1rem;
    color: var(--text-color);
    margin-bottom: 1.5rem;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: transparent;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    font-size: 1.2rem;
}

.habit-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-edit, .btn-delete, .btn-cancel {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1.5rem;
}

.btn-cancel {
    background: var(--border-color);
    color: var(--text-color);
}

.btn-cancel:hover {
    background: #d0d0d0;
}

.btn-edit {
    background-color: #f39c12;
    color: white;
}

.btn-edit:hover {
    background-color: #d68910;
}

.btn-delete {
    background-color: #e74c3c;
    color: white;
}

.btn-delete:hover {
    background-color: #c0392b;
}

.checkboxes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(35px, 1fr));
    gap: 0.5rem;
    margin-top: 1rem;
}

.checkbox-item {
    width: 35px;
    height: 35px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    color: var(--text-color);
    position: relative;
}

.checkbox-item.checked {
    background-color: var(--success-color);
    border-color: var(--success-color);
    color: white;
}

.checkbox-item:hover {
    border-color: var(--primary-color);
}

.habit-content {
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    opacity: 1;
    transform: translateY(0);
    max-height: 1000px;
}

.habit-content.collapsed {
    max-height: 0;
    opacity: 0;
    transform: translateY(-10px);
}

.habit-progress {
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    color: var(--text-color);
    font-size: 0.9rem;
}

.habit-title-section {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

@media (max-width: 768px) {
    .habit-form {
        flex-direction: column;
    }
    
    .btn-primary {
        width: 100%;
    }
    
    .habit-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .checkboxes-grid {
        grid-template-columns: repeat(auto-fill, minmax(30px, 1fr));
    }
    
    .checkbox-item {
        width: 30px;
        height: 30px;
    }
}

.habits-container {
    margin-top: 2rem;
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    background: var(--card-bg);
    border-radius: 12px;
    border: 2px dashed var(--border-color);
    margin: 2rem 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}