:root {
    --primary: #10B981;
    --primary-hover: #059669;
    --bg-main: #111827;
    --bg-card: #1f2937;
    --bg-hover: #374151;
    --text-primary: #f9fafb;
    --text-secondary: #9ca3af;
    --border-color: #374151;
    --destructive: #ef4444;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
    display: flex;
    justify-content: center;
    padding: 2rem;
    min-height: 100vh;
}

.app-container {
    width: 100%;
    max-width: 600px;
    position: relative;
}

.hidden {
    display: none !important;
}

.view {
    animation: fadeIn 0.3s ease;
}

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

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

header h1 {
    font-size: 1.5rem;
    font-weight: 700;
}

.subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.btn {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

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

.btn.primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

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

.btn.icon-only {
    padding: 0.5rem;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    background: var(--bg-card);
    border-radius: 1rem;
    border: 1px dashed var(--border-color);
}

.empty-icon {
    width: 48px;
    height: 48px;
    color: var(--primary);
    margin-bottom: 1rem;
}

.empty-state h3 {
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

/* Habit List */
.habit-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.habit-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: 1.5rem;
    transition: transform 0.2s;
    position: relative;
}

.habit-card:hover {
    border-color: var(--primary);
}

.habit-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.habit-title {
    font-size: 1.125rem;
    font-weight: 600;
}

.habit-actions {
    display: flex;
    gap: 0.5rem;
    opacity: 0;
    transition: opacity 0.2s;
}

.habit-card:hover .habit-actions {
    opacity: 1;
}

.habit-actions .btn {
    padding: 0.25rem;
    border: none;
    color: var(--text-secondary);
}

.habit-actions .btn:hover {
    color: var(--text-primary);
    background: transparent;
}

.habit-actions .btn.danger:hover {
    color: var(--destructive);
}

/* Checkbox Check-in */
.check-in-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 1rem;
    background: var(--bg-main);
    border-radius: 0.5rem;
}

.check-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--primary);
    background: transparent;
    color: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.check-btn.checked {
    background: var(--primary);
    color: white;
}

.check-text {
    flex: 1;
}

.check-text strong {
    display: block;
    color: var(--text-primary);
}

.check-text span {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Progress and Streak */
.habit-stats {
    display: flex;
    gap: 1.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.stat-item.active {
    color: var(--primary);
}

.progress-bar-container {
    margin-top: 1rem;
    height: 6px;
    background: var(--bg-main);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--primary);
    transition: width 0.3s ease;
}

/* Wizard */
.wizard-header {
    margin-bottom: 1rem;
}

.wizard-header h2 {
    flex: 1;
    text-align: center;
    margin: 0;
    font-size: 1.25rem;
}

.steps-indicator {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 1rem;
}

.step-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border-color);
    transition: background 0.3s;
}

.step-dot.active {
    background: var(--primary);
}

.wizard-step {
    padding: 2rem 0;
    display: none;
    animation: fadeIn 0.3s ease;
}

.wizard-step.active {
    display: block;
}

.step-content h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.step-desc {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

input[type="text"], select, textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    color: var(--text-primary);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
}

input[type="text"]:focus, select:focus, textarea:focus {
    border-color: var(--primary);
}

.stack-inputs {
    display: flex;
    gap: 1rem;
}

.stack-inputs select {
    width: 150px;
}

.citation {
    background: rgba(16, 185, 129, 0.1);
    border-left: 3px solid var(--primary);
    padding: 1rem;
    border-radius: 0 0.5rem 0.5rem 0;
    margin-top: 2rem;
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.citation i {
    color: var(--primary);
    flex-shrink: 0;
}

.citation p {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.wizard-footer {
    display: flex;
    padding-top: 1rem;
    margin-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.spacer {
    flex: 1;
}

/* Summary Card */
.habit-summary-card {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 1rem;
    border: 2px solid var(--primary);
    text-align: center;
}

.card-identity {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.card-identity span {
    color: var(--text-primary);
    font-weight: 500;
}

.card-formula {
    font-size: 1.25rem;
    line-height: 1.5;
}

.badge {
    background: var(--primary);
    color: white;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    vertical-align: middle;
    margin-right: 0.5rem;
}

.anchor-text {
    font-weight: 600;
}

.will-text {
    margin-top: 0.5rem;
    color: var(--text-secondary);
}

.micro-text {
    color: var(--text-primary);
    font-weight: 600;
    border-bottom: 2px dashed var(--primary);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 1rem;
    animation: fadeIn 0.2s;
}

.modal {
    background: var(--bg-main);
    width: 100%;
    max-width: 400px;
    border-radius: 1rem;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.modal-body textarea {
    min-height: 100px;
    margin-top: 1rem;
    resize: vertical;
}

.modal-footer {
    margin-top: 1.5rem;
    display: flex;
    justify-content: flex-end;
}

/* Celebrations */
.celebration-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(16, 185, 129, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    color: white;
    text-align: center;
    animation: fadeIn 0.3s;
}

.celebration-content {
    animation: bounce 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.celebration-icon {
    width: 64px;
    height: 64px;
    margin-top: 1rem;
}

@keyframes bounce {
    0% { transform: scale(0.5); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* Toast */
#toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 300;
}

.toast {
    background: var(--bg-card);
    color: var(--text-primary);
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    border-left: 4px solid var(--primary);
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    animation: slideIn 0.3s ease, fadeOut 0.3s ease 2.7s forwards;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOut {
    to { opacity: 0; }
}
