/* === Donasi CMS — Warm & Clean === */

:root {
    --bg: #faf7f2;
    --surface: #ffffff;
    --surface-dim: #f0ece4;
    --text: #1a1612;
    --text-secondary: #6b5e50;
    --primary: #b85c2c;
    --primary-light: #e8a87c;
    --primary-container: #fde8d8;
    --on-primary: #ffffff;
    --accent: #2c7a5b;
    --accent-container: #d4f0e4;
    --danger: #b33a3a;
    --danger-container: #fde0e0;
    --border: #e0d8cc;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(30, 20, 10, 0.06), 0 4px 12px rgba(30, 20, 10, 0.04);
    --shadow-lg: 0 4px 16px rgba(30, 20, 10, 0.08), 0 8px 32px rgba(30, 20, 10, 0.04);
    --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
    --font-mono: 'Cascadia Code', 'Fira Code', monospace;
    --max-w: 1100px;
    --transition: 0.2s ease;
}

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

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* === Topbar === */

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 56px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-brand {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
}

.brand-icon {
    font-size: 1.4rem;
    color: var(--primary);
}

.topbar-links {
    display: flex;
    gap: 20px;
    font-size: 0.9rem;
}

.topbar-links a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color var(--transition);
}

.topbar-links a:hover { color: var(--primary); }

/* === Container === */

.container {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 32px 24px;
}

/* === Hero === */

.hero {
    text-align: center;
    padding: 48px 0 40px;
}

.hero h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text);
}

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

/* === Campaign Grid === */

.campaign-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

.campaign-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    text-decoration: none;
    color: var(--text);
    transition: box-shadow var(--transition), transform var(--transition);
    display: block;
}

.campaign-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
    text-decoration: none;
}

.card-image {
    height: 180px;
    background-size: cover;
    background-position: center;
    background-color: var(--surface-dim);
}

.card-image--default {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: var(--primary-light);
    background: var(--primary-container);
}

.card-body {
    padding: 20px;
}

.card-body h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 12px;
    line-height: 1.3;
}

.card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* === Progress Bar === */

.progress-wrap { width: 100%; }

.progress-bar {
    height: 8px;
    background: var(--surface-dim);
    border-radius: 99px;
    overflow: hidden;
}

.progress-bar--large { height: 12px; }
.progress-bar--small { height: 6px; display: inline-block; width: 80px; vertical-align: middle; }

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    border-radius: 99px;
    transition: width 0.6s ease;
    min-width: 0;
}

.progress-stats {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 0.85rem;
}

.progress-stats .raised {
    font-weight: 700;
    color: var(--primary);
}

.progress-stats .goal { color: var(--text-secondary); }

.progress-pct {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-left: 6px;
}

/* === Badges === */

.badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 99px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge--active { background: var(--accent-container); color: var(--accent); }
.badge--ended { background: var(--surface-dim); color: var(--text-secondary); }

/* === Campaign Detail === */

.campaign-header { margin-bottom: 24px; }

.campaign-header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-top: 8px;
}

.back-link {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.campaign-layout {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 32px;
    align-items: start;
}

@media (max-width: 768px) {
    .campaign-layout {
        grid-template-columns: 1fr;
    }
    .campaign-sidebar { order: -1; }
}

.campaign-hero-img {
    width: 100%;
    border-radius: var(--radius);
    margin-bottom: 24px;
    max-height: 400px;
    object-fit: cover;
}

.campaign-description {
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text);
    margin-bottom: 32px;
    white-space: pre-line;
}

/* === Sidebar === */

.sidebar-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    position: sticky;
    top: 72px;
}

.sidebar-raised {
    margin-bottom: 16px;
}

.big-amount {
    display: block;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary);
}

.goal-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.ends-at {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 12px 0;
}

/* === Donate Form === */

.donate-form {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.donate-form h3 {
    font-size: 1.1rem;
    margin-bottom: 16px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    transition: border-color var(--transition);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-container);
}

.quick-amounts {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.quick-amounts button {
    flex: 1;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.quick-amounts button:hover {
    background: var(--primary-container);
    border-color: var(--primary-light);
    color: var(--primary);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    margin-bottom: 16px;
    color: var(--text-secondary);
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.donate-message {
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
}

.donate-message--ok {
    background: var(--accent-container);
    color: var(--accent);
}

.donate-message--err {
    background: var(--danger-container);
    color: var(--danger);
}

.ended-notice {
    margin-top: 24px;
    padding: 16px;
    background: var(--surface-dim);
    border-radius: var(--radius-sm);
    text-align: center;
    color: var(--text-secondary);
}

/* === Donor Wall === */

.donor-wall { margin-top: 8px; }

.donor-wall h2 {
    font-size: 1.2rem;
    margin-bottom: 16px;
}

.donor-entry {
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}

.donor-entry:last-child { border-bottom: none; }

.donor-info {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.donor-info strong { font-size: 0.95rem; }

.donor-amount {
    font-weight: 700;
    color: var(--primary);
    font-size: 0.95rem;
}

.donor-message {
    margin-top: 4px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-style: italic;
}

.donor-time {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* === Buttons === */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    border: none;
    transition: all var(--transition);
    text-decoration: none;
    gap: 6px;
}

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

.btn--primary:hover {
    background: #a0501f;
    text-decoration: none;
}

.btn--outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}

.btn--outline:hover {
    background: var(--surface-dim);
    text-decoration: none;
}

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

.btn--danger:hover { background: #9a2e2e; }

.btn--sm {
    padding: 5px 12px;
    font-size: 0.8rem;
}

.btn--full { width: 100%; }

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* === Auth === */

.auth-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
}

.auth-card {
    background: var(--surface);
    padding: 40px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
}

.auth-card h2 {
    margin-bottom: 24px;
    text-align: center;
}

/* === Admin === */

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    flex-wrap: wrap;
    gap: 12px;
}

.admin-header h1 { font-size: 1.6rem; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--surface);
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.admin-section {
    margin-bottom: 40px;
}

.admin-section h2 {
    font-size: 1.2rem;
    margin-bottom: 16px;
}

.admin-table-wrap {
    overflow-x: auto;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

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

.admin-table th {
    text-align: left;
    padding: 12px 16px;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.admin-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.admin-table tr:last-child td { border-bottom: none; }

.admin-table a { font-weight: 500; }

.action-cell {
    display: flex;
    gap: 6px;
    align-items: center;
}

.inline-form { display: inline; }

.msg-cell {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* === Form Page === */

.form-wrap {
    max-width: 600px;
    background: var(--surface);
    padding: 32px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.form-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 16px;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

/* === Alerts === */

.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.alert--error {
    background: var(--danger-container);
    color: var(--danger);
}

/* === Empty State === */

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* === Footer === */

.site-footer {
    text-align: center;
    padding: 32px 24px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    border-top: 1px solid var(--border);
    margin-top: 48px;
}

/* === Responsive === */

@media (max-width: 600px) {
    .container { padding: 20px 16px; }
    .hero h1 { font-size: 1.5rem; }
    .campaign-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .form-row { grid-template-columns: 1fr; }
    .topbar { padding: 0 16px; }
    .topbar-links { gap: 12px; font-size: 0.85rem; }
    .auth-card { padding: 24px; }
    .form-wrap { padding: 20px; }
    .admin-header h1 { font-size: 1.3rem; }
}
