
/* Geral */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: radial-gradient(circle at top, #1a2440 0, #050814 60%, #020309 100%);
    color: #e5e7eb;
    min-height: 100vh;
}
a {
    color: inherit;
    text-decoration: none;
}

/* Layout principal */
.app-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* Cabeçalho */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding: 0.9rem 1.2rem;
    margin-bottom: 1.5rem;
    border-radius: 0.85rem;
    background: linear-gradient(90deg, rgba(15,23,42,0.95), rgba(17,24,39,0.98));
    border: 1px solid rgba(56,189,248,0.25);
    box-shadow: 0 15px 35px rgba(15,23,42,0.8);
}
.app-logo {
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: 0.03em;
}
.logo-accent {
    color: #22d3ee;
}

/* Menu */
.app-nav a {
    margin-left: 1rem;
    font-size: 0.9rem;
    opacity: 0.85;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    transition: all 0.2s ease;
}
.app-nav a:hover {
    background: rgba(15,118,110,0.35);
    opacity: 1;
}

/* Conteúdo */
.app-main {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* Botões */
.btn-primary {
    background: linear-gradient(135deg, #06b6d4, #22c55e);
    color: #0b1120;
    border: none;
    padding: 0.55rem 1.3rem;
    border-radius: 999px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.9rem;
    box-shadow: 0 8px 25px rgba(34,211,238,0.45);
    transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
    margin-top: 18px;
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 30px rgba(34,211,238,0.55);
    filter: brightness(1.07);
}
.btn-secondary {
    padding: 0.45rem 1rem;
    border-radius: 999px;
    border: 1px solid rgba(148,163,184,0.7);
    background: rgba(15,23,42,0.85);
    color: #e5e7eb;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.15s ease;
}
.btn-secondary:hover {
    border-color: #22d3ee;
    background: rgba(15,23,42,1);
}
.btn-link {
    background: none;
    border: none;
    color: #38bdf8;
    font-size: 0.85rem;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
}
.btn-link:hover {
    text-decoration: underline;
}

/* Theme buttons inside selector */
.btn-theme {
    border: none;
    border-radius: 999px;
    padding: 0.25rem 0.7rem;
    margin-left: 0.25rem;
    font-size: 0.75rem;
    cursor: pointer;
    background: rgba(15,23,42,0.9);
    color: #e5e7eb;
    transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.btn-theme:hover {
    background: rgba(56,189,248,0.15);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(15,23,42,0.7);
}

/* Formulário genérico */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.85rem;
}
.form-group label {
    color: #9ca3af;
}
.form-group input,
.form-group select {
    padding: 0.45rem 0.6rem;
    border-radius: 0.5rem;
    border: 1px solid rgba(75,85,99,0.9);
    background: rgba(15,23,42,0.95);
    color: #e5e7eb;
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.form-group input:focus,
.form-group select:focus {
    border-color: #22d3ee;
    box-shadow: 0 0 0 1px rgba(34,211,238,0.5);
    background: rgba(15,23,42,1);
}

/* ============================
   Tela de login
   ============================ */
.auth-wrapper,
.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 3rem 0;
}
.auth-card,
.login-card {
    width: 100%;
    max-width: 380px;
    background: radial-gradient(circle at top, rgba(30,64,175,0.5), rgba(15,23,42,0.98));
    border-radius: 1rem;
    padding: 1.8rem 1.6rem;
    border: 1px solid rgba(148,163,184,0.65);
    box-shadow: 0 20px 45px rgba(15,23,42,0.95);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.auth-card h1,
.login-card h1 {
    font-size: 1.3rem;
    margin-bottom: 0.25rem;
}
.auth-subtitle {
    font-size: 0.85rem;
    color: #9ca3af;
    margin-bottom: 0.6rem;
}

/* Header de página */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.page-header h1 {
    font-size: 1.2rem;
    margin-bottom: 0.15rem;
}
.page-header p {
    font-size: 0.8rem;
    color: #9ca3af;
}

/* Card de filtros */
.filters-card {
    background: rgba(15,23,42,0.94);
    border-radius: 0.9rem;
    padding: 0.9rem 1rem;
    border: 1px solid rgba(30,64,175,0.8);
    box-shadow: 0 12px 30px rgba(15,23,42,0.9);
}
.filters-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
    align-items: end;
}
.form-actions {
    display: flex;
    justify-content: flex-end;
}

/* Tabela */
.table-card {
    background: rgba(15,23,42,0.96);
    border-radius: 1rem;
    border: 1px solid rgba(15,118,110,0.8);
    box-shadow: 0 18px 40px rgba(15,23,42,0.95);
    overflow: hidden;
}
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
.data-table thead {
    background: linear-gradient(90deg, rgba(15,23,42,1), rgba(15,23,42,0.9));
}
.data-table th,
.data-table td {
    padding: 0.55rem 0.75rem;
    text-align: left;
}
.data-table th {
    font-weight: 600;
    color: #e5e7eb;
    border-bottom: 1px solid rgba(56,189,248,0.35);
    font-size: 0.8rem;
}
.data-table tbody tr:nth-child(even) {
    background: rgba(15,23,42,0.8);
}
.data-table tbody tr:nth-child(odd) {
    background: rgba(15,23,42,0.95);
}
.data-table tbody tr:hover {
    background: rgba(8,47,73,0.9);
}
.empty-row {
    text-align: center;
    color: #9ca3af;
}


/* Linhas finas tipo caderno para melhorar a leitura da lista de estudos */
.data-table tbody tr {
    border-bottom: 1px solid rgba(148, 163, 184, 0.16);
}

.data-table tbody tr:last-child {
    border-bottom: none;
}

.data-table tbody td {
    border-bottom: 1px solid rgba(148, 163, 184, 0.10);
}

.data-table tbody tr:hover td {
    border-bottom-color: rgba(56, 189, 248, 0.25);
}

.series-images-cell {
    color: #bae6fd;
    font-weight: 600;
    white-space: nowrap;
}

.studies-table th:nth-child(4),
.studies-table td:nth-child(4) {
    text-align: center;
}

/* Badge de status */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}
.status-pendente {
    background: rgba(251,191,36,0.15);
    color: #facc15;
}
.status-em {
    /* ex: "Em laudo" vira "em" por causa do filtro cut */
    background: rgba(59,130,246,0.18);
    color: #60a5fa;
}
.status-laudado {
    background: rgba(34,197,94,0.18);
    color: #4ade80;
}

/* Responsivo */
@media (max-width: 900px) {
    .filters-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .app-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    .app-nav a {
        margin-left: 0;
        margin-right: 0.5rem;
    }
}

/* =========================================================
   VARIAÇÕES DE TEMA - PIXELS&CHIPS PACS
   Carbon Blue (padrão) = seu CSS atual
   Aqui só criamos overrides para outros temas, usando
   classes no <body>.
   ========================================================= */
.theme-selector {
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(5, 10, 20, 0.85);
    color: #e4ecff;
    font-size: 0.85rem;
}
.theme-label {
    font-size: 0.8rem;
    margin-right: 6px;
    opacity: 0.8;
}

/* Generic text color for themes */
body.theme-black-neutral,
body.theme-graphite,
body.theme-reading-room {
    color: #e4e7f5;
}

/* ---------------------------------------------------------
   1) BLACK NEUTRAL
   --------------------------------------------------------- */
body.theme-black-neutral {
    background:
        radial-gradient(circle at top, rgba(60, 120, 255, 0.18), transparent 65%),
        #05070b;
}
body.theme-black-neutral .login-card,
body.theme-black-neutral .auth-card,
body.theme-black-neutral .table-card,
body.theme-black-neutral .filters-card,
body.theme-black-neutral .app-header {
    background:
        radial-gradient(circle at top, rgba(55, 208, 255, 0.12), transparent 70%),
        #101522;
    box-shadow:
        0 20px 40px rgba(0, 0, 0, 0.8),
        0 0 0 1px rgba(255, 255, 255, 0.03);
}
body.theme-black-neutral input,
body.theme-black-neutral select {
    background: rgba(3, 7, 16, 0.9);
    border: 1px solid rgba(102, 112, 255, 0.35);
    color: #e4ecff;
}
body.theme-black-neutral input::placeholder {
    color: rgba(164, 174, 225, 0.75);
}
body.theme-black-neutral .btn-primary {
    background: radial-gradient(circle at 10% 0%, #37d0ff, #175dff);
    box-shadow: 0 0 20px rgba(55, 208, 255, 0.5);
}

/* ---------------------------------------------------------
   2) GRAPHITE
   --------------------------------------------------------- */
body.theme-graphite {
    background:
        radial-gradient(circle at top left, rgba(120, 200, 255, 0.12), transparent 55%),
        linear-gradient(145deg, #15171b, #050608);
}
body.theme-graphite .login-card,
body.theme-graphite .auth-card,
body.theme-graphite .table-card,
body.theme-graphite .filters-card,
body.theme-graphite .app-header {
    background: linear-gradient(145deg, #181b20, #101216);
    box-shadow:
        0 18px 36px rgba(0, 0, 0, 0.85),
        0 0 0 1px rgba(255, 255, 255, 0.04);
}
body.theme-graphite input,
body.theme-graphite select {
    background: #111318;
    border: 1px solid rgba(148, 163, 184, 0.6);
    color: #e5e7eb;
}
body.theme-graphite input::placeholder {
    color: rgba(148, 163, 184, 0.9);
}
body.theme-graphite .btn-primary {
    background: linear-gradient(135deg, #38bdf8, #0ea5e9);
    box-shadow: 0 0 18px rgba(56, 189, 248, 0.6);
}

/* ---------------------------------------------------------
   3) CARBON BLUE (padrão)
   --------------------------------------------------------- */
/* Já é o visual base do body, então não precisa de override adicional.
   Mantemos como está. */

/* ---------------------------------------------------------
   4) READING ROOM
   --------------------------------------------------------- */
body.theme-reading-room {
    background: #000000;
    color: #d4d4d4;
}
body.theme-reading-room .login-card,
body.theme-reading-room .auth-card,
body.theme-reading-room .table-card,
body.theme-reading-room .filters-card,
body.theme-reading-room .app-header {
    background: #050505;
    box-shadow:
        0 18px 40px rgba(0, 0, 0, 0.9),
        0 0 0 1px rgba(255, 255, 255, 0.06);
}
body.theme-reading-room input,
body.theme-reading-room select {
    background: #050505;
    border: 1px solid #3f3f46;
    color: #e5e5e5;
}
body.theme-reading-room input::placeholder {
    color: #71717a;
}
body.theme-reading-room .btn-primary {
    background: #22c55e;
    color: #020617;
    box-shadow: 0 0 16px rgba(34, 197, 94, 0.4);
}
/* Botão de tema ativo */
.btn-theme--active {
    outline: 1px solid rgba(56, 189, 248, 0.9);
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.7);
    background: rgba(15, 23, 42, 1);
}
.viewer-bar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin: 10px 0 14px 0;
}
.viewer-select{
  padding:8px 10px;
  border-radius:10px;
  border:1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.25);
  color: inherit;
}

.viewer-config-dialog{ display:none; position:fixed; inset:0; z-index:999; }
.viewer-config-dialog.open{ display:block; }
.viewer-config-backdrop{ position:absolute; inset:0; background: rgba(0,0,0,0.55); }
.viewer-config-content{
  position:relative;
  z-index:2;
  width:min(560px, calc(100% - 30px));
  margin: 60px auto;
  padding: 18px;
  border-radius: 16px;
  background: rgba(20,20,20,0.95);
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
}
.viewer-config-actions{ display:flex; gap:10px; justify-content:flex-end; margin-top: 12px; }
/* C:\Sandro\portal_pacs\static\css\style.css */

/* Garante que o calendário do input date apareça no Chrome/Edge */
input[type="date"]{
  -webkit-appearance: auto !important;
  appearance: auto !important;
}

/* Se você usa theme escuro, melhora o ícone do calendário */
input[type="date"]::-webkit-calendar-picker-indicator{
  filter: invert(1);
  opacity: 0.85;
  cursor: pointer;
}

/* ---------------------------------------------------------
   Transferência automática Orthanc/OHIF
   --------------------------------------------------------- */
.cell-actions {
  min-width: 190px;
}

.btn-viewer-open {
  border: 0;
  border-radius: 10px;
  padding: 7px 11px;
  cursor: pointer;
  font-weight: 700;
  color: #031018;
  background: linear-gradient(135deg, #38bdf8, #22c55e);
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.35);
}

.btn-viewer-open:disabled {
  cursor: wait;
  opacity: 0.7;
}

.transfer-status {
  display: none;
  margin-top: 7px;
  min-width: 170px;
}

.transfer-status.visible {
  display: block;
}

.transfer-status-text {
  font-size: 0.76rem;
  color: #cbd5e1;
  margin-bottom: 4px;
}

.transfer-status.success .transfer-status-text {
  color: #86efac;
}

.transfer-status.error .transfer-status-text {
  color: #fca5a5;
}

.transfer-progress {
  width: 100%;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.25);
}

.transfer-progress span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #38bdf8, #22c55e);
  transition: width 0.25s ease;
}

.cache-card {
  margin-top: 18px;
}

.cache-card p {
  color: #cbd5e1;
  margin-bottom: 14px;
}


.btn-danger {
  border: 1px solid rgba(255, 90, 90, 0.7);
  background: rgba(130, 20, 20, 0.35);
  color: #ffdede;
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
}

.btn-danger:hover {
  background: rgba(170, 30, 30, 0.55);
}

/* =========================================================
   Layout PACS moderno - versão inspirada no visual validado
   ========================================================= */
body {
    background:
        radial-gradient(circle at top left, rgba(14, 165, 233, 0.16), transparent 32%),
        radial-gradient(circle at top right, rgba(34, 211, 238, 0.08), transparent 28%),
        linear-gradient(145deg, #020617 0%, #06111f 45%, #020617 100%);
}

.app-shell {
    width: 100%;
    min-height: 100vh;
}

.app-container {
    max-width: none;
    margin: 0;
    padding: 0;
}

.topbar {
    height: 68px;
    display: grid;
    grid-template-columns: 260px 1fr auto;
    align-items: center;
    gap: 18px;
    padding: 0 24px;
    background: rgba(3, 10, 22, 0.86);
    border-bottom: 1px solid rgba(56, 189, 248, 0.18);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(14px);
    position: sticky;
    top: 0;
    z-index: 50;
}

.brand-area {
    height: 68px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-right: 1px solid rgba(148, 163, 184, 0.12);
    padding-right: 20px;
}

.brand-icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: rgba(14, 165, 233, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.35);
    color: #38bdf8;
    font-size: 1.6rem;
    font-weight: 800;
    box-shadow: 0 0 22px rgba(56, 189, 248, 0.16);
}

.brand-text {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: #f8fafc;
    white-space: nowrap;
}

.brand-text span {
    color: #22d3ee;
}

.menu-button {
    margin-left: auto;
    border: 0;
    background: transparent;
    color: #94a3b8;
    font-size: 1.4rem;
    cursor: pointer;
}

.top-nav {
    display: flex;
    align-items: center;
    gap: 24px;
    height: 68px;
}

.nav-link {
    height: 68px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #cbd5e1;
    font-size: 0.95rem;
    border-bottom: 3px solid transparent;
    padding: 0 6px;
    transition: all 0.16s ease;
}

.nav-link:hover,
.nav-active {
    color: #22d3ee;
    border-bottom-color: #22d3ee;
}

.user-area {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #f8fafc;
}

.user-icon {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(15, 23, 42, 0.9);
}

.user-info {
    line-height: 1.15;
}

.user-info small {
    display: block;
    color: #94a3b8;
    font-size: 0.72rem;
}

.online-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: #22c55e;
    margin-left: 5px;
    vertical-align: middle;
}

.app-main {
    width: 100%;
    max-width: 1480px;
    margin: 0 auto;
    padding: 24px 16px 18px;
}

.app-footer {
    max-width: 1480px;
    margin: 0 auto;
    padding: 20px 24px 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 28%;
    color: #94a3b8;
    font-size: 0.88rem;
}

.modern-page-header {
    padding: 22px 24px;
    margin-bottom: 0;
    border: 1px solid rgba(56, 189, 248, 0.24);
    border-bottom: 0;
    border-radius: 14px 14px 0 0;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.74), rgba(2, 6, 23, 0.58));
}

.page-title-block {
    display: flex;
    align-items: center;
    gap: 14px;
}

.page-title-icon {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: rgba(14, 165, 233, 0.10);
    border: 1px solid rgba(56, 189, 248, 0.22);
    color: #bae6fd;
}

.modern-page-header h1 {
    font-size: 1.35rem;
    color: #f8fafc;
    margin: 0 0 4px 0;
}

.modern-page-header p {
    color: #9fb4ce;
    font-size: 0.86rem;
}

.page-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-icon {
    width: 38px;
    height: 38px;
    border-radius: 9px;
    border: 1px solid rgba(148, 163, 184, 0.30);
    background: rgba(15, 23, 42, 0.86);
    color: #bae6fd;
    cursor: pointer;
}

.viewer-bar,
.filters-card {
    max-width: 1480px;
}

.table-card {
    border-radius: 0 0 14px 14px;
    border-color: rgba(56, 189, 248, 0.25);
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.92), rgba(2, 6, 23, 0.94));
    box-shadow: 0 20px 55px rgba(0, 0, 0, 0.42);
}

.data-table {
    font-size: 0.92rem;
}

.data-table th,
.data-table td {
    padding: 0.9rem 1.15rem;
}

.data-table th {
    font-size: 0.82rem;
    color: #f8fafc;
    border-bottom: 1px solid rgba(56, 189, 248, 0.28);
}

.data-table tbody td {
    border-bottom: 1px solid rgba(56, 189, 248, 0.16);
}

.data-table tbody tr:nth-child(even),
.data-table tbody tr:nth-child(odd) {
    background: rgba(15, 23, 42, 0.70);
}

.data-table tbody tr:hover {
    background: rgba(8, 47, 73, 0.68);
}

.cell-actions {
    min-width: 260px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: nowrap;
    white-space: nowrap;
}

.btn-viewer-open {
    min-width: 122px;
    border-radius: 9px;
    padding: 9px 13px;
    color: #031018;
    background: linear-gradient(135deg, #38bdf8, #22c55e);
}

.btn-viewer-open::before {
    content: "◉";
    margin-right: 7px;
    font-size: 0.78rem;
}

.btn-laudar {
    min-width: 92px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 9px;
    border: 1px solid rgba(167, 139, 250, 0.72);
    color: #c4b5fd;
    background: rgba(76, 29, 149, 0.18);
    font-weight: 700;
    font-size: 0.86rem;
    transition: all 0.15s ease;
}

.btn-laudar:hover {
    background: rgba(76, 29, 149, 0.34);
    box-shadow: 0 0 16px rgba(167, 139, 250, 0.24);
}

.transfer-status {
    position: absolute;
    margin-top: 46px;
    min-width: 230px;
}

.status-badge {
    padding: 0.28rem 0.72rem;
    background: rgba(251, 191, 36, 0.13);
}

@media (max-width: 1100px) {
    .topbar {
        grid-template-columns: 1fr;
        height: auto;
        padding: 14px;
    }
    .brand-area {
        height: auto;
        border-right: 0;
    }
    .top-nav {
        height: auto;
        flex-wrap: wrap;
    }
    .nav-link {
        height: 38px;
    }
    .user-area {
        display: none;
    }
    .cell-actions {
        min-width: 230px;
    }
}
