/*
===============================================================================
  GENESIS SCREENS - Telas externas (iframe) - estilos
===============================================================================
  Prefixo .scr-* / #scrModal. Janela no MODELO AIoT (flutuante, arrastável,
  redimensionável, fullscreen/minimizar/recolher) + abas de telas + dropdown
  do botão do menu superior.
*/

.scr-modal{
  position: fixed;
  inset: 0;
  z-index: 9100;
  display: none;
  font-family: 'Rajdhani', 'Orbitron', sans-serif;
  color: #e0f7ff;
  pointer-events: none;
}
.scr-modal.scr-open{ display: block; }

.scr-modal-backdrop{
  position: absolute; inset: 0;
  background: transparent;
  pointer-events: none;
  transition: background .25s;
}
.scr-modal.scr-fullscreen .scr-modal-backdrop{
  background: rgba(0, 5, 16, .55);
  pointer-events: auto;
}

/* janela flutuante - mesma geometria do AIoT */
.scr-modal-box{
  position: absolute;
  top: 70px;
  right: 20px;
  width: 380px;              /* mesma largura de abertura do AIoT */
  height: calc(100vh - 100px);
  max-height: 720px;
  min-width: 320px;
  min-height: 400px;
  max-width: 92vw;
  background: linear-gradient(180deg, rgba(0, 10, 25, 0.88), rgba(0, 20, 45, 0.82));
  border: 1px solid rgba(0, 240, 255, 0.45);
  border-radius: 14px;
  backdrop-filter: blur(18px) saturate(1.3);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  box-shadow: 0 16px 50px rgba(0, 240, 255, 0.35),
              0 0 0 1px rgba(0, 240, 255, 0.22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0.9;
  pointer-events: auto;
  resize: both;
  animation: scrIn .3s cubic-bezier(.4, 0, .2, 1);
  transition: opacity .25s;
}
.scr-modal-box:hover,
.scr-modal-box:focus-within{ opacity: 1; }

@keyframes scrIn{
  from { opacity: 0; transform: scale(0.97) translateY(8px); }
  to   { opacity: 0.9; transform: scale(1) translateY(0); }
}

.scr-modal.scr-fullscreen .scr-modal-box{
  top: 0 !important; left: 0 !important;
  right: 0 !important; bottom: 0 !important;
  width: auto !important;
  height: auto !important;
  max-height: none !important;
  max-width: none !important;
  border-radius: 0;
  border-width: 0;
  opacity: 1;
  resize: none;
  background: linear-gradient(180deg, rgba(0, 10, 25, 0.98), rgba(0, 20, 45, 0.97));
}
.scr-modal.scr-fullscreen .scr-header{ cursor: default; }

.scr-modal.scr-minimized .scr-modal-box{
  height: auto !important;
  min-height: 0 !important;
  resize: none;
}
.scr-modal.scr-minimized .scr-status,
.scr-modal.scr-minimized .scr-tabs,
.scr-modal.scr-minimized .scr-body,
.scr-modal.scr-minimized .scr-resize-handle{ display: none !important; }

.scr-modal-box.scr-header-collapsed .scr-tabs,
.scr-modal-box.scr-header-collapsed .scr-status{ display: none; }

.scr-resize-handle{
  position: absolute;
  right: 3px; bottom: 3px;
  width: 14px; height: 14px;
  border-right: 2px solid rgba(0,240,255,.5);
  border-bottom: 2px solid rgba(0,240,255,.5);
  border-radius: 0 0 4px 0;
  opacity: 0;
  transition: opacity .2s;
  pointer-events: none;
}
.scr-modal-box:hover .scr-resize-handle{ opacity: 1; }
.scr-modal.scr-fullscreen .scr-resize-handle{ display: none; }

/* header */
.scr-header{
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 12px 16px;
  background: linear-gradient(180deg, rgba(0, 240, 255, 0.16), rgba(0, 240, 255, 0.04));
  border-bottom: 1px solid rgba(0, 240, 255, 0.35);
  flex-shrink: 0;
  gap: 12px;
  cursor: grab;
  user-select: none;
  touch-action: none;
}
.scr-header:active{ cursor: grabbing; }

.scr-title{
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Orbitron', sans-serif;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 2.5px;
  color: #00f0ff;
  text-shadow: 0 0 8px rgba(0, 240, 255, 0.5);
}
.scr-title-badge{ font-size: 15px; }
.scr-header-actions{ display: flex; gap: 6px; margin-left: auto; }

.scr-btn-icon{
  width: 28px; height: 28px;
  background: transparent;
  border: 1px solid rgba(0, 240, 255, 0.35);
  color: rgba(0, 240, 255, 0.85);
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  border-radius: 50%;
  cursor: pointer;
  transition: .2s;
  font-family: 'Orbitron', sans-serif;
}
.scr-btn-icon:hover{
  background: rgba(0, 240, 255, 0.18);
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.35);
}

.scr-btn{
  background: transparent;
  border: 1px solid rgba(0,240,255,.35);
  color: rgba(0,240,255,.85);
  border-radius: 5px;
  padding: 6px 12px;
  font-family: 'Orbitron', sans-serif;
  font-size: 11px;
  letter-spacing: 1px;
  cursor: pointer;
  transition: .2s;
}
.scr-btn:hover{ background: rgba(0,240,255,.18); }

/* status */
.scr-status{
  padding: 5px 16px;
  font-size: 11px;
  opacity: .7;
  border-bottom: 1px solid rgba(0,240,255,.1);
  letter-spacing: .5px;
  flex-shrink: 0;
}
.scr-status-loading{ color: #00f0ff; opacity: 1; }
.scr-status-loading::after{ content: ' ⏳'; }
.scr-status-error{ color: #ffd23f; opacity: 1; }

/* abas de telas */
.scr-tabs{
  display: flex;
  gap: 6px;
  padding: 8px 16px;
  border-bottom: 1px solid rgba(0,240,255,.15);
  overflow-x: auto;
  flex-shrink: 0;
}
.scr-tab{
  background: transparent;
  border: 1px solid rgba(0,240,255,.3);
  color: rgba(224,247,255,.75);
  border-radius: 7px 7px 0 0;
  padding: 6px 14px;
  font-family: inherit;
  font-size: 12px;
  letter-spacing: .5px;
  cursor: pointer;
  white-space: nowrap;
  transition: .15s;
}
.scr-tab:hover{ color: #00f0ff; }
.scr-tab-on{
  background: rgba(0,240,255,.16);
  border-color: #00f0ff;
  color: #00f0ff;
  font-weight: 700;
}
.scr-tabs-empty{ font-size: 11px; opacity: .6; padding: 4px 0; }

/* corpo do iframe */
.scr-body{
  flex: 1;
  position: relative;
  overflow: hidden;
  background: rgba(0,0,0,.35);
}
.scr-frame{
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}
.scr-loading{
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: rgba(224,247,255,.8);
  background: rgba(0,8,20,.9);
  z-index: 2;
  text-align: center;
  padding: 20px;
  line-height: 1.7;
}
.scr-empty{
  padding: 40px 24px;
  text-align: center;
  opacity: .75;
  font-size: 13px;
  line-height: 1.8;
}

/* dropdown (menu sanduíche) do botão do menu superior */
.scr-dd{
  position: fixed;
  z-index: 9500;
  min-width: 230px;
  max-width: 320px;
  display: none;
  flex-direction: column;
  background: linear-gradient(180deg, rgba(0, 14, 32, 0.98), rgba(0, 8, 20, 0.98));
  border: 1px solid rgba(0,240,255,.4);
  border-radius: 10px;
  box-shadow: 0 14px 40px rgba(0,240,255,.25);
  padding: 6px;
  backdrop-filter: blur(14px);
}
.scr-dd-open{ display: flex; }
.scr-dd-item{
  background: transparent;
  border: 0;
  color: #e0f7ff;
  text-align: left;
  padding: 10px 12px;
  border-radius: 7px;
  font-family: 'Rajdhani', sans-serif;
  font-size: 14px;
  letter-spacing: .5px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.scr-dd-item:hover{ background: rgba(0,240,255,.14); color: #00f0ff; }
.scr-dd-manage{
  border-top: 1px solid rgba(0,240,255,.18);
  border-radius: 0 0 7px 7px;
  margin-top: 4px;
  opacity: .85;
}
.scr-dd-empty{
  padding: 12px;
  font-size: 12px;
  opacity: .6;
  text-align: center;
}

/* bloco nas Configurações */
.scr-cfg-row{
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px dashed rgba(255,255,255,.1);
  font-size: 12px;
}
.scr-cfg-name{ font-weight: 700; min-width: 110px; }
.scr-cfg-url{
  flex: 1;
  opacity: .6;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
}
.scr-cfg-del{ min-width: 34px !important; padding: 4px 8px !important; }
.scr-cfg-empty{ font-size: 11px; opacity: .55; font-style: italic; padding: 6px 0; }

/* responsivo */
@media (max-width: 480px){
  .scr-modal-box{
    top: 60px;
    right: 8px;
    width: calc(100vw - 16px);
    max-width: calc(100vw - 16px);
  }
}

/* tema claro */
body.light-theme .scr-modal-box{
  background: linear-gradient(180deg, rgba(240,248,252,.96), rgba(225,238,246,.94));
  border-color: rgba(0,120,160,.4);
  color: #0b2836;
}
body.light-theme .scr-header{
  background: linear-gradient(180deg, rgba(0,150,190,.16), rgba(0,150,190,.05));
  border-bottom-color: rgba(0,120,160,.3);
}
body.light-theme .scr-title{ color: #007a99; text-shadow: none; }
body.light-theme .scr-dd{
  background: rgba(245,250,253,.98);
  border-color: rgba(0,120,160,.35);
}
body.light-theme .scr-dd-item{ color: #0b2836; }
body.light-theme .scr-tab{ color: rgba(11,40,54,.7); }
body.light-theme .scr-tab-on{ color: #007a99; }
