/* habits.css — Modern Full-Width Habits Layout */

/* Page Container */
.habits-page {
    display: flex;
    flex-direction: column;
    gap: 0;
    height: 100%;
    overflow-y: auto;
}

/* === Toolbar === */
.hab-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.hab-page-title {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.hab-page-title i {
    color: var(--primary);
}

.hab-add-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.hab-add-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* === Collapsible Form === */
.hab-form-panel {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease, margin 0.35s ease, opacity 0.25s ease;
    opacity: 0;
    margin-bottom: 0;
}

.hab-form-panel.open {
    max-height: 400px;
    opacity: 1;
    margin-bottom: 16px;
}

.hab-form-inner {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px;
}

.hab-form-row {
    display: flex;
    gap: 14px;
    margin-bottom: 14px;
    align-items: flex-end;
}

.hab-form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.hab-form-field label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-mute);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.hab-form-field label i {
    font-size: 0.75rem;
    color: var(--primary);
}

.hab-form-grow {
    flex: 1;
    min-width: 0;
}

.hab-form-field .std-input,
.hab-form-field .std-select {
    margin: 0;
}

/* Icon Select Button */
.hab-icon-select {
    padding: 10px 16px;
    border: 1px solid var(--border);
    background: var(--bg-main);
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
}

.hab-icon-select:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* Color Input */
.hab-color-input {
    width: 100%;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    background: transparent;
    padding: 2px;
}

/* Days Row */
.hab-days-row {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.day-chip {
    flex: 1;
    min-width: 44px;
    text-align: center;
    padding: 10px;
    background: var(--bg-main);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 600;
    transition: all 0.2s;
    color: var(--text-secondary);
}

.day-chip:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.day-chip.selected {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}

/* Form Actions */
.hab-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.hab-form-cancel {
    padding: 8px 18px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-mute);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.hab-form-cancel:hover {
    color: var(--text);
    border-color: var(--text-mute);
}

.hab-form-save {
    padding: 8px 22px;
    font-size: 0.85rem;
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* === Habit Columns === */
.hab-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.hab-col {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    min-height: 200px;
}

.hab-col-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.hab-col-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
}

.hab-col-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.hab-col-icon.todo {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
}

.hab-col-icon.done {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
}

.hab-col-icon.other {
    background: rgba(148, 163, 184, 0.1);
    color: var(--text-mute);
}

/* === Habit Item Cards === */
.habit-item {
    background: var(--bg-main);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.25s;
}

.habit-item:hover {
    transform: translateX(3px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-hover);
}

.habit-icon-box {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.1rem;
    flex-shrink: 0;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
}

.habit-info {
    flex: 1;
    min-width: 0;
}

.habit-title {
    font-weight: 700;
    color: var(--text);
    font-size: 0.95rem;
    margin-bottom: 3px;
}

.habit-sub {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Day Circles */
.habit-days {
    display: flex;
    gap: 6px;
}

.day-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
}

.day-lbl {
    font-size: 0.65rem;
    color: var(--text-mute);
    margin-bottom: 4px;
    font-weight: 600;
    text-transform: uppercase;
}

.day-circle {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--bg-panel);
    border: 1.5px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: transparent;
    font-size: 0.8rem;
    font-weight: 700;
    transition: all 0.2s;
}

.day-circle:hover {
    border-color: var(--primary);
    background: var(--bg-secondary);
}

.day-circle.done {
    color: white;
    background-color: var(--primary);
    border-color: transparent;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

/* === Other Days Section === */
.hab-other-section {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.hab-other-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.hab-other-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-mute);
}

.hab-other-list {
    opacity: 0.75;
}

/* === Responsive === */
@media (max-width: 1100px) and (min-width: 769px) {

    /* Tablet breakpoint */
    .hab-form-row {
        flex-wrap: wrap;
    }

    .hab-form-grow {
        flex: 1 1 100%;
    }

    .hab-form-field {
        flex: 1 1 calc(33% - 10px);
        min-width: 120px;
    }

    .habit-item {
        gap: 12px;
        padding: 14px;
    }

    .habit-icon-box {
        width: 36px;
        height: 36px;
        font-size: 0.95rem;
    }
}

@media (max-width: 768px) {
    .hab-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .hab-add-btn {
        width: 100%;
        justify-content: center;
    }

    .hab-form-row {
        flex-direction: column;
    }

    .hab-form-panel.open {
        max-height: none;
        overflow-y: visible;
    }

    .hab-columns {
        grid-template-columns: 1fr;
    }

    .habit-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .habit-days {
        width: 100%;
        justify-content: space-between;
    }
}