/* Utilities & Mixins */
.habit-hidden {
    display: none !important;
}

.habit-text-success {
    color: var(--success, #27ae60) !important;
}

.habit-title-wrapper {
    flex-grow: 1;
}

.habit-message-empty {
    color: var(--muted-text-color);
    font-style: italic;
}

/* Habit Card */
/* Habit Card */
.habit-card {
    padding: 1.5rem;
/*    margin-bottom: 0;
    height: 100%;
    box-sizing: border-box;
*/    /* Other styles inherited from .interactive-card 
}
*/
.habit-detail-card {
    margin-bottom: 2rem;
}

.habit-card.mastered {
    border: 1px solid #fbc02d;
}

/* Header: shared styles in application.css */

/* Stats Row */
.habit-stats {
    margin-bottom: 1rem;
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

/* Unique Pill Modifiers */
.habit-pill.mastery {
    background: linear-gradient(135deg, #fff9c4, #fff176);
    color: #f57f17;
    border: 1px solid #fbc02d;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Forms: shared styles in application.css */

.habit-pill.info {
    background-color: #e3f2fd;
    color: #1976d2;
    border: 1px solid #1976d2;
}

.habit-pill.target {
    background-color: #f3e5f5;
    color: #7b1fa2;
    border: 1px solid #7b1fa2;
}

.habit-pill.active {
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    background-color: #d4efdf;
    color: #27ae60;
}

.habit-pill.trigger {
    background-color: #EEE;
    color: #555;
}

/* Play Button */
.habit-play-btn {
    margin-left: auto;
    display: flex;
    /* overridden by JS/inline if needed, but defaults to flex */
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: #e8f5e9;
    color: #27ae60;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s;
}

.habit-play-btn:hover {
    background-color: #c8e6c9 !important;
    /* Force override inline styles if present, or just rely on CSS */
}

/* Timer */
.habit-timer-container {
    margin-bottom: 1rem;
    text-align: center;
}

.habit-timer-display {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-color);
    font-variant-numeric: tabular-nums;
}

.habit-timer-subtext {
    font-size: 0.8rem;
    color: #666;
    margin-top: -0.2rem;
}

.habit-timer-actions {
    margin-top: 0.5rem;
}

.habit-timer-schedule-wrapper {
    margin: 0.5rem 0;
    font-size: 0.9rem;
}

.habit-timer-schedule-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.habit-timer-schedule-checkbox {
    width: 1rem;
    height: 1rem;
}

/* Habit Cancel/Log Buttons */
.habit-cancel-btn,
.habit-log-btn {
    width: 42px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    line-height: 1;
    /* Fix vertical alignment */
}

.habit-cancel-btn svg,
.habit-log-btn svg {
    display: block;
    flex-shrink: 0;
}

.habit-cancel-btn {
    background: #e5e7eb;
    color: #6b7280;
}

.habit-log-btn {
    background: #d4efdf;
    color: #27ae60;
}

.habit-log-btn:hover {
    background: #a9dfbf;
    /* Slightly darker pastel green */
}

.habit-completion-actions {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.habit-completion-actions:not(.habit-hidden) {
    display: flex !important;
    /* Override inline style if present or ensure flex */
}

.habit-start-btn {
    background: #fcf3cf;
    color: #f39c12;
}

.habit-pause-btn {
    background: #e8daef;
    color: #8e44ad;
}

.habit-start-btn,
.habit-pause-btn {
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    line-height: normal;
    /* Ensure text creates equal height container */
    cursor: pointer;
    font-weight: 500;
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    white-space: nowrap;
    transition: background-color 0.2s;
}

.habit-start-btn svg,
.habit-pause-btn svg {
    display: block;
    /* Remove inline-block baseline space */
    flex-shrink: 0;
}

.habit-start-btn:hover {
    background: #f9e79f;
}

.habit-pause-btn:hover {
    background: #d2b4de;
}

.habit-btn-text {
    width: auto;
    height: auto;
    padding: 0.6rem 1.2rem;
    font-size: 1rem;
}

/* Progress Bar */
.habit-progress-container {
    margin-bottom: 0.75rem;
    margin-top: auto;
}

.habit-progress-bg {
    background: #f0f0f0;
    border-radius: 10px;
    height: 8px;
    overflow: hidden;
}

.habit-progress-fill {
    background: #27ae60;
    height: 100%;
    transition: width 0.3s ease;
    width: var(--progress, 0%);
}

.habit-progress-fill.mastered {
    background: linear-gradient(90deg, #fbc02d, #f57f17);
    box-shadow: 0 0 8px rgba(251, 192, 45, 0.4);
    width: 100%;
}




/* Detail Page */



.habit-description {
    font-size: 1.1rem;
    color: var(--text-color);
    margin-bottom: 1.5rem;
}

.habit-info-row {
    display: flex;
    gap: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    color: #666;
}

/* Helper class removed */

.habit-info-label {
    font-size: 0.85rem;
    color: var(--muted-text-color);
    margin-bottom: 0.2rem;
}

.habit-info-value {
    font-weight: 600;
}

/* Timer Card (Large) */
.habit-timer-card {
    margin-bottom: 2rem;
    text-align: center;
    padding: 3rem 2rem;
}

.habit-timer-large {
    font-size: 5rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--text-color);
    margin-bottom: 2rem;
}

.habit-timer-large.mastered {
    color: #f57f17;
}

.habit-timer-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.habit-btn-reset {
    padding: 1rem 2rem;
    font-size: 1.2rem;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--muted-text-color);
}

.habit-timer-footer {
    color: var(--muted-text-color);
    font-size: 0.9rem;
}

.habit-history-date-text {
    font-weight: 500;
}

/* History */
.habit-history-section {
    margin-top: 3rem;
}

.habit-history-title {
    color: var(--heading-color);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.habit-history-count {
    font-size: 0.8rem;
    background: var(--bg-color);
    color: var(--muted-text-color);
    padding: 0.1rem 0.5rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.habit-history-list {
    display: grid;
    gap: 1rem;
}

.habit-history-item {
    margin-bottom: 0;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.habit-history-date {
    display: flex;
    flex-direction: column;
}

.habit-history-time {
    font-size: 0.85rem;
    color: var(--muted-text-color);
}

.habit-history-stats {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.habit-history-level {
    font-size: 0.8rem;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    background-color: #ebf5fb;
    color: #2980b9;
    font-weight: 600;
}

.habit-history-duration {
    font-size: 0.9rem;
    color: var(--text-color);
    font-weight: 500;
}

.habit-btn-start {
    padding: 1rem 2rem;
    font-size: 1.2rem;
}

/* Index Page */


/* Forms */


.habit-form-help {
    display: block;
    color: #666;
    margin-bottom: 0.3rem;
    font-size: 0.85rem;
}

.habit-form-cancel {
    margin-left: 0.5rem;
}