/* ============================================================
   SAFE UTILITÁRIOS — SANTANDER
   Design System CSS
   ============================================================ */

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --red-primary:    #EC0000;
    --red-dark:       #CC0000;
    --red-darker:     #A00000;
    --red-light:      #FFF0F0;
    --red-muted:      #FFCCCC;

    --gray-50:        #FAFAFA;
    --gray-100:       #F5F5F5;
    --gray-200:       #EEEEEE;
    --gray-300:       #E0E0E0;
    --gray-400:       #BDBDBD;
    --gray-500:       #9E9E9E;
    --gray-600:       #757575;
    --gray-700:       #616161;
    --gray-800:       #424242;
    --gray-900:       #212121;

    --green-500:      #2E7D32;
    --green-50:       #E8F5E9;
    --blue-500:       #1565C0;
    --blue-50:        #E3F2FD;

    --white:          #FFFFFF;
    --shadow-sm:      0 1px 3px rgba(0,0,0,.10), 0 1px 2px rgba(0,0,0,.06);
    --shadow-md:      0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
    --shadow-lg:      0 10px 15px rgba(0,0,0,.08), 0 4px 6px rgba(0,0,0,.05);
    --shadow-xl:      0 20px 25px rgba(0,0,0,.10), 0 10px 10px rgba(0,0,0,.04);

    --radius-sm:      6px;
    --radius-md:      10px;
    --radius-lg:      16px;
    --radius-full:    9999px;

    --font:           'Inter', system-ui, -apple-system, sans-serif;
    --transition:     all .2s ease;
}

html { font-size: 16px; }
body { font-family: var(--font); color: var(--gray-900); background: var(--gray-100); line-height: 1.5; }
a { color: var(--red-primary); text-decoration: none; }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-body {
    background: var(--gray-100);
    min-height: 100vh;
    display: flex;
    align-items: stretch;
}

.login-wrapper {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* ---- Brand panel (left) ---- */
.login-brand-panel {
    flex: 0 0 45%;
    background: linear-gradient(145deg, var(--red-primary) 0%, var(--red-darker) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    position: relative;
    overflow: hidden;
}

.login-brand-panel::before {
    content: '';
    position: absolute;
    top: -80px; right: -80px;
    width: 320px; height: 320px;
    border-radius: 50%;
    background: rgba(255,255,255,.06);
}

.login-brand-panel::after {
    content: '';
    position: absolute;
    bottom: -60px; left: -60px;
    width: 260px; height: 260px;
    border-radius: 50%;
    background: rgba(255,255,255,.04);
}

.brand-content {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
    max-width: 380px;
    position: relative;
    z-index: 1;
}

.santander-logo {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-flame {
    width: 52px;
    height: 52px;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,.3));
}

.logo-text {
    display: flex;
    flex-direction: column;
}

.logo-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--white);
    letter-spacing: -.02em;
    line-height: 1;
}

.logo-sub {
    font-size: .8rem;
    color: rgba(255,255,255,.75);
    letter-spacing: .06em;
    text-transform: uppercase;
    margin-top: 2px;
}

.brand-message h1 {
    font-size: 2.2rem;
    font-weight: 300;
    color: rgba(255,255,255,.9);
    line-height: 1.2;
    margin-bottom: .75rem;
}

.brand-message h1 strong {
    font-weight: 700;
    color: var(--white);
}

.brand-message p {
    font-size: 1rem;
    color: rgba(255,255,255,.7);
    line-height: 1.7;
}

.brand-footer {
    font-size: .8rem;
    color: rgba(255,255,255,.5);
}

/* ---- Form panel (right) ---- */
.login-form-panel {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    background: var(--white);
}

.form-container {
    width: 100%;
    max-width: 420px;
}

.form-header {
    text-align: center;
    margin-bottom: 2rem;
}

.form-logo-small {
    width: 48px;
    height: 48px;
    margin-bottom: .75rem;
    display: none; /* shown on mobile */
}

.form-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: .25rem;
}

.form-header p {
    font-size: .9rem;
    color: var(--gray-500);
}

/* ---- Alerts ---- */
.alert {
    display: flex;
    align-items: center;
    gap: .625rem;
    padding: .75rem 1rem;
    border-radius: var(--radius-sm);
    font-size: .875rem;
    margin-bottom: 1.25rem;
    font-weight: 500;
}

.alert-icon { width: 18px; height: 18px; flex-shrink: 0; }

.alert-error {
    background: #FEF2F2;
    border: 1px solid #FECACA;
    color: #DC2626;
}

.alert-success {
    background: var(--green-50);
    border: 1px solid #BBF7D0;
    color: var(--green-500);
}

/* ---- Form fields ---- */
.login-form { display: flex; flex-direction: column; gap: 1.25rem; }

.field-group { display: flex; flex-direction: column; gap: .4rem; }

.field-group label {
    font-size: .85rem;
    font-weight: 600;
    color: var(--gray-700);
    letter-spacing: .01em;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: .875rem;
    width: 18px;
    height: 18px;
    color: var(--gray-400);
    pointer-events: none;
    flex-shrink: 0;
}

.form-input {
    width: 100%;
    padding: .75rem 1rem .75rem 2.75rem;
    font-family: var(--font);
    font-size: .95rem;
    color: var(--gray-900);
    background: var(--gray-50);
    border: 1.5px solid var(--gray-300);
    border-radius: var(--radius-sm);
    outline: none;
    transition: var(--transition);
}

.form-input::placeholder { color: var(--gray-400); }

.form-input:focus {
    border-color: var(--red-primary);
    background: var(--white);
    box-shadow: 0 0 0 3px rgba(236,0,0,.12);
}

.toggle-password {
    position: absolute;
    right: .75rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: .25rem;
    color: var(--gray-400);
    display: flex;
    align-items: center;
}

.toggle-password svg { width: 18px; height: 18px; }
.toggle-password:hover { color: var(--red-primary); }

/* ---- Login button ---- */
.btn-login {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    margin-top: .5rem;
    padding: .875rem 1.5rem;
    background: linear-gradient(135deg, var(--red-primary) 0%, var(--red-dark) 100%);
    color: var(--white);
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    letter-spacing: .01em;
    box-shadow: 0 4px 12px rgba(236,0,0,.3);
}

.btn-login:hover {
    background: linear-gradient(135deg, var(--red-dark) 0%, var(--red-darker) 100%);
    box-shadow: 0 6px 16px rgba(236,0,0,.4);
    transform: translateY(-1px);
}

.btn-login:active { transform: translateY(0); }
.btn-login .btn-icon { width: 18px; height: 18px; }

.form-disclaimer {
    margin-top: 1.5rem;
    font-size: .78rem;
    color: var(--gray-400);
    text-align: center;
    line-height: 1.5;
}

/* ============================================================
   APP LAYOUT (post-login)
   ============================================================ */
.app-body {
    background: var(--gray-100);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ---- Top nav ---- */
.topnav {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    height: 64px;
    background: var(--white);
    border-bottom: 3px solid var(--red-primary);
    box-shadow: var(--shadow-sm);
}

.topnav-left { display: flex; align-items: center; gap: .875rem; }

.nav-logo-flame { width: 36px; height: 36px; }

.nav-title-group { display: flex; flex-direction: column; line-height: 1.1; }

.nav-brand {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--red-primary);
    letter-spacing: -.01em;
}

.nav-product {
    font-size: .7rem;
    color: var(--gray-500);
    letter-spacing: .05em;
    text-transform: uppercase;
}

.topnav-right { display: flex; align-items: center; gap: 1rem; }

.nav-user { display: flex; align-items: center; gap: .5rem; }

.nav-avatar {
    width: 32px; height: 32px;
    background: var(--red-light);
    border-radius: var(--radius-full);
    display: flex; align-items: center; justify-content: center;
}

.nav-avatar svg { width: 18px; height: 18px; color: var(--red-primary); }

.nav-username {
    font-size: .875rem;
    font-weight: 500;
    color: var(--gray-700);
}

.logout-form { display: inline; }

.btn-logout {
    display: flex;
    align-items: center;
    gap: .375rem;
    padding: .4rem .875rem;
    background: none;
    border: 1.5px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: .825rem;
    font-weight: 500;
    color: var(--gray-600);
    cursor: pointer;
    transition: var(--transition);
}

.btn-logout svg { width: 15px; height: 15px; }

.btn-logout:hover {
    border-color: var(--red-primary);
    color: var(--red-primary);
    background: var(--red-light);
}

/* ---- Main content ---- */
.main-content {
    flex: 1;
    max-width: 960px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* ---- Breadcrumb ---- */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: .375rem;
    font-size: .8rem;
    color: var(--gray-500);
    margin-bottom: 1.5rem;
}

.breadcrumb-sep { width: 14px; height: 14px; }
.breadcrumb-active { color: var(--gray-700); font-weight: 500; }

/* ---- Page header ---- */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.75rem;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gray-900);
    letter-spacing: -.02em;
}

.page-subtitle {
    font-size: .95rem;
    color: var(--gray-500);
    margin-top: .25rem;
}

/* ---- Cards ---- */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--gray-200);
    overflow: hidden;
    margin-bottom: 1.75rem;
}

.card-header {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--gray-200);
    background: var(--gray-50);
}

.card-icon {
    width: 24px; height: 24px;
    color: var(--red-primary);
    flex-shrink: 0;
}

.card-header h2 {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--gray-900);
}

.card-body { padding: 1.75rem 1.5rem; }

/* ---- Relatório info grid ---- */
.relatorio-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--gray-50);
    border-radius: var(--radius-md);
    border: 1px solid var(--gray-200);
}

.info-item { display: flex; flex-direction: column; gap: .25rem; }

.info-label {
    font-size: .72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--gray-500);
}

.info-value {
    font-size: .9rem;
    font-weight: 500;
    color: var(--gray-800);
}

.badge-xlsx {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    color: var(--green-500);
    font-weight: 600;
}

.badge-icon { width: 14px; height: 14px; }

/* ---- Description ---- */
.relatorio-description {
    display: flex;
    align-items: flex-start;
    gap: .625rem;
    padding: 1rem 1.25rem;
    background: var(--blue-50);
    border-radius: var(--radius-sm);
    border: 1px solid #BBDEFB;
    margin-bottom: 2rem;
}

.desc-icon {
    width: 18px; height: 18px;
    color: var(--blue-500);
    flex-shrink: 0;
    margin-top: 2px;
}

.relatorio-description p {
    font-size: .875rem;
    color: var(--gray-700);
    line-height: 1.6;
}

/* ---- Action area ---- */
.action-area {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.btn-gerar {
    display: flex;
    align-items: center;
    gap: .625rem;
    padding: .9rem 2rem;
    background: linear-gradient(135deg, var(--red-primary) 0%, var(--red-dark) 100%);
    color: var(--white);
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 14px rgba(236,0,0,.35);
    letter-spacing: .01em;
}

.btn-gerar:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--red-dark) 0%, var(--red-darker) 100%);
    box-shadow: 0 6px 18px rgba(236,0,0,.45);
    transform: translateY(-2px);
}

.btn-gerar:active:not(:disabled) { transform: translateY(0); }

.btn-gerar:disabled {
    opacity: .7;
    cursor: not-allowed;
    transform: none;
}

.btn-gerar.loading .btn-icon {
    animation: spin .8s linear infinite;
}

.btn-gerar .btn-icon { width: 20px; height: 20px; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Download feedback ---- */
.download-feedback {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .875rem;
    color: var(--green-500);
    font-weight: 500;
}

.feedback-icon { width: 20px; height: 20px; }
.feedback-icon.success { color: var(--green-500); }

/* ---- Info cards ---- */
.info-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
}

.info-card {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.25rem;
    background: var(--white);
    border-radius: var(--radius-md);
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
}

.ic-icon {
    width: 40px; height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ic-icon svg { width: 20px; height: 20px; }

.ic-red  { background: var(--red-light);   color: var(--red-primary); }
.ic-green{ background: var(--green-50);    color: var(--green-500);   }
.ic-blue { background: var(--blue-50);     color: var(--blue-500);    }

.info-card h3 {
    font-size: .875rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: .25rem;
}

.info-card p {
    font-size: .8rem;
    color: var(--gray-500);
    line-height: 1.5;
}

/* ---- Footer ---- */
.app-footer {
    padding: 1rem 2rem;
    background: var(--white);
    border-top: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .75rem;
    font-size: .78rem;
    color: var(--gray-400);
}

.footer-sep { color: var(--gray-300); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
    .login-brand-panel { display: none; }
    .login-form-panel { justify-content: center; padding: 2rem 1.25rem; }
    .form-logo-small { display: block; }

    .topnav { padding: 0 1rem; }
    .nav-username { display: none; }
    .main-content { padding: 1.25rem 1rem; }
    .page-title { font-size: 1.4rem; }
    .action-area { flex-direction: column; align-items: flex-start; }
}

/* ── Filtros do formulário de geração ──────────────────────────────────────── */
.filtros-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 2fr;
    gap: 12px;
    margin-bottom: 20px;
    align-items: end;
}

.filtro-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filtro-group label {
    font-size: 0.78rem;
    font-weight: 600;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.filtro-input {
    padding: 10px 14px;
    border: 1.5px solid #ddd;
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: 'Inter', sans-serif;
    color: #333;
    background: #fff;
    transition: border-color 0.2s;
    outline: none;
    width: 100%;
    box-sizing: border-box;
}

.filtro-input:focus {
    border-color: #EC0000;
    box-shadow: 0 0 0 3px rgba(236, 0, 0, 0.08);
}

@media (max-width: 768px) {
    .filtros-grid {
        grid-template-columns: 1fr;
    }
}
