:root {
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --sidebar-bg: #111827;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --danger: #ef4444;
    --cell-empty: #334155;
    --border-color: #334155;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    height: 100vh;
    display: flex;
    justify-content: center;
    overflow: hidden;
}

#app {
    width: 100%;
    height: 100%;
    position: relative;
}

/* Utils */
.hidden {
    display: none !important;
}

.screen {
    height: 100%;
    width: 100%;
}

/* Buttons */
.primary-btn {
    background: var(--primary);
    color: white;
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.95rem;
    transition: background 0.2s;
}

.primary-btn:hover {
    background: var(--primary-hover);
}

.secondary-btn {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--text-secondary);
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
}

.secondary-btn:hover {
    color: var(--text-primary);
    border-color: var(--text-primary);
}

.danger-btn {
    background: transparent;
    color: var(--danger);
    border: 1px solid var(--danger);
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.danger-btn:hover {
    background: var(--danger);
    color: white;
}

.icon-btn {
    background: var(--primary);
    color: white;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.icon-btn:hover {
    background: var(--primary-hover);
}

/* Auth Screen */
#auth-screen {
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-container {
    width: 100%;
    max-width: 400px;
    background: var(--card-bg);
    padding: 2.5rem;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.auth-container h1 {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--primary);
}

.tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.tab-btn {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 10px;
    cursor: pointer;
    font-size: 1rem;
}

.tab-btn.active {
    color: var(--primary);
    border-bottom: 2px solid var(--primary);
}

form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

input {
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.05);
    color: white;
    font-size: 1rem;
}

input:focus {
    outline: none;
    border-color: var(--primary);
}

/* Dashboard Layout */
.dashboard-layout {
    display: flex;
    height: 100%;
    width: 100%;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 20px;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.habit-list {
    list-style: none;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.habit-item {
    padding: 12px;
    border-radius: 8px;
    cursor: grab;
    transition: background 0.2s, opacity 0.2s, transform 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.habit-item:active {
    cursor: grabbing;
}

.habit-item.dragging {
    opacity: 0.5;
    background: rgba(59, 130, 246, 0.3);
    transform: scale(1.02);
}

.habit-item.drag-over {
    border-top: 2px solid var(--primary);
}

.habit-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.habit-item.active {
    background: rgba(59, 130, 246, 0.15);
}

.habit-color-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.habit-name {
    flex: 1;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-footer {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 40px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.content-header h2 {
    font-size: 1.8rem;
    font-weight: 600;
}

.grid-view-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.month-block {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 12px;
}

.month-title {
    font-size: 1.1rem;
    margin-bottom: 15px;
    color: var(--text-secondary);
    font-weight: 500;
}

.heat-map {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(28px, 1fr));
    /* Or fixed columns based on 7 days a week if we want calendar-like, 
       but request said "square cells", usually heatmaps are flexible. 
       Let's try a flex-wrap or grid with auto-fit for a stream of days.
       However, "3 months according to month" usually implies calendar structure or just a stream.
       Let's stick to a stream of days for the heatmap look. */
    grid-template-columns: repeat(auto-fill, 32px);
    gap: 6px;
}

.day-cell {
    width: 32px;
    height: 32px;
    background: var(--cell-empty);
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    transition: transform 0.1s, background 0.2s;

    /* Centering content */
    display: flex;
    align-items: center;
    justify-content: center;
}

.day-cell:hover {
    transform: scale(1.1);
    z-index: 2;
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.day-cell.completed {
    /* Color set inline */
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.2);
}

.day-cell .day-number {
    pointer-events: none;
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.4);
    display: none;
}

.grid-view-container.show-dates .day-cell .day-number {
    display: block;
}

.day-cell.today {
    border-bottom: 3px solid var(--primary);
}

/* Tooltip */
.day-cell::after {
    content: attr(data-date);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: black;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    margin-bottom: 5px;
}

.day-cell:hover::after {
    opacity: 1;
}

.empty-state {
    text-align: center;
    color: var(--text-secondary);
    font-size: 1.2rem;
    margin-top: 100px;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal-content {
    background: var(--card-bg);
    padding: 24px;
    border-radius: 16px;
    width: 90%;
    max-width: 400px;
}

.modal-content h3 {
    margin-bottom: 20px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.color-picker {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Remember Me */
.remember-me {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.remember-me input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary);
}