/* Gift Pool - mobile-first standalone app styling */
:root {
    --gp-primary: #c2185b;
    --gp-primary-dark: #8c0f41;
    --gp-primary-light: #fce4ec;
    --gp-confirm: #2e7d32;
    --gp-confirm-light: #e8f5e9;
    --gp-danger: #c62828;
    --gp-text: #212121;
    --gp-muted: #757575;
    --gp-bg: #faf7f8;
    --gp-card: #ffffff;
    --gp-border: #e0dcdd;
    --gp-radius: 12px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--gp-bg);
    color: var(--gp-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.45;
}

.container {
    max-width: 640px;
    margin: 0 auto;
    padding: 12px 12px calc(24px + env(safe-area-inset-bottom));
}

/* Header */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 0 14px;
}

.app-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--gp-text);
}

.app-brand h1 {
    font-size: 1.35rem;
    margin: 0;
    color: var(--gp-primary);
}

.app-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
}

.app-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-badge {
    font-size: 0.85rem;
    color: var(--gp-muted);
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gp-primary-light);
    color: var(--gp-primary);
    text-decoration: none;
    font-size: 1.1rem;
}

.app-footer {
    text-align: center;
    color: var(--gp-muted);
    font-size: 0.8rem;
    margin-top: 28px;
}

.app-footer a { color: var(--gp-muted); }

/* Page title */
.page-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.page-title-row h2 {
    margin: 0;
    font-size: 1.3rem;
}

h3 { margin: 0 0 10px; font-size: 1.05rem; }
h4 { margin: 0 0 6px; font-size: 0.95rem; }

/* Cards */
.card {
    display: block;
    background: var(--gp-card);
    border: 1px solid var(--gp-border);
    border-radius: var(--gp-radius);
    padding: 16px;
    margin-bottom: 14px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    color: inherit;
    text-decoration: none;
}

.highlight-card {
    border-color: var(--gp-primary);
    background: #fffafc;
}

a.pool-card:active { background: var(--gp-primary-light); }

.pool-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}

.pool-title { font-weight: 600; font-size: 1.05rem; }
.pool-date { color: var(--gp-muted); font-size: 0.85rem; margin: 4px 0; }

.pool-card-bottom {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--gp-muted);
    flex-wrap: wrap;
}

/* Status badges */
.status-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    background: #eeeeee;
    color: #424242;
    white-space: nowrap;
}

.status-open { background: var(--gp-primary-light); color: var(--gp-primary-dark); }
.status-funded, .contrib-confirmed { background: var(--gp-confirm-light); color: var(--gp-confirm); }
.status-payoutrequested, .status-purchased { background: #fff8e1; color: #8d6e00; }
.status-completed { background: var(--gp-confirm-light); color: var(--gp-confirm); }
.status-cancelled, .contrib-declined { background: #fbe9e7; color: var(--gp-danger); }
.contrib-invited { background: #eeeeee; color: #424242; }
.contrib-pledged { background: var(--gp-primary-light); color: var(--gp-primary-dark); }
.contrib-markedpaid { background: #fff8e1; color: #8d6e00; }

/* Progress */
.progress-track {
    position: relative;
    height: 10px;
    background: #efe9eb;
    border-radius: 999px;
    overflow: hidden;
    margin: 10px 0 6px;
}

.progress-track.big { height: 16px; }

.progress-fill {
    position: absolute;
    inset: 0 auto 0 0;
    border-radius: 999px;
}

.progress-fill.pledged { background: #f48fb1; }
.progress-fill.confirmed { background: var(--gp-primary); }

.totals-row {
    display: flex;
    gap: 8px;
    margin: 12px 0;
}

.total-box {
    flex: 1;
    text-align: center;
    background: var(--gp-bg);
    border-radius: 8px;
    padding: 8px 4px;
}

.total-value { display: block; font-weight: 700; }
.total-label { display: block; font-size: 0.75rem; color: var(--gp-muted); }

/* Alerts */
.alert {
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 12px;
    font-size: 0.95rem;
}

.alert-success { background: var(--gp-confirm-light); color: var(--gp-confirm); }
.alert-error { background: #fbe9e7; color: var(--gp-danger); }

/* Forms */
label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin: 12px 0 4px;
}

input, textarea, select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--gp-border);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    background: #fff;
}

input:focus, textarea:focus {
    outline: 2px solid var(--gp-primary);
    outline-offset: 0;
    border-color: var(--gp-primary);
}

input[type="file"] { padding: 8px; }

.hint { color: var(--gp-muted); font-size: 0.85rem; margin: 8px 0 0; }
.hint.center { text-align: center; }

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 18px;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    margin-top: 12px;
    background: #eeeeee;
    color: var(--gp-text);
}

.btn-primary { background: var(--gp-primary); color: #fff; }
.btn-primary:active { background: var(--gp-primary-dark); }
.btn-primary:disabled { background: #d8b4c4; cursor: not-allowed; }
.btn-secondary { background: #eeeeee; color: var(--gp-text); }
.btn-confirm { background: var(--gp-confirm); color: #fff; }
.btn-danger { background: var(--gp-danger); color: #fff; }
.btn-block { display: block; width: 100%; }
.btn-small { padding: 5px 10px; font-size: 0.8rem; margin-top: 4px; }
.btn-link {
    background: none;
    color: var(--gp-muted);
    text-decoration: underline;
    padding: 6px 0;
    font-weight: 400;
}

/* Gift list */
.gift-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.gift-item {
    padding: 10px 0;
    border-bottom: 1px solid var(--gp-border);
}

.gift-item:last-child { border-bottom: none; }

.gift-item.chosen {
    background: var(--gp-confirm-light);
    border-radius: 8px;
    padding: 10px;
}

.gift-item-main {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.gift-name { font-weight: 600; }
.gift-price { white-space: nowrap; }
.gift-notes { color: var(--gp-muted); font-size: 0.85rem; margin-top: 2px; }
.gift-link { font-size: 0.85rem; color: var(--gp-primary); }

.gift-item-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.gift-item-actions form { display: inline; }

/* Contributor table */
.table-scroll { overflow-x: auto; }

.contrib-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.contrib-table th, .contrib-table td {
    text-align: left;
    padding: 8px 6px;
    border-bottom: 1px solid var(--gp-border);
    vertical-align: middle;
}

.contrib-table th { font-size: 0.75rem; color: var(--gp-muted); text-transform: uppercase; }
.contrib-table .num { text-align: right; white-space: nowrap; }
.contrib-table .actions { text-align: right; }
.contrib-table .actions form { display: inline-block; margin-left: 4px; }
.contrib-table td:first-child { word-break: break-all; }

/* Collapsible add blocks */
.add-block { margin-top: 14px; }

.add-block summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--gp-primary);
    padding: 6px 0;
}

.danger-zone summary { color: var(--gp-danger); }

/* Contribute page */
.invite-intro { margin: 0 0 8px; }

blockquote {
    margin: 10px 0;
    padding: 8px 14px;
    border-left: 4px solid var(--gp-primary);
    background: var(--gp-primary-light);
    border-radius: 0 8px 8px 0;
    white-space: pre-line;
}

.pledge-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.pledge-row input { flex: 1; }
.pledge-row .btn { margin-top: 0; }

.pay-box {
    background: var(--gp-bg);
    border: 1px dashed var(--gp-border);
    border-radius: 8px;
    padding: 12px;
    margin-top: 14px;
}

.pay-instructions { white-space: pre-line; margin: 0; }

.decline-form { text-align: center; }

.gift-photo {
    display: block;
    width: 100%;
    max-width: 420px;
    margin: 8px auto;
    border-radius: var(--gp-radius);
}

/* Empty state */
.empty-state { text-align: center; padding: 32px 16px; }
.empty-emoji { font-size: 3rem; margin-bottom: 8px; }

/* Help page */
.help-steps { margin: 0; padding-left: 22px; }
.help-steps li { margin-bottom: 12px; }
.help-steps li:last-child { margin-bottom: 0; }
.help-steps.plain { list-style: none; padding-left: 0; }
.help-steps.plain li { margin-bottom: 8px; }

.help-faq dt { font-weight: 600; margin-top: 14px; }
.help-faq dt:first-child { margin-top: 0; }
.help-faq dd { margin: 4px 0 0; color: var(--gp-muted); }

.center-card { text-align: center; }
