/* ============================================
   VARIÁVEIS E TEMAS
============================================ */
:root {
   --font-main: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
   --radius: 16px;
   --radius-sm: 10px;
   --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
   --shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
   --shadow-md: 0 8px 32px rgba(0,0,0,0.12);
   --accent: #36647D;
   --accent-light: #5A8CA6;
   --accent-glow: rgba(54, 100, 125, 0.25);
   --success: #36647D;
   --success-bg: rgba(54, 100, 125, 0.1);
   --bg-primary: #F8F9FC;
   --bg-secondary: #FFFFFF;
   --bg-tertiary: #F0F2F8;
   --bg-input: #F4F5FA;
   --text-primary: #1A1D2E;
   --text-secondary: #5A5F7A;
   --text-muted: #8E92A8;
   --border: #E4E6F0;
   --card-bg: #FFFFFF;
   --splash-bg: #FFFFFF;
   --splash-text: #36647D;
   --overlay: rgba(255, 255, 255, 0.85);
}

[data-theme="dark"] {
   --bg-primary: #0D0F1A;
   --bg-secondary: #161828;
   --bg-tertiary: #1E2035;
   --bg-input: #1E2035;
   --text-primary: #EAEAF0;
   --text-secondary: #9A9BB0;
   --text-muted: #5A5C72;
   --accent: #5A8CA6;
   --accent-light: #36647D;
   --accent-glow: rgba(90, 140, 166, 0.3);
   --success: #5A8CA6;
   --success-bg: rgba(90, 140, 166, 0.12);
   --border: #2A2D42;
   --card-bg: #161828;
   --splash-bg: #FFFFFF;
   --splash-text: #36647D;
   --overlay: rgba(13, 15, 26, 0.9);
}

/* ============================================
   RESET E BASE
============================================ */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
   font-family: var(--font-main);
   background: var(--bg-primary);
   color: var(--text-primary);
   min-height: 100vh;
   transition: background var(--transition), color var(--transition);
   overflow-x: hidden;
}

/* ============================================
   SPLASH SCREEN
============================================ */
#splash-screen {
   position: fixed; inset: 0; z-index: 9999;
   display: flex; flex-direction: column; align-items: center; justify-content: center;
   background: var(--splash-bg);
   transition: opacity 0.6s ease, transform 0.6s ease;
}
#splash-screen.hide { opacity: 0; transform: scale(1.05); pointer-events: none; }

.splash-icon {
   width: 100px; height: 100px;
   background: rgba(54, 100, 125, 0.1);
   border-radius: 28px; display: flex; align-items: center; justify-content: center;
   backdrop-filter: blur(10px);
   border: 1px solid rgba(54, 100, 125, 0.2);
   animation: pulse-glow 2s ease-in-out infinite;
}
.splash-icon svg { width: 48px; height: 48px; fill: var(--splash-text); }

@keyframes pulse-glow {
   0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(54, 100, 125, 0.2); }
   50% { transform: scale(1.05); box-shadow: 0 0 40px 10px rgba(54, 100, 125, 0.15); }
}

.splash-title { font-size: 2.5rem; font-weight: 800; color: var(--splash-text); letter-spacing: -1px; margin-top: 24px; }
.splash-subtitle { font-size: 1rem; color: var(--splash-text); opacity: 0.7; margin-top: 8px; }

.splash-loader { margin-top: 40px; display: flex; gap: 8px; }
.splash-loader span {
   width: 10px; height: 10px; border-radius: 50%;
   background: var(--splash-text); opacity: 0.6;
   animation: bounce 1.4s ease-in-out infinite both;
}
.splash-loader span:nth-child(1) { animation-delay: -0.32s; }
.splash-loader span:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
   0%, 80%, 100% { transform: scale(0.6); opacity: 0.3; }
   40% { transform: scale(1); opacity: 1; }
}

/* ============================================
   HOME SCREEN
============================================ */
#home-screen { display: none; min-height: 100vh; opacity: 0; transition: opacity 0.6s ease; }
#home-screen.show { display: block; opacity: 1; }

/* Header */
.app-header {
   position: sticky; top: 0; z-index: 100;
   background: var(--overlay); backdrop-filter: blur(20px);
   border-bottom: 1px solid var(--border);
   padding: 16px 24px; display: flex; align-items: center; justify-content: space-between;
}
.header-brand { display: flex; align-items: center; gap: 12px; }
.header-brand h1 { font-size: 1.2rem; font-weight: 800; color: var(--text-primary); }

.theme-toggle {
   width: 44px; height: 44px; border-radius: 14px; border: 1px solid var(--border);
   background: var(--bg-secondary); cursor: pointer; display: flex; align-items: center;
   justify-content: center; font-size: 1.25rem; transition: all var(--transition); color: var(--text-primary);
}
.theme-toggle:hover { background: var(--accent); border-color: var(--accent); }
.theme-toggle:hover .theme-icon { filter: brightness(0) invert(1); }

/* Container */
.main-container { max-width: 680px; margin: 0 auto; padding: 24px 20px 40px; }

/* Banner da Igreja */
.church-banner {
   background: linear-gradient(135deg, var(--accent) 0%, var(--accent-light) 100%);
   border-radius: var(--radius); padding: 28px 24px; margin-bottom: 24px;
   color: white; position: relative; overflow: hidden; box-shadow: 0 8px 32px var(--accent-glow);
}
.church-banner h2 { font-size: 1rem; font-weight: 600; opacity: 0.9; margin-bottom: 4px; }
.church-banner .church-name { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.5px; }
.church-banner .church-verse { margin-top: 12px; font-size: 0.85rem; opacity: 0.85; font-style: italic; }

/* Cards */
.card {
   background: var(--card-bg); border: 1px solid var(--border);
   border-radius: var(--radius); padding: 24px; margin-bottom: 20px;
   transition: all var(--transition); box-shadow: var(--shadow-sm);
}
.card-title {
   font-size: 0.8rem; font-weight: 700; text-transform: uppercase;
   letter-spacing: 1.5px; color: var(--text-muted); margin-bottom: 16px;
   display: flex; align-items: center; gap: 8px;
}

/* QR Code */
.qr-code-container {
   background: white; padding: 16px; border-radius: 12px;
   display: inline-block; margin: 16px 0;
   box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.pix-label { font-size: 0.75rem; font-weight: 700; color: var(--success); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px; }

.pix-copy-paste {
   font-size: 0.85rem; font-weight: 600; color: var(--text-primary);
   font-family: 'Courier New', monospace; word-break: break-all;
   padding: 12px; background: var(--bg-secondary); border: 1px dashed var(--border);
   border-radius: 8px; margin-top: 12px; cursor: pointer;
   transition: all var(--transition); position: relative;
}
.pix-copy-paste:hover { background: var(--bg-tertiary); border-color: var(--accent); }

.btn-copy {
   margin-top: 12px; padding: 10px 20px; border: none; border-radius: 8px;
   background: var(--accent); color: white; font-weight: 700; cursor: pointer;
   display: inline-flex; align-items: center; gap: 8px; transition: all var(--transition);
}
.btn-copy:hover { background: var(--accent-light); transform: translateY(-1px); }

/* Formulário */
.form-grid { display: grid; gap: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 0.75rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.8px; }

.form-group input {
   padding: 12px 16px; border: 2px solid var(--border); border-radius: var(--radius-sm);
   background: var(--bg-input); color: var(--text-primary); font-size: 0.95rem;
   font-family: var(--font-main); transition: all var(--transition); outline: none;
}
.form-group input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); background: var(--bg-secondary); }
.form-group input[readonly] { background: var(--bg-tertiary); border-color: var(--border); color: var(--text-secondary); cursor: default; }

.readonly-highlight { background: var(--accent-glow) !important; border-color: var(--accent) !important; color: var(--accent) !important; font-weight: 700 !important; }

/* Contribuições */
.contribution-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.contribution-card {
   background: var(--bg-input); border: 2px solid var(--border);
   border-radius: var(--radius-sm); padding: 16px; transition: all var(--transition);
}
.contribution-card:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }

.contrib-label { font-size: 0.7rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }

.input-wrap { position: relative; }
.input-wrap .prefix { position: absolute; left: 0; top: 50%; transform: translateY(-50%); font-size: 0.9rem; font-weight: 700; color: var(--text-muted); }

.contribution-card input {
   width: 100%; padding: 8px 8px 8px 30px; border: none; background: transparent;
   color: var(--text-primary); font-size: 1.15rem; font-weight: 700; font-family: var(--font-main); outline: none;
}

/* Total */
.total-section {
   background: linear-gradient(135deg, var(--accent) 0%, var(--accent-light) 100%);
   border-radius: var(--radius); padding: 24px; margin-top: 24px;
   color: white; display: flex; align-items: center; justify-content: space-between;
   box-shadow: 0 8px 32px var(--accent-glow); position: relative; overflow: hidden;
}
.total-label { font-size: 0.85rem; font-weight: 600; opacity: 0.9; text-transform: uppercase; letter-spacing: 1px; }
.total-value { font-size: 2rem; font-weight: 800; letter-spacing: -1px; }

/* Botão Principal */
.btn-submit {
   width: 100%; padding: 18px 32px; border: none; border-radius: var(--radius);
   background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
   color: white; font-size: 1.05rem; font-weight: 700; font-family: var(--font-main);
   cursor: pointer; transition: all var(--transition); margin-top: 24px;
   display: flex; align-items: center; justify-content: center; gap: 10px;
   box-shadow: 0 8px 24px rgba(37, 211, 102, 0.3);
}
.btn-submit:hover { transform: translateY(-2px); box-shadow: 0 12px 36px rgba(37, 211, 102, 0.4); }
.btn-submit:disabled { opacity: 0.6; cursor: not-allowed; transform: none !important; }

/* Footer */
.app-footer { text-align: center; padding: 24px; color: var(--text-muted); font-size: 0.75rem; }

/* Modal */
.modal-overlay {
   position: fixed; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(8px);
   z-index: 5000; display: none; align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay.show { display: flex; }

.modal-content {
   background: var(--bg-secondary); border-radius: var(--radius); padding: 32px;
   max-width: 440px; width: 100%; box-shadow: 0 16px 48px rgba(0,0,0,0.2);
   animation: modalIn 0.3s ease; text-align: center;
}
@keyframes modalIn { from { opacity: 0; transform: scale(0.9) translateY(20px); } to { opacity: 1; transform: scale(1) translateY(0); } }

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

.modal-btn {
   flex: 1; padding: 14px; border: none; border-radius: var(--radius-sm);
   font-size: 0.95rem; font-weight: 600; cursor: pointer; transition: all var(--transition);
}
.modal-btn.cancel { background: var(--bg-tertiary); color: var(--text-secondary); }
.modal-btn.confirm { background: #25D366; color: white; }
.modal-btn.confirm:hover { background: #128C7E; }

/* Toast */
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 10000; display: flex; flex-direction: column; gap: 10px; }

.toast {
   padding: 14px 20px; border-radius: var(--radius-sm); background: var(--bg-secondary);
   border: 1px solid var(--border); box-shadow: 0 8px 32px rgba(0,0,0,0.12);
   color: var(--text-primary); font-size: 0.9rem; font-weight: 500;
   display: flex; align-items: center; gap: 10px; animation: toastIn 0.4s ease; max-width: 360px;
}
.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid #E17055; }

@keyframes toastIn { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

/* ============================================
   RESPONSIVIDADE
============================================ */
@media (max-width: 600px) {
   .main-container { padding: 16px; }
   .contribution-grid { grid-template-columns: 1fr; }
   .form-row { grid-template-columns: 1fr; }
   .total-section { flex-direction: column; gap: 8px; text-align: center; }
}