@import url("https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700&display=swap");

:root {
  --bg: #e9e9e9;
  --card: #ffffff;
  --text: #03326c;
  --muted: #a8a8a8;
  --primary: #03326c;
  --line: #ffffff;
  --shadow: 0 14px 36px rgba(34, 34, 34, 0.267);
  --radius: 18px;
  --input: #f5f5f5;
  --input-border: #e0e0e0;
  --focus: #d1a954;
  --hint-bg: #041b44;
  --hint-border: #ffffff;
  --hint-text: #000000;
}

* {
  box-sizing: border-box;
}

html {
  font-family: "Montserrat", "Gotham", "Gotham SSm", "Segoe UI", sans-serif;
}

body {
  margin: 0;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
}

body,
input,
button,
select,
textarea {
  font-family: inherit;
}

.header {
  margin-bottom: 18px;
  text-align: center;
}

.header h1 {
  margin: 0 0 6px;
  font-size: 28px;
  letter-spacing: 0.2px;
  padding-bottom: 30px;
}

.header p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 980px);
  gap: 18px;
  align-items: start;
  justify-content: center;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}

.panel {
  padding: 18px;
  position: static;
  backdrop-filter: saturate(120%);
  order: 2;
}

.title {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 12px;
  color: var(--primary);
}

.field {
  margin-bottom: 12px;
}

.field label {
  display: block;
  margin-bottom: 5px;
  font-size: 12px;
  font-weight: 700;
  color: #757575;
}

.field input {
  width: 100%;
  padding: 10px 11px;
  border: 1px solid var(--input-border);
  border-radius: 10px;
  background: var(--input);
  font-size: 13px;
  color: var(--text);
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.field input:focus {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(77, 166, 255, 0.2);
}

.field small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

.actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.file-edit-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.file-edit-row input {
  min-width: 0;
}

.btn-inline-edit {
  white-space: nowrap;
}

.bg-switcher {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.bg-switch-btn.is-active {
  background: var(--primary);
  color: #ffffff;
  border: 1px solid var(--primary);
}

button {
  border: 0;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition:
    transform 0.15s ease,
    opacity 0.15s ease,
    box-shadow 0.15s ease;
}

button:hover {
  transform: translateY(-1px);
  opacity: 0.98;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

.btn-secondary {
  background: #636363;
  color: #e5e5e5;
  border: 1px solid #2a2a2a;
}

.preview {
  padding: 18px;
  order: 1;
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  background: #ffffff;
  border-radius: 10px;
  border: 1px solid #1f2937;
}

#tela-foto .canvas-shell {
  max-width: 520px;
  margin: 0 auto;
}

.hint {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--hint-bg);
  border: 1px solid var(--hint-border);
  color: var(--hint-text);
  font-size: 12px;
  line-height: 1.45;
}

/* Cropper */
.cropper-modal {
  position: fixed;
  inset: 0;
  background: rgba(3, 9, 20, 0.65);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 2000;
}

.cropper-modal.is-open {
  display: flex;
}

.cropper-dialog {
  width: min(520px, 100%);
  background: var(--card);
  border-radius: 18px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  padding: 18px;
  display: grid;
  gap: 14px;
}

.cropper-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.cropper-title {
  font-weight: 700;
  color: var(--primary);
}

.cropper-close {
  background: transparent;
  color: var(--primary);
  border: 1px solid rgba(3, 50, 108, 0.3);
  padding: 6px 12px;
  border-radius: 10px;
  font-size: 12px;
}

.cropper-body {
  display: grid;
  gap: 10px;
}

.cropper-canvas-shell {
  width: 100%;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid #1f2937;
  background: #ffffff;
}

#cropperCanvas {
  display: block;
  width: 100%;
  height: auto;
  cursor: grab;
  touch-action: none;
}

.cropper-controls {
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: #565656;
}

.cropper-controls input[type="range"] {
  width: 100%;
}

.cropper-hint {
  font-size: 11px;
  color: var(--muted);
}

.cropper-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .actions {
    grid-template-columns: 1fr;
  }

  .file-edit-row {
    grid-template-columns: 1fr;
  }
}

/* Menu Lateral */
#ibs-app .ibs-menu-lateral {
  position: fixed !important;
  left: 0 !important;
  top: 0 !important;
  width: 200px !important;
  height: 100vh !important;
  background: var(--primary) !important;
  border-right: 1px solid #333;
  padding: 0;
  z-index: 1000 !important;
  display: flex !important;
  flex-direction: column !important;
}

#ibs-app .ibs-menu-logo {
  padding: 20px;
  border-bottom: 1px solid #333;
  display: flex;
  align-items: center;
  justify-content: center;
}

#ibs-app .ibs-menu-logo img {
  width: 80px !important;
  max-width: 80px !important;
  height: auto;
}

#ibs-app .ibs-menu-btn {
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  border: none !important;
  background: transparent !important;
  color: #f2f2f2;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease;
  border-left: 4px solid transparent !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  display: block !important;
}

#ibs-app .ibs-menu-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

#ibs-app .ibs-menu-btn-active {
  background: rgba(77, 166, 255, 0.2) !important;
  border-left-color: #4da6ff !important;
  color: #4da6ff;
  font-weight: 700;
}

/* Ajuste da página com menu */
#ibs-app.app-shell {
  display: flex !important;
  width: 100% !important;
  min-height: 100vh !important;
  position: relative;
  margin: 0 !important;
  max-width: none !important;
}

#ibs-app .ibs-page {
  flex: 1;
  width: calc(100% - 200px) !important;
  margin-left: 200px !important;
  padding: 24px;
  display: flex;
  justify-content: center;
}

/* Containers de Telas */
#ibs-app .ibs-tela {
  display: none !important;
  width: 100%;
  max-width: 980px;
}

#ibs-app .ibs-tela.ibs-tela-ativa {
  display: block !important;
}

@media (max-width: 768px) {
  #ibs-app .ibs-menu-lateral {
    width: 150px !important;
  }

  #ibs-app .ibs-page {
    width: calc(100% - 150px) !important;
    margin-left: 150px !important;
  }

  #ibs-app .ibs-menu-btn {
    padding: 12px 12px;
    font-size: 12px;
  }

  #ibs-app .ibs-menu-logo {
    padding: 15px;
  }

  #ibs-app .ibs-menu-logo img {
    width: 60px;
    max-width: 60px !important;
  }
}
