:root {
    --bg-color: #121212;
    --panel-bg: #1e1e1e;
    --text-color: #e0e0e0;
    --accent-color: #00bcd4;
    --step-done: #4caf50;
    --step-active: #2196f3;
    --led-off: #333;
    --led-ready: #4caf50;
    --led-exposure: #f44336;
    --led-fault: #ffeb3b;
}

body { margin: 0; font-family: 'Segoe UI', sans-serif; background: var(--bg-color); color: var(--text-color); overflow: hidden; }
#app { display: grid; grid-template-rows: 80px 1fr; height: 100vh; }

#main-header { background: #1a1a1a; display: flex; justify-content: space-between; align-items: center; padding: 0 20px; border-bottom: 2px solid var(--accent-color); }
#workflow-steps { display: flex; gap: 10px; }
.step { font-size: 0.7rem; padding: 8px 12px; background: #333; border-radius: 20px; opacity: 0.5; transition: 0.3s; }
.step.active { opacity: 1; background: var(--step-active); font-weight: bold; transform: scale(1.05); }
.step.done { opacity: 1; background: var(--step-done); }

main { display: grid; grid-template-columns: 420px 1fr; padding: 20px; gap: 20px; overflow: hidden; }
#workflow-panel { background: var(--panel-bg); border-radius: 12px; padding: 25px; overflow-y: auto; box-shadow: 0 4px 15px rgba(0,0,0,0.5); }
.workflow-content h2 { border-bottom: 2px solid var(--accent-color); padding-bottom: 10px; margin-bottom: 20px; color: var(--accent-color); font-weight: 300; }

form label { display: block; margin-top: 15px; font-size: 0.85rem; color: #aaa; }
form input, .modern-select, textarea { width: 100%; padding: 12px; margin-top: 5px; background: #2a2a2a; border: 1px solid #444; color: white; border-radius: 6px; box-sizing: border-box; }
form button, .workflow-content button { width: 100%; padding: 14px; margin-top: 20px; background: var(--step-active); border: none; color: white; border-radius: 6px; font-weight: bold; cursor: pointer; transition: 0.2s; }

#simulation-area { display: flex; flex-direction: column; gap: 15px; transition: 0.5s; }
#simulation-area.locked { opacity: 0.2; pointer-events: none; filter: grayscale(1); }
#room-canvas { flex: 1; background: radial-gradient(circle, #fcfcfc, #d0d0d0); border-radius: 12px; position: relative; overflow: hidden; }

#tube-assembly { position: absolute; top: 30px; left: 150px; width: 70px; height: 90px; background: #444; border-radius: 4px; cursor: move; z-index: 10; display: flex; flex-direction: column; align-items: center; justify-content: center; color: white; font-size: 0.7rem; }
#collimator-light { width: 35px; height: 35px; border: 1px dashed yellow; background: rgba(255,255,0,0.1); margin-top: 5px; }
#exam-table { position: absolute; bottom: 80px; left: 100px; width: 300px; height: 35px; background: #888; border-radius: 4px; }
#table-top { width: 100%; height: 100%; background: #aaa; cursor: move; }
#patient-silhouette { position: absolute; bottom: 120px; left: 200px; width: 100px; height: 35px; background: #ccc; border-radius: 18px; text-align: center; line-height: 35px; color: #333; font-weight: bold; transition: all 0.5s; }

.patient-ortostatico { bottom: 120px !important; transform: rotate(-90deg) scaleY(1.3); left: 250px !important; }
.patient-decubito { bottom: 120px !important; transform: rotate(0deg); }

#control-panel-wrapper { background: #1a1a1a; padding: 15px; border-radius: 12px; border: 1px solid #333; }
.display-group { display: flex; gap: 10px; justify-content: space-around; }
.display { background: #000; padding: 8px; border: 2px solid #333; border-radius: 6px; min-width: 90px; text-align: center; }
.display label { font-size: 0.6rem; color: #888; display: block; }
.display .value { font-family: monospace; font-size: 1.6rem; color: #00ff00; }
.adjust { display: flex; gap: 4px; margin-top: 8px; flex-wrap: wrap; }
.adjust button { flex: 1 1 40%; background: #333; color: white; border: none; padding: 6px 2px; cursor: pointer; border-radius: 2px; font-size: 0.7rem; margin-bottom: 2px; }
.adjust button:hover { background: var(--accent-color); color: #000; }

.admin-table th:nth-child(5) { width: 180px; } /* Coluna da Técnica */

.main-buttons { display: flex; gap: 15px; margin-top: 15px; }
.btn-large { flex: 1; padding: 15px; font-size: 1rem; font-weight: bold; border-radius: 8px; border: none; background: #444; color: #888; cursor: pointer; }
#btn-prep.active { background: #2196f3; color: white; box-shadow: 0 0 15px #2196f3; }
#btn-expose.active { background: #f44336; color: white; box-shadow: 0 0 15px #f44336; }

#status-bar { display: flex; gap: 10px; align-items: center; }
.led { padding: 6px 10px; background: #222; border-radius: 4px; font-size: 0.65rem; font-weight: bold; color: #444; }
.active-ready { background: var(--led-ready) !important; color: #000 !important; }
.active-exposure { background: var(--led-exposure) !important; color: #fff !important; }

#btn-admin-access { background: #222; border: 1px solid #444; color: #777; font-size: 0.65rem; padding: 6px 12px; border-radius: 4px; cursor: pointer; }
#btn-admin-access:hover { border-color: var(--accent-color); color: var(--accent-color); }

/* Modal Admin */
.modal { position: fixed; z-index: 2000; left: 0; top: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.85); backdrop-filter: blur(8px); display: flex; align-items: center; justify-content: center; }
.modal-content { background: #1a1a1a; padding: 30px; border: 1px solid #333; width: 90%; max-width: 1000px; border-radius: 12px; max-height: 90vh; overflow: hidden; position: relative; }
.close { position: absolute; right: 20px; top: 20px; font-size: 28px; cursor: pointer; color: #666; }
.close:hover { color: white; }

.admin-tabs { display: flex; gap: 10px; border-bottom: 1px solid #333; margin-bottom: 20px; padding-bottom: 10px; }
.tab-btn { background: none; border: none; color: #666; font-weight: bold; padding: 10px 20px; cursor: pointer; font-size: 0.8rem; }
.tab-btn.active { color: var(--accent-color); border-bottom: 2px solid var(--accent-color); }

.admin-view { overflow-y: auto; max-height: 60vh; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.admin-table th, .admin-table td { text-align: left; padding: 12px; border-bottom: 1px solid #333; }
.admin-table th { color: var(--accent-color); }

#admin-logs-list { font-family: monospace; font-size: 0.75rem; color: #888; background: #000; padding: 15px; border-radius: 8px; }

.toggle-control { display: flex; align-items: center; gap: 20px; background: #222; padding: 20px; border-radius: 8px; margin-top: 20px; }
.switch { position: relative; width: 50px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background: #444; transition: .4s; border-radius: 24px; }
.slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background: white; transition: .4s; border-radius: 50%; }
input:checked + .slider { background: var(--accent-color); }
input:checked + .slider:before { transform: translateX(26px); }

.anatomical-marker { position: absolute; width: 12px; height: 12px; background: #ffeb3b; border-radius: 50%; opacity: 0; transition: 0.3s; z-index: 100; border: 2px solid #000; }
.target { opacity: 1 !important; background: #00ff00 !important; box-shadow: 0 0 15px #00ff00; width: 18px; height: 18px; }
/* Estilos para o PDF de Relatório */
@media print {
    body * { visibility: hidden; }
    #pdf-report-content, #pdf-report-content * { visibility: visible; }
    #pdf-report-content {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        padding: 0;
        margin: 0;
        color: black !important;
        background: white !important;
    }
    #workflow-panel, #simulation-area, #main-header, button, aside { display: none !important; }
}
