/* Rede Confiança: camada "moderna" do webmail (cartões, cantos arredondados, animações) */

:root {
  --rc-laranja: #ff7a00;
  --rc-rosa: #d62185;
  --rc-roxo: #571381;
  --rc-azul: #1a1a2e;
  --rc-fundo: #f3f1f8;
  --rc-grad: linear-gradient(135deg, #d62185 0%, #ff7a00 100%);
  --rc-raio: 18px;
  --rc-sombra: 0 10px 30px -12px rgba(26, 26, 46, .22), 0 2px 6px -2px rgba(26, 26, 46, .08);
  --rc-ease: cubic-bezier(.22, .9, .3, 1);
}

@keyframes rcSobe   { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes rcSurge  { from { opacity: 0; } to { opacity: 1; } }
@keyframes rcPop    { from { opacity: 0; transform: scale(.96) translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes rcDesliza{ from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
@keyframes rcFlutua { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(3%, -4%) scale(1.08); } }
@keyframes rcBrilho { from { left: -60%; } to { left: 130%; } }
@keyframes rcPulso  { 0% { box-shadow: 0 0 0 0 rgba(255,122,0,.45); } 70% { box-shadow: 0 0 0 8px rgba(255,122,0,0); } 100% { box-shadow: 0 0 0 0 rgba(255,122,0,0); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Transições em tudo que é clicável ---------- */
a, button, .btn, .button, .form-control, .custom-select, input, select, textarea,
.listing li > a, .records-table td, .toolbar a, .menu a {
  transition: background-color .22s var(--rc-ease), color .22s var(--rc-ease),
              border-color .22s var(--rc-ease), box-shadow .22s var(--rc-ease),
              transform .18s var(--rc-ease), opacity .22s var(--rc-ease);
}

/* ---------- Barras de rolagem finas ---------- */
* { scrollbar-width: thin; scrollbar-color: rgba(26,26,46,.22) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(26,26,46,.18); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,122,0,.55); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- Layout em cartões (telas largas) ---------- */
@media screen and (min-width: 1024px) {
  html:not(.dark-mode) body:not(.task-login):not(.action-print) #layout { background: var(--rc-fundo); }
  body:not(.task-login) #layout { gap: 12px; padding: 12px; box-sizing: border-box; }
  body:not(.task-login) #layout > #layout-sidebar,
  body:not(.task-login) #layout > #layout-list,
  body:not(.task-login) #layout > #layout-content {
    border: 0 !important;
    border-radius: var(--rc-raio);
    box-shadow: var(--rc-sombra);
    overflow: hidden;
    animation: rcSobe .5s var(--rc-ease) both;
  }
  body:not(.task-login) #layout > #layout-list    { animation-delay: .06s; }
  body:not(.task-login) #layout > #layout-content { animation-delay: .12s; }
  html.dark-mode body:not(.task-login) #layout { background: #12121f; }
}

/* ---------- Cabeçalhos ---------- */
.header .header-title { letter-spacing: -.01em; }
.toolbar a.button, .toolbar .dropbutton, #layout .header a.button {
  border-radius: 12px;
}
.toolbar a.button:hover:not(.disabled), #layout .header a.button:hover:not(.disabled) {
  background-color: rgba(255,122,0,.10);
  color: #e66e00;
  transform: translateY(-1px);
}
.toolbar a.button:active:not(.disabled) { transform: translateY(0) scale(.97); }

/* ---------- Busca em formato de pílula ---------- */
.searchbar { border-radius: 999px; margin: 8px 10px; background: rgba(26,26,46,.04) !important; border: 1px solid transparent; }
.searchbar:focus-within { background: #fff !important; border-color: rgba(255,122,0,.45); box-shadow: 0 0 0 4px rgba(255,122,0,.12); }
.searchbar input { background: transparent !important; }
.header > .searchbar { height: auto; }

/* ---------- Pastas como pílulas ---------- */
#folderlist-content li > a,
.listing.treelist li > a,
#settings-menu li > a,
#settings-menu li a,
#sections-table td.section {
  border-radius: 12px;
  margin: 2px 8px;
}
#folderlist-content li > a:hover,
#settings-menu li > a:hover { background-color: rgba(255,122,0,.08); }
#folderlist-content li.selected > a,
#settings-menu li.selected > a,
.listing li.selected > a {
  background: linear-gradient(90deg, rgba(214,33,133,.10), rgba(255,122,0,.14)) !important;
}
#folderlist-content li .unreadcount { animation: rcPulso 2.4s ease-out 1s 2; }

/* ---------- Botões ---------- */
.btn, .button, .ui-button { border-radius: 12px !important; }
.btn-primary, .button.mainaction, .btn.mainaction {
  background: var(--rc-grad) !important;
  border: 0 !important;
  box-shadow: 0 8px 18px -8px rgba(255,122,0,.65);
  position: relative;
  overflow: hidden;
}
.btn-primary:hover, .button.mainaction:hover { transform: translateY(-1px); box-shadow: 0 12px 22px -10px rgba(255,122,0,.75); }
.btn-primary:active, .button.mainaction:active { transform: translateY(0) scale(.98); }
.btn-primary::after, .button.mainaction::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: -60%; width: 40%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.35), transparent);
  transform: skewX(-20deg); pointer-events: none; opacity: 0;
}
.btn-primary:hover::after, .button.mainaction:hover::after { opacity: 1; animation: rcBrilho .8s var(--rc-ease); }
.btn-secondary { background: rgba(26,26,46,.06); border-color: transparent; color: var(--rc-azul); }
.btn-secondary:hover { background: rgba(26,26,46,.10); color: var(--rc-azul); transform: translateY(-1px); }

/* Efeito de onda (marca.js) */
.rc-onda { position: absolute; border-radius: 50%; transform: scale(0); pointer-events: none;
  background: rgba(255,255,255,.45); animation: rcOnda .6s var(--rc-ease) forwards; }
@keyframes rcOnda { to { transform: scale(4); opacity: 0; } }

/* ---------- Campos ---------- */
.form-control, .custom-select, input.form-control, textarea.form-control, select.form-control {
  border-radius: 12px !important;
  border-color: rgba(26,26,46,.14);
}
.form-control:hover, .custom-select:hover { border-color: rgba(26,26,46,.28); }
.form-control:focus, .custom-select:focus {
  border-color: var(--rc-laranja) !important;
  box-shadow: 0 0 0 4px rgba(255,122,0,.14) !important;
}
.input-group > .form-control:not(:first-child) { border-top-left-radius: 0 !important; border-bottom-left-radius: 0 !important; }
.input-group > .form-control:not(:last-child)  { border-top-right-radius: 0 !important; border-bottom-right-radius: 0 !important; }
.input-group-text { border-radius: 12px; border-color: rgba(26,26,46,.14); }

/* Chaves liga/desliga */
input.custom-switch { border-radius: 999px !important; }
input.custom-switch:checked { background-color: var(--rc-laranja) !important; border-color: var(--rc-laranja) !important; }

/* ---------- Diálogos, menus suspensos e avisos ---------- */
.ui-dialog { border-radius: 22px !important; overflow: hidden; border: 0 !important;
  box-shadow: 0 30px 80px -20px rgba(26,26,46,.45) !important; animation: rcPop .32s var(--rc-ease) both; }
.ui-dialog .ui-dialog-titlebar { border-bottom: 0 !important; background: linear-gradient(90deg, rgba(214,33,133,.06), rgba(255,122,0,.08)); }
.ui-dialog .ui-dialog-title { font-weight: 700; color: var(--rc-azul); }
.ui-widget-overlay { background: rgba(26,26,46,.45) !important; backdrop-filter: blur(3px); animation: rcSurge .25s both; }
.popover { border-radius: 16px !important; border: 0 !important; box-shadow: 0 20px 50px -16px rgba(26,26,46,.40) !important; overflow: hidden; }
.popover .popover-body { animation: rcSurge .2s var(--rc-ease) both; }
.popover .menu a, .popover ul.menu li a, .popupmenu li a { border-radius: 10px; margin: 1px 6px; }
.popover .menu a:hover, .popupmenu li a:hover { background: rgba(255,122,0,.10) !important; color: #e66e00 !important; }
#messagestack .alert, #messagestack div {
  border-radius: 14px !important;
  box-shadow: 0 14px 30px -12px rgba(26,26,46,.40);
  animation: rcDesliza .35s var(--rc-ease) both;
}
#messagestack .alert-success, #messagestack .confirmation { background: linear-gradient(90deg, #1a1a2e, #2b2948) !important; color: #fff !important; }
#messagestack .alert-success::before { color: #ff7a00 !important; }

/* ---------- Leitura de mensagens (dentro do quadro) ---------- */
body.action-show #message-header,
body.action-preview #message-header { animation: rcSobe .4s var(--rc-ease) both; }
body.action-show #messagebody,
body.action-preview #messagebody { animation: rcSobe .45s var(--rc-ease) .05s both; }
#message-header .subject { font-weight: 700; letter-spacing: -.01em; color: var(--rc-azul); }
html.dark-mode #message-header .subject { color: #fff; }
#message-header .header-links a, #message-header .header-links span { border-radius: 8px; }
.attachmentslist li { border-radius: 14px !important; overflow: hidden; }
.attachmentslist li:hover { transform: translateY(-2px); box-shadow: var(--rc-sombra); }

/* ---------- Escrever ---------- */
body.action-compose #compose-content .form-group,
body.action-compose #compose-headers .form-group { animation: rcSobe .4s var(--rc-ease) both; }
#compose-attachments .upload-form, #compose-attachments .hint { border-radius: 16px; }
#compose-attachments .attachmentslist li { border-radius: 12px !important; }
.mce-tinymce, .tox-tinymce, #composebody { border-radius: 14px !important; overflow: hidden; }

/* Botão flutuante (celular) */
.floating-action-buttons a.button { background: var(--rc-grad) !important; box-shadow: 0 14px 28px -10px rgba(214,33,133,.65) !important; border-radius: 20px !important; }
.floating-action-buttons a.button:hover { transform: translateY(-2px) rotate(-3deg); }

/* ---------- Tela de login: fundo animado e cartão de vidro ---------- */
body.task-login::before, body.task-login::after {
  content: ""; position: fixed; z-index: 0; border-radius: 50%; filter: blur(70px); pointer-events: none;
  animation: rcFlutua 16s ease-in-out infinite;
}
body.task-login::before { width: 46vmax; height: 46vmax; left: -12vmax; top: -16vmax; background: rgba(214,33,133,.45); }
body.task-login::after  { width: 40vmax; height: 40vmax; right: -12vmax; bottom: -14vmax; background: rgba(255,122,0,.40); animation-delay: -8s; }
body.task-login #layout { position: relative; z-index: 1; }
body.task-login #logo { animation: rcSobe .7s var(--rc-ease) both; filter: drop-shadow(0 8px 24px rgba(0,0,0,.35)); }
body.task-login #login-form {
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,.6);
  animation: rcPop .7s var(--rc-ease) .12s both;
}
body.task-login #layout-content::after { animation: rcSurge 1s ease .5s both; }
body.task-login #login-form .form-control:focus { transform: translateY(-1px); }
body.task-login #rcmloginsubmit { position: relative; overflow: hidden; box-shadow: 0 14px 30px -12px rgba(214,33,133,.8); }
body.task-login #rcmloginsubmit::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: -60%; width: 40%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.45), transparent);
  transform: skewX(-20deg); animation: rcBrilho 2.6s var(--rc-ease) 1.2s infinite;
}
body.task-login #rcmloginsubmit:hover { transform: translateY(-2px); }
