/* ============================================
   SENFF Fatura Digital - Design Institucional
   Cores oficiais SENFF: #0B1C54 #0F2467 #fff
   ============================================ */

:root {
    --senff-dark: #0B1C54;
    --senff-blue: #0F2467;
    --senff-accent: #1a3a8f;
    --senff-light-blue: #e8edf5;
    --bg-page: #EDF0F3;
    --bg-card: #ffffff;
    --text-primary: #1a1a2e;
    --text-secondary: #6C6E71;
    --text-muted: #9a9da1;
    --border-color: #e2e5ea;
    --border-light: #f0f1f3;
    --success: #0f8b4c;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.1);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: 0.25s ease;
}

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

body {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-page);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

html {
    overflow-x: hidden;
}

/* ---- SCREENS ---- */
.screen { display: none; min-height: 100vh; width: 100%; }
.screen.active { display: flex; flex-direction: column; width: 100%; }

/* ---- LOGIN ---- */
.login-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    width: 100%;
    background: linear-gradient(160deg, #0B1C54 0%, #0F2467 40%, #1a3a8f 100%);
    padding: 20px;
}

.login-card {
    background: #fff;
    border-radius: 16px;
    padding: 48px 40px 40px;
    width: 100%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: slideUp 0.5s ease;
}

.login-logo {
    height: 40px;
    margin-bottom: 28px;
}

.login-title {
    font-family: 'Poppins', sans-serif;
    font-size: 22px;
    font-weight: 600;
    color: var(--senff-dark);
    margin-bottom: 8px;
}

.login-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 32px;
    line-height: 1.5;
}

.login-subtitle strong {
    color: var(--senff-dark);
}

/* Form input CPF */
.input-group {
    margin-bottom: 12px;
}

.form-input {
    width: 100%;
    height: 54px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0 16px;
    font-family: 'Poppins', sans-serif;
    font-size: 18px;
    color: var(--senff-dark);
    font-weight: 500;
    outline: none;
    transition: all var(--transition);
    text-align: center;
}

.form-input:focus {
    border-color: var(--senff-blue);
    box-shadow: 0 0 0 3px rgba(15,36,103,0.12);
}

.form-input::placeholder {
    color: #c0c4c9;
    font-weight: 400;
}

/* Login error */
.login-error {
    font-size: 13px;
    color: #dc3545;
    min-height: 20px;
    margin-bottom: 16px;
    transition: opacity var(--transition);
}

/* Primary button */
.btn-primary {
    width: 100%;
    height: 50px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--senff-dark);
    color: #fff;
    font-family: 'Poppins', sans-serif;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition), transform 0.15s ease, opacity var(--transition);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary:hover:not(:disabled) {
    background: var(--senff-accent);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(11,28,84,0.3);
}

.btn-primary:active:not(:disabled) {
    transform: scale(0.98);
}

.btn-primary:disabled {
    background: #c0c4cc;
    color: #888;
    cursor: not-allowed;
    opacity: 1;
}

.btn-primary .btn-loader { display: none; }
.btn-primary.loading .btn-text { display: none; }
.btn-primary.loading .btn-loader { display: inline-block; }

/* Login footer */
.login-footer {
    margin-top: 24px;
    font-size: 12px;
    color: rgba(255,255,255,0.5);
}

.login-footer i { margin-right: 6px; }

/* ---- DASHBOARD ---- */
.dashboard-container {
    width: 100%;
    max-width: 540px;
    margin: 0 auto;
    padding-bottom: 40px;
}

/* Header */
.dash-header {
    background: #fff;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.dash-header-inner {
    width: 100%;
    max-width: 540px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
}

.dash-header-title {
    font-family: 'Poppins', sans-serif;
    font-size: 15px;
    font-weight: 600;
}

.dash-header-logo {
    height: 18px;
}

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin: 12px 16px;
    overflow: hidden;
    animation: fadeIn 0.4s ease both;
}

.card-body { padding: 20px; }

/* Cliente info card */
.cliente-card { padding: 16px 20px; }
.cliente-nome { font-family: 'Poppins', sans-serif; font-size: 15px; font-weight: 600; color: var(--text-primary); }
.cliente-cartao { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }
.cliente-cartao strong { color: var(--text-primary); }

/* Fatura hero */
.fatura-hero { text-align: center; padding: 28px 20px; }
.fatura-vencimento { font-size: 13px; color: var(--text-secondary); margin-bottom: 8px; }
.fatura-valor { font-family: 'Poppins', sans-serif; font-size: 36px; font-weight: 700; color: var(--senff-dark); letter-spacing: -1px; }

/* Opções de Valor a Pagar (Radio Buttons Estilizados) */
.valor-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 20px 20px;
}
.valor-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    background: #fff;
}
.valor-option:hover {
    border-color: var(--senff-light-blue);
    background: #fafbfc;
}
.valor-option.selected {
    border-color: var(--senff-dark);
    background: var(--senff-light-blue);
}
.valor-option input[type="radio"] {
    display: none;
}
.valor-option .radio-circle {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid var(--text-muted);
    margin-right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}
.valor-option.selected .radio-circle {
    border-color: var(--senff-dark);
}
.valor-option.selected .radio-circle::after {
    content: '';
    width: 10px;
    height: 10px;
    background: var(--senff-dark);
    border-radius: 50%;
}
.valor-label {
    flex: 1;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}
.valor-price {
    font-family: 'Poppins', sans-serif;
    font-size: 15px;
    font-weight: 600;
    color: var(--senff-dark);
}
.valor-help {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
    display: block;
}

/* Payment Tabs */
.payment-card {
    padding: 20px 0;
}
.payment-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
}
.payment-tab {
    flex: 1;
    background: transparent;
    border: none;
    padding: 14px 10px;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.payment-tab:hover {
    color: var(--senff-dark);
}
.payment-tab.active {
    color: var(--senff-dark);
    border-bottom-color: var(--senff-dark);
    background: var(--senff-light-blue);
}
.payment-content {
    padding: 0 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.payment-content.active {
    opacity: 1;
}
.payment-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 16px;
    line-height: 1.4;
}

/* PIX Content */
.pix-qrcode { width: 160px; height: 160px; margin: 0 auto 16px; background: #fff; padding: 8px; border-radius: var(--radius-sm); border: 1px solid var(--border-color); }
.pix-qrcode img { width: 100%; height: 100%; }

.btn-copy {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 24px;
    border-radius: var(--radius-sm); border: 2px solid var(--senff-dark); background: transparent;
    color: var(--senff-dark); font-family: 'Poppins', sans-serif; font-size: 14px; font-weight: 600; cursor: pointer; transition: all var(--transition);
    width: 100%;
}
.btn-copy:hover { background: var(--senff-dark); color: #fff; }
.btn-copy.copied { background: var(--success); border-color: var(--success); color: #fff; }

/* Boleto Content */
.boleto-barcode { text-align: center; margin-bottom: 12px; }
.boleto-barcode img { max-width: 100%; height: 36px; }
.boleto-linha { font-family: 'Roboto Mono', monospace; font-size: 12px; color: var(--text-secondary); word-break: break-all; background: var(--bg-page); padding: 12px; border-radius: var(--radius-sm); margin-bottom: 12px; text-align: center; letter-spacing: 0.5px; }

/* Extrato */
.extrato-card { padding: 20px 0; }
.extrato-card .section-title { font-family: 'Poppins', sans-serif; font-size: 14px; font-weight: 600; color: var(--text-primary); padding: 0 20px; margin-bottom: 12px; }
.extrato-item { display: flex; justify-content: space-between; align-items: flex-start; padding: 12px 20px; border-bottom: 1px solid var(--border-light); transition: background var(--transition); }
.extrato-item:last-child { border-bottom: none; }
.extrato-item:hover { background: #fafbfc; }
.extrato-info { flex: 1; min-width: 0; }
.extrato-desc { font-size: 13px; font-weight: 500; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.extrato-meta { display: flex; gap: 12px; margin-top: 3px; }
.extrato-meta span { font-size: 11px; color: var(--text-muted); }
.extrato-valor { font-family: 'Poppins', sans-serif; font-size: 13px; font-weight: 600; color: var(--senff-dark); white-space: nowrap; margin-left: 12px; }

/* Total */
.extrato-total { display: flex; justify-content: space-between; padding: 14px 20px; background: var(--senff-light-blue); border-top: 2px solid var(--senff-dark); }
.extrato-total-label { font-size: 13px; font-weight: 600; color: var(--senff-dark); }
.extrato-total-valor { font-family: 'Poppins', sans-serif; font-size: 14px; font-weight: 700; color: var(--senff-dark); }

/* Taxas accordion */
.taxas-card { padding: 0; }
.taxas-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; cursor: pointer; font-family: 'Poppins', sans-serif; font-size: 14px; font-weight: 500; color: var(--text-secondary); transition: color var(--transition); border: none; background: none; width: 100%; text-align: left; }
.taxas-header:hover { color: var(--senff-dark); }
.taxas-header i { transition: transform 0.3s ease; font-size: 12px; }
.taxas-header.open i { transform: rotate(180deg); }
.taxas-body { max-height: 0; overflow: hidden; transition: max-height 0.4s ease; }
.taxas-body.open { max-height: 1000px; }
.taxa-item { display: flex; justify-content: space-between; padding: 8px 20px; font-size: 11px; border-bottom: 1px solid var(--border-light); }
.taxa-item:last-child { border-bottom: none; }
.taxa-label { color: var(--text-secondary); flex: 1; padding-right: 12px; }
.taxa-valor { color: var(--text-primary); font-weight: 500; white-space: nowrap; }

/* Mensagem */
.mensagem-card { padding: 20px; }
.mensagem-card .section-title { font-family: 'Poppins', sans-serif; font-size: 13px; font-weight: 600; color: var(--senff-dark); margin-bottom: 8px; }
.mensagem-text { font-size: 12px; color: var(--text-secondary); line-height: 1.6; white-space: pre-line; }

/* Ouvidoria */
.ouvidoria { text-align: center; padding: 20px; font-size: 13px; color: var(--text-muted); }

/* TOAST */
.toast {
    position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(100px);
    background: var(--senff-dark); color: #fff; padding: 12px 24px; border-radius: 50px;
    font-size: 14px; font-weight: 500; display: flex; align-items: center; gap: 8px; z-index: 9999;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ---- ANIMATIONS ---- */
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
.fade-out { opacity: 0; transition: opacity 0.3s ease; }

/* ---- RESPONSIVE ---- */
@media (max-width: 600px) {
    .login-container { padding: 16px; }
    .login-card { padding: 32px 20px 28px; margin: 0; width: 100%; max-width: 100%; box-sizing: border-box; }
    .fatura-valor { font-size: 30px; }
    .card { margin: 10px 0; border-radius: 8px; }
    .dash-header-inner { padding: 12px 16px; }
    .extrato-item { padding: 10px 16px; }
    .payment-tab { font-size: 13px; padding: 12px 4px; }
    .btn-copy { font-size: 13px; padding: 12px 16px; }
    .valor-options { margin: 16px 12px; }
    .valor-option { padding: 12px; }
}
