/* assets/css/main.css */

:root {
    --bg-from: #ffffff; 
    --bg-to: #b3dcff;
    --card: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --brand: #0077c8;
    --border: #e5e7eb;
    --shadow: 0 10px 30px rgba(0,0,0,.06);
    --shadow-sm: 0 4px 15px rgba(0,0,0,.04);
}

html[data-theme='dark'] {
    --bg-from: #0f172a;
    --bg-to: #1b2738;
    --card: #111827;
    --text: #e5e7eb;
    --muted: #9ca3af;
    --brand: #38bdf8;
    --border: #1f2937;
    --shadow: 0 10px 30px rgba(0,0,0,.4);
    --shadow-sm: 0 4px 15px rgba(0,0,0,.2);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Poppins', system-ui, -apple-system, sans-serif;
    background: linear-gradient(to bottom right, var(--bg-from) 30%, var(--bg-to) 100%) fixed;
    color: var(--text);
    min-height: 100vh;
}

/* --- Topbar --- */
.topbar {
    position: sticky; top: 0; z-index: 50;
    backdrop-filter: saturate(1.8) blur(8px);
    background: linear-gradient(90deg, rgba(255,255,255,.6), rgba(255,255,255,.3));
    border-bottom: 1px solid var(--border);
}
html[data-theme='dark'] .topbar {
    background: linear-gradient(90deg, rgba(17,24,39,.6), rgba(17,24,39,.3));
}
.topbar-inner {
    max-width: 1200px; margin: 0 auto; padding: 14px 20px;
    display: grid; grid-template-columns: auto 1fr auto auto; gap: 20px; align-items: center;
}
.brand { font-size: 22px; letter-spacing: .5px; color: var(--brand); }
.brand .smart { font-weight: 700; }
.brand .cloud { font-weight: 400; }

.clinic { font-size: 14px; color: var(--muted); justify-self: end; text-align: right; margin-right: 20px; }
.clinic .storage-info { font-size: 12px; opacity: 0.8; }

.logout {
    text-decoration: none; background: var(--brand); color: #fff; 
    padding: 8px 14px; border-radius: 10px; font-weight: 600; 
    box-shadow: var(--shadow-sm); transition: opacity 0.2s;
}
.logout:hover { opacity: .9; }

/* --- Switch Tema --- */
.theme-switch { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.switch { position: relative; width: 46px; height: 24px; display: inline-block; }
.switch input { display: none; }
.slider { position: absolute; cursor: pointer; inset: 0; background: var(--border); border-radius: 999px; transition: background 0.2s; }
.slider:before {
    content: ""; position: absolute; height: 18px; width: 18px; left: 3px; top: 3px;
    background: #fff; border-radius: 50%; transition: transform .2s ease;
    box-shadow: 0 3px 8px rgba(0,0,0,.25);
}
input:checked + .slider { background: var(--brand); }
input:checked + .slider:before { transform: translateX(22px); }

/* --- Layout Geral Painel --- */
.container { max-width: 1200px; margin: 30px auto; padding: 0 20px; }
.panel { background: var(--card); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; }
.panel-header { padding: 18px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.panel-title { font-size: 18px; font-weight: 600; }

.filters { padding: 16px 20px; display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; border-bottom: 1px solid var(--border); }
.filters input[type="search"], .filters select { 
    width: 100%; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border); 
    background: var(--bg-from); color: var(--text); font-size: 14px; transition: all 0.2s; 
}
.filters input:focus, .filters select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(0,119,200, 0.2); }

/* --- Cards e Listas --- */
.list { padding: 10px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-sm); margin: 10px; }
.card-header { display: grid; grid-template-columns: 60px 1fr auto; gap: 14px; align-items: center; cursor: pointer; padding: 14px; transition: background 0.2s; }
.card-header:hover { background: rgba(0,0,0,0.02); }
html[data-theme='dark'] .card-header:hover { background: rgba(255,255,255,0.02); }

.thumb { width: 60px; height: 60px; border-radius: 50%; overflow: hidden; border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; background: #00000008; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.meta { display: flex; flex-direction: column; gap: 2px; }
.meta strong { font-size: 16px; color: var(--text); }
.muted { color: var(--muted); font-size: 13px; }
.btn { text-decoration: none; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--border); color: var(--text); font-weight: 600; font-size: 14px; display:inline-block; text-align:center; cursor:pointer;}
.btn.primary { background: var(--brand); color: #fff; border-color: transparent; }

.exam-list { display: none; padding: 0 14px 14px 88px; margin-top: -5px; }
.exam-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; padding: 12px 0; border-bottom: 1px dashed var(--border); font-size: 14px; align-items: center; }
.exam-row:first-child { border-top: 1px solid var(--border); padding-top: 15px; margin-top: 5px; }
.exam-row:last-child { border-bottom: none; }

/* --- Lightbox / Modal (Global) --- */
.modal { 
    position: fixed; 
    inset: 0; 
    display: none; 
    align-items: center; 
    justify-content: center; 
    
    /* CORREÇÃO VISUAL AQUI: */
    background: rgba(0, 0, 0, 0.75); /* Preto um pouco mais transparente (75%) */
    backdrop-filter: blur(5px); /* O "Blur" que desfoca o fundo (efeito vidro) */
    -webkit-backdrop-filter: blur(5px); /* Para funcionar no Safari/iPhone */
    
    z-index: 1000; 
}
.modal.open { display: flex; }
.modal-content { max-width: 95vw; max-height: 95vh; display: flex; justify-content: center; align-items: center; }
.modal-content img { max-width: 100%; max-height: 95vh; object-fit: contain; }

/* --- WhatsApp Float --- */
.whatsapp-float { position: fixed; bottom: 20px; right: 20px; z-index: 1000; display: flex; flex-direction: column; align-items: flex-end; }
.wa-main-btn { background-color: #25D366; color: white; border: none; border-radius: 50%; width: 56px; height: 56px; font-size: 24px; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2); cursor: pointer; transition: background 0.3s, transform 0.2s ease-out; }
.wa-main-btn:hover { background-color: #1ebe5c; transform: scale(1.05); }
.wa-options { display: none; flex-direction: column; align-items: flex-end; gap: 8px; margin-bottom: 10px; }
.wa-option { background-color: #25D366; color: white; text-decoration: none; padding: 10px 16px; border-radius: 20px; font-size: 14px; white-space: nowrap; box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15); transition: background 0.2s; }
.wa-option:hover { background-color: #1ebe5c; }

@media (max-width: 720px) {
    .topbar-inner { grid-template-columns: 1fr auto; }
    .clinic { display: none; }
    .exam-list { padding-left: 15px; }
    .exam-row { grid-template-columns: 1fr auto; }
    .exam-row .muted { display: none; }
}