/* EUZOIA PREMIUM MINIMALIST THEME */
:root { 
    --primary-font: 'Libre Baskerville', serif;
    --secondary-font: 'Poppins', sans-serif;

    --bg: #ffffff; 
    --text-main: #37352F; 
    --text-secondary: #7D7C78;
    --accent: #37352F; 
    --gray-light: #F1F1EF; 
    --border: #E9E9E7; 

    --radius-pill: 50px;
    --radius-card: 20px;
    --shadow: rgba(0, 0, 0, 0.05) 0px 4px 12px;
}

* {
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--bg);
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.app-update-banner {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 32px);
    max-width: 540px;
    z-index: 1200;
}

.app-update-inner {
    background: #111111;
    color: #ffffff;
    border-radius: 16px;
    padding: 12px 14px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-family: var(--secondary-font);
    font-size: 14px;
    font-weight: 500;
}

.app-update-btn.btn-base {
    width: auto;
    min-width: 104px;
    border: none;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    color: #111111;
    background: #ffffff;
}

.app-update-btn.btn-base:hover {
    transform: none;
}

.hidden { display: none !important; }
.mt-12 { margin-top: 12px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.fw-500 { font-weight: 500; }

.container {
    background: #ffffff;
    padding: 48px 40px;
    border-radius: 32px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.05);
    width: 100%;
    max-width: 480px;
    box-sizing: border-box;
    text-align: center;
    position: relative;
    border: 1px solid rgba(0,0,0,0.03);
}

.header-row {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-bottom: 32px; /* Tightened and balanced */
    min-height: 48px;
}

h1, h2, h3 { 
    margin: 0;
    font-family: var(--primary-font);
    font-weight: 500;
}

h1 { font-size: 24px; color: #111; line-height: 1.2; margin-bottom: 8px; }
h2 { font-size: 20px; color: #111; line-height: 1.2; }

.hero-logo {
    width: 48px;
    height: 48px;
    margin-bottom: 24px;
}

p { 
    font-size: 15px; 
    color: var(--text-secondary); 
    margin-bottom: 32px; 
}

.substack-embed-wrap {
    width: 100%;
    margin: 0 auto;
}

#substack-embed {
    display: block;
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
}

/* BUTTONS */
.btn-base {
    width: 100%; 
    padding: 18px 24px; 
    border-radius: 16px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text-main);
    font-size: 16px; 
    font-weight: 600; 
    font-family: var(--secondary-font);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 2px rgba(0,0,0,0.02);
    display: flex;
    align-items: center;
    justify-content: center; /* Center content */
    gap: 12px;               /* Consistent spacing */
}

.btn-base img, .btn-base span {
    flex-shrink: 0;
}

.btn-base.is-dimmed {
    opacity: 0.5;
}

@media (hover: hover) {
    .btn-base:hover {
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    }
}

.btn-base:active { 
    transform: scale(0.98); 
}

.btn-base:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.action-btn { 
    background: var(--text-main); 
    color: white; 
    justify-content: center;
    border: none;
}

/* PAYMENT GRID */
.payment-grid { 
    display: flex; 
    flex-direction: column; 
    gap: 16px; 
    width: 100%; 
}

.payment-btn .price {
    font-weight: 400;
    color: var(--text-secondary);
}

/* Subtle hierarchy for penalties */
.level-3 { 
    border: 2px solid var(--text-main); 
    background: #fafafa; 
}

/* FOOTER / DONATION */
.footer { 
    margin-top: 32px;
    font-size: 13px; 
    color: var(--text-secondary); 
    padding-top: 32px; 
}

.footer:not(:empty) {
    border-top: 1px solid var(--border);
}

.footer a { 
    color: var(--text-main); 
    text-decoration: underline; 
    text-underline-offset: 2px;
}

a {
    color: var(--text-main);
}

#status-msg {
    margin: 0;
    min-height: 0;
    transition: all 0.2s ease;
}

#status-msg:not(:empty) {
    margin-top: 24px;
    margin-bottom: -8px; /* Offset some of the footer margin when present */
}

/* SETUP & CARD */
#card-element { 
    padding: 16px; 
    border: 1px solid var(--border); 
    border-radius: 12px; 
    margin-bottom: 24px; 
    background: #fff; 
}

.setup-spinner {
    width: 32px;
    height: 32px;
    border-width: 3px;
    margin: 40px auto;
    display: block;
    border-top-color: var(--text-main);
    border-left-color: rgba(0, 0, 0, 0.1);
    border-bottom-color: rgba(0, 0, 0, 0.1);
    border-right-color: rgba(0, 0, 0, 0.1);
}

/* iOS PROMPT */
#ios-install-prompt { 
    position: fixed; 
    bottom: 30px; 
    left: 50%; 
    transform: translateX(-50%); 
    width: 90%; 
    max-width: 360px; 
    z-index: 999; 
}

#android-install-prompt {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 360px;
    z-index: 999;
}

.prompt-box { 
    background: #fff; 
    border: 1px solid var(--border); 
    padding: 24px; 
    border-radius: 20px; 
    box-shadow: 0 20px 40px rgba(0,0,0,0.1); 
    text-align: left; 
}

.arrow-down { 
    width: 0; 
    height: 0; 
    border-left: 12px solid transparent; 
    border-right: 12px solid transparent; 
    border-top: 12px solid #fff; 
    margin: -1px auto 0; 
    filter: drop-shadow(0 2px 2px rgba(0,0,0,0.05)); 
}

/* SPINNER */
.btn-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    margin-left: 8px;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
    opacity: 1;
    transition: opacity 0.2s ease;
}

.btn-spinner.hidden {
    opacity: 0;
    width: 0;
    margin-left: 0;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.mini-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-top: 2px solid var(--text-main);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.day-toggle.yes .mini-spinner {
    border-color: rgba(76, 175, 80, 0.2);
    border-top-color: #4CAF50;
}

/* Failed state mini-spinner style removed */


/* NAV BUTTONS */
.nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 16px; /* Match btn-base */
    width: 48px;         /* Match heading height */
    height: 48px;
    cursor: pointer;
    font-family: inherit;
    font-size: 18px;     /* Slightly larger for icons */
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 2px rgba(0,0,0,0.02);
    z-index: 10;
    padding: 0;          /* Reset padding for center alignment */
}

@media (hover: hover) {
    .nav-btn:hover {
        transform: translateY(-50%) translateY(-1px); /* Combine translateY for alignment and hover effect */
        box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    }
}

.nav-btn:active {
    transform: translateY(-50%) scale(0.98);
}

.settings-trigger {
    right: 0;
}

.back-link {
    left: 0;
}

.settings-group {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
}

.settings-header-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.link-btn {
    text-decoration: none;
    color: inherit;
}

.delete-btn {
    color: #df3434 !important;
    border-color: #ff000022 !important;
}

.delete-btn:hover {
    background: #fff0f0 !important;
    border-color: #df343433 !important;
}

/* EXPLAINER CONTENT */
.explainer-content {
    text-align: left;
    margin-top: 16px;
}

.explainer-content p {
    margin-bottom: 24px;
    line-height: 1.6;
}

.footer p {
    margin: 4px 0;
}

/* INPUTS */
.input-group {
    position: relative;
    margin-bottom: 24px;
}

.input-field {
    width: 100%;
    padding: 18px;
    border-radius: 16px;
    border: 1px solid var(--border);
    font-size: 16px;
    font-family: var(--secondary-font);
    outline: none;
    transition: border-color 0.2s;
}

.input-field:focus {
    border-color: var(--text-main);
}

.currency-prefix {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    color: var(--text-main);
    font-weight: 600;
}

.amount-input {
    padding-left: 40px;
    font-size: 24px;
    font-weight: 600;
    text-align: center;
}

/* SPLIT INFO */
.split-info {
    background: var(--gray-light);
    padding: 16px;
    border-radius: 16px;
    margin-bottom: 24px;
    cursor: pointer;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.split-info p {
    margin: 0;
    font-size: 14px;
    color: var(--text-main);
    text-align: center;
}

.btn-text {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 13px;
    padding: 0;
    margin-top: 8px;
    text-decoration: underline;
    cursor: pointer;
    text-align: center;
}

.split-note {
    margin: -10px 0 20px;
    font-size: 12px;
    color: var(--text-secondary);
}

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

.modal-content {
    max-width: 400px;
}

.modal-content .action-btn {
    margin-top: 32px;
}

.modal-content .split-note + .action-btn {
    margin-top: 14px;
}

.ratio-labels {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* FREQUENCY PICKER */
.frequency-picker {
    margin: 32px 0;
}

.freq-value {
    font-size: 24px;
    font-weight: 600;
    margin-top: 8px;
    color: var(--text-main);
}

/* CUSTOM RANGE SLIDER */
input[type=range] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    background: transparent;
    margin: 12px 0;
}

input[type=range]:focus {
    outline: none;
}

input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    cursor: pointer;
    background: var(--gray-light);
    border-radius: 2px;
}

input[type=range]::-webkit-slider-thumb {
    height: 18px;
    width: 18px;
    border-radius: 50%;
    background: var(--text-main);
    cursor: pointer;
    -webkit-appearance: none;
    margin-top: -7px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

input[type=range]:active::-webkit-slider-thumb {
    transform: scale(1.1);
}

input[type=range]::-moz-range-track {
    width: 100%;
    height: 4px;
    cursor: pointer;
    background: var(--gray-light);
    border-radius: 2px;
}

input[type=range]::-moz-range-thumb {
    height: 18px;
    width: 18px;
    border-radius: 50%;
    background: var(--text-main);
    cursor: pointer;
    border: none;
}

/* WEEKLY GRID */
.weekly-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    margin-top: 16px;
    width: 100%;
}

.day-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.day-label {
    font-size: 10px;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.day-toggle {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s;
}

.day-toggle.yes {
    background: #E8F5E9;
    border-color: #4CAF50;
    color: #4CAF50;
}

/* No visual failed state (now empty) */

.day-toggle.future {
    background: #f9f9f9;
    opacity: 0.5;
    cursor: not-allowed;
}

/* SETTINGS */
.setting-item {
    text-align: left;
    margin-bottom: 8px;
}

.setting-item label {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

/* Removed old day picker styles */

.schedule-group {
    width: 100%;
    display: flex;
    justify-content: center;
}

.time-input {
    font-size: 22px;
    text-align: center;
    display: block;
    width: 100%;
    max-width: 260px;
    min-width: 0;
    box-sizing: border-box;
    margin: 0 auto 20px;
}

/* NOTIFICATION PREVIEW */
.notification-preview {
    margin: 20px 0 32px;
    background: #f8f8f8;
    padding: 24px;
    border-radius: 24px;
}

.preview-box {
    background: #fff;
    padding: 16px;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    text-align: left;
}

.preview-box strong { display: block; font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; }
.preview-box span { display: block; font-size: 15px; margin-bottom: 12px; }

.preview-actions {
    display: flex;
    justify-content: space-around;
    border-top: 1px solid var(--border);
    padding-top: 12px;
    font-size: 14px;
    font-weight: 600;
    color: #007AFF;
}

.success-icon {
    font-size: 64px;
    margin-bottom: 24px;
}

/* COMMITMENT CARDS */
.commitment-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 20px;
    text-align: left;
    margin-bottom: 16px;
    transition: all 0.2s;
    cursor: pointer;
}

.commitment-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-2px);
    background: #fafafa;
}

.commitment-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.commitment-text {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-main);
}

.commitment-meta {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Unused buttons removed from card */

/* CHECK-IN UI */
.checkin-actions {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 32px;
}

.checkin-btn {
    font-size: 18px !important;
    padding: 20px !important;
}

.checkin-btn.yes { border: 2px solid #4CAF50; color: #4CAF50; }
.checkin-btn.no { border: 2px solid #df3434; color: #df3434; }
.checkin-btn.dodge { border: 2px solid var(--text-secondary); color: var(--text-secondary); }
.checkin-btn.is-muted { opacity: 0.3; }

.pulse-animation {
    animation: pulse 0.6s infinite alternate;
}

@keyframes pulse {
    from { transform: scale(1); box-shadow: 0 0 0 rgba(0,0,0,0); }
    to { transform: scale(1.05); box-shadow: 0 4px 20px rgba(0,0,0,0.1); }
}

.status-msg {
    margin-top: 24px;
    font-weight: 500;
    font-style: italic;
    color: var(--text-secondary);
}

/* STATS STYLES */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-top: 32px;
}

.stat-item {
    background: #f9f9f9;
    padding: 24px;
    border-radius: 12px;
    text-align: center;
}

.stat-label {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    font-size: 2rem;
    font-weight: 600;
}

.stats-footer {
    margin-top: 48px;
}

.stats-chart {
    margin-top: 24px;
    min-height: 250px;
}

.stats-loading {
    padding: 40px;
    color: var(--text-secondary);
}

/* MOBILE ADJUSTMENTS */
@media (max-width: 480px) {
    body {
        padding: 12px;
    }
    .container {
        padding: 40px 24px;
        border-radius: 24px;
    }
    .input-field {
        padding: 16px;
    }
    .time-input {
        font-size: 20px;
        max-width: 240px;
        margin: 0 auto 20px;
    }
}

/* ACHIEVEMENTS & ANIMATIONS */
.emoji-rain-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 9999;
    overflow: hidden;
}

.falling-emoji {
    position: absolute;
    top: -50px;
    font-size: 32px;
    animation-name: fall;
    animation-timing-function: linear;
    animation-fill-mode: forwards;
}

.emoji-variant-1 { left: 5vw; animation-duration: 2.4s; animation-delay: 0.1s; opacity: 0.6; }
.emoji-variant-2 { left: 17vw; animation-duration: 2.9s; animation-delay: 0.3s; opacity: 0.75; }
.emoji-variant-3 { left: 29vw; animation-duration: 3.2s; animation-delay: 0.15s; opacity: 0.55; }
.emoji-variant-4 { left: 41vw; animation-duration: 2.6s; animation-delay: 0.4s; opacity: 0.8; }
.emoji-variant-5 { left: 53vw; animation-duration: 3.4s; animation-delay: 0.2s; opacity: 0.65; }
.emoji-variant-6 { left: 65vw; animation-duration: 2.7s; animation-delay: 0.5s; opacity: 0.7; }
.emoji-variant-7 { left: 77vw; animation-duration: 3.1s; animation-delay: 0.25s; opacity: 0.6; }
.emoji-variant-8 { left: 89vw; animation-duration: 2.5s; animation-delay: 0.35s; opacity: 0.85; }

.qr-code {
    margin-bottom: 24px;
    display: flex;
    justify-content: center;
}

.text-small {
    font-size: 13px;
}

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

.ios-close-btn {
    border: none;
    background: none;
    padding: 10px;
    margin: -10px;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    color: inherit;
}

.ios-install-text {
    margin: 5px 0;
    font-size: 13px;
}

.ios-share-icon {
    vertical-align: middle;
    margin: 0 2px;
}

#android-install-btn.btn-base {
    margin-top: 16px;
}

.status-processing {
    color: #666;
}

.status-success {
    color: #111;
}

.script-warning {
    color: #c62f2f;
    font-size: 12px;
    margin-top: 20px;
}

.copy-buffer {
    position: fixed;
    top: -1000px;
    left: -1000px;
    opacity: 0;
    pointer-events: none;
}

@media (max-width: 520px) {
    .app-update-inner {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }

    .app-update-btn.btn-base {
        width: 100%;
    }
}

@keyframes fall {
    to {
        transform: translateY(110vh) rotate(360deg);
    }
}
