/*
 * Room of Planets - Main Page Styles
 * Observatory view for habit tracking
 */

/* ═══════════════════════════════════════════════════════════════════════
   LAYOUT
   ═══════════════════════════════════════════════════════════════════════ */

.observatory {
    position: relative;
    z-index: 2;
    min-height: 100vh;
    padding-top: 80px;
    padding-bottom: 100px; /* Space for fixed bottom bar */
}

.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--space-lg);
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

/* ═══════════════════════════════════════════════════════════════════════
   BOTTOM QUICK ADD BAR
   ═══════════════════════════════════════════════════════════════════════ */

.quick-add-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding: var(--space-md) var(--space-xl);
    background: linear-gradient(
        0deg,
        rgba(10, 21, 32, 0.98) 0%,
        rgba(10, 21, 32, 0.95) 80%,
        rgba(10, 21, 32, 0) 100%
    );
    backdrop-filter: blur(12px);
}

.quick-add-container {
    max-width: 600px;
    margin: 0 auto;
    background: var(--bg-elevated);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-xl);
    padding: var(--space-sm) var(--space-md);
    transition: all var(--transition-base) var(--ease-out-expo);
}

.quick-add-container:focus-within,
.quick-add-container.active {
    border-color: rgba(45, 212, 191, 0.3);
    box-shadow: 0 0 30px rgba(45, 212, 191, 0.15);
}

.habit-input {
    background: transparent;
    border: none;
    padding: var(--space-sm);
    font-size: var(--text-base);
}

.habit-input:focus {
    box-shadow: none;
    outline: none;
}

.habit-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-md);
    padding: 0 var(--space-sm);
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: all var(--transition-base) var(--ease-out-expo);
}

.habit-options.visible {
    max-height: 180px;
    opacity: 1;
    padding: var(--space-md) var(--space-sm);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    margin-top: var(--space-sm);
}

.option-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.option-label {
    font-size: var(--text-xs);
    font-weight: 500;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.option-pills {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
}

.tag-input-container {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.tag-input {
    padding: var(--space-xs) var(--space-sm);
    font-size: var(--text-sm);
    background: var(--bg-surface);
}

.custom-frequency-input {
    margin-top: var(--space-xs);
    padding: var(--space-xs) var(--space-sm);
    font-size: var(--text-sm);
    background: var(--bg-surface);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    color: var(--text-primary);
}

.custom-frequency-input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.existing-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
}

/* ═══════════════════════════════════════════════════════════════════════
   HABITS OBSERVATORY - Multi-column grid layout
   ═══════════════════════════════════════════════════════════════════════ */

.habits-observatory {
    min-height: 200px;
}

.habits-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: var(--space-sm);
    animation: fadeSlideIn var(--transition-slow) var(--ease-out-expo);
}

@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Frequency section headers */
.frequency-header {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) 0;
    margin-top: var(--space-md);
}

.frequency-header:first-child {
    margin-top: 0;
}

.frequency-label {
    font-family: var(--font-display);
    font-size: var(--text-xs);
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.frequency-line {
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.06);
}

/* ═══════════════════════════════════════════════════════════════════════
   HABIT CARD - Compact clickable cards
   ═══════════════════════════════════════════════════════════════════════ */

.habit-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-md);
    background: var(--bg-elevated);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-base) var(--ease-out-expo);
    position: relative;
    min-height: 80px;
    text-align: center;
}

.habit-item:hover {
    background: var(--bg-surface);
    border-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.habit-item:active {
    transform: translateY(0);
}

.habit-item.completed {
    background: var(--state-success-bg);
    border-color: rgba(52, 211, 153, 0.2);
}

.habit-item.completed .habit-name {
    color: var(--state-success);
}

.habit-item.completed::before {
    content: '✓';
    position: absolute;
    top: var(--space-xs);
    right: var(--space-xs);
    font-size: var(--text-xs);
    color: var(--state-success);
    font-weight: 600;
}

/* Habit name - main content */
.habit-name {
    font-family: var(--font-display);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.3;
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Tag indicator dot */
.habit-tag-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--tag-color, var(--accent-primary));
    position: absolute;
    bottom: var(--space-sm);
    left: 50%;
    transform: translateX(-50%);
    opacity: 0.6;
}

/* Hidden elements - kept for data but not displayed */
.habit-toggle,
.habit-info,
.habit-meta,
.habit-frequency,
.habit-weight,
.habit-streak,
.habit-edit {
    display: none;
}

/* Edit button on hover - small icon */
.habit-edit-icon {
    position: absolute;
    top: var(--space-xs);
    left: var(--space-xs);
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-surface);
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    opacity: 0;
    transition: all var(--transition-fast);
    font-size: 10px;
}

.habit-item:hover .habit-edit-icon {
    opacity: 1;
}

.habit-edit-icon:hover {
    background: var(--bg-hover);
    color: var(--text-secondary);
}

/* Overview section removed - stats moved to insights page */

/* ═══════════════════════════════════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════════════════════════════════ */

.habit-item.just-completed {
    animation: completePulse 0.4s var(--ease-out-expo);
}

@keyframes completePulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.5);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 8px rgba(52, 211, 153, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(52, 211, 153, 0);
    }
}

/* Habit add animation */
.habit-item.just-added {
    animation: popIn 0.3s var(--ease-out-back);
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Habit remove animation */
.habit-item.removing {
    animation: fadeOut 0.25s var(--ease-out-expo) forwards;
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.9);
    }
}

/* ═══════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    .main-content {
        padding: var(--space-md);
    }

    .habits-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }

    .habit-options {
        grid-template-columns: 1fr;
    }

    .habit-options.visible {
        max-height: 350px;
    }

    .quick-add-bar {
        padding: var(--space-sm) var(--space-md);
    }

    .nav-ribbon {
        padding: var(--space-sm) var(--space-md);
    }

    .nav-date {
        display: none;
    }
}

@media (max-width: 480px) {
    .brand-text {
        font-size: var(--text-base);
    }

    .habits-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }

    .habit-item {
        min-height: 70px;
        padding: var(--space-sm);
    }

    .habit-name {
        font-size: var(--text-xs);
    }
}
