/* ============ VARIABLES ============ */
:root {
  --bg-dark: #09111f;
  --bg-panel: rgba(9, 17, 31, 0.84);
  --bg-card: rgba(15, 27, 46, 0.88);
  --bg-card-strong: rgba(12, 23, 39, 0.96);
  --bg-input: rgba(20, 34, 56, 0.95);
  --border: rgba(146, 179, 230, 0.16);
  --border-strong: rgba(146, 179, 230, 0.28);
  --accent: #ff7a18;
  --accent-hover: #ff933f;
  --accent2: #21c6b8;
  --accent3: #7bdff2;
  --danger: #ef4444;
  --success: #22c55e;
  --text: #f4f7fb;
  --text-muted: #a9b7cc;
  --text-dim: #7d8ba1;
  --radius: 24px;
  --radius-sm: 14px;
  --shadow: 0 28px 80px rgba(2, 7, 18, 0.45);
}

/* ============ RESET ============ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
body {
  font-family: 'Inter', sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 122, 24, 0.18), transparent 32%),
    radial-gradient(circle at 82% 14%, rgba(33, 198, 184, 0.2), transparent 26%),
    linear-gradient(180deg, #0c1728 0%, #09111f 50%, #06101c 100%);
  overflow-x: hidden;
}
a { color: var(--accent3); }
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: rgba(5, 10, 18, 0.4); }
::-webkit-scrollbar-thumb { background: rgba(123, 223, 242, 0.25); border-radius: 999px; }
::selection { background: rgba(255, 122, 24, 0.35); color: #fff; }

/* ============ LAYOUT ============ */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 26px;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(18px);
  background: rgba(6, 14, 25, 0.72);
  border-bottom: 1px solid rgba(123, 223, 242, 0.1);
}
.header-left, .header-center, .header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.header-left { min-width: 0; }
.header-center { flex: 1; justify-content: center; flex-wrap: wrap; }
.header-right { justify-content: flex-end; }

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
.brand-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  font-family: 'Montserrat', sans-serif;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #08101d;
  background: linear-gradient(135deg, #ffb06a 0%, #ff7a18 55%, #ffd166 100%);
  box-shadow: 0 12px 24px rgba(255, 122, 24, 0.32);
}
.header-kicker,
.workspace-kicker,
.sidebar-chip,
.section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.header-kicker { color: var(--accent3); margin-bottom: 4px; }
.logo-title {
  font-family: 'Montserrat', sans-serif;
  font-size: 30px;
  font-weight: 800;
  line-height: 1;
}

.header-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(12, 23, 39, 0.72);
  color: var(--text-muted);
  font-size: 12px;
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 0 6px rgba(52, 211, 153, 0.18);
}

.main-layout {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr) 320px;
  gap: 18px;
  min-height: calc(100vh - 82px);
  padding: 18px;
}
.sidebar {
  min-height: 0;
  backdrop-filter: blur(18px);
  border: 1px solid var(--border);
  background: var(--bg-panel);
  box-shadow: var(--shadow);
}
.sidebar-left,
.sidebar.sidebar-left,
.sidebar-right,
.sidebar.sidebar-right {
  border-radius: 30px;
  overflow: hidden;
}
.sidebar-left,
.sidebar.sidebar-left {
  display: flex;
  flex-direction: column;
}
.sidebar-right,
.sidebar.sidebar-right {
  padding: 20px;
  overflow-y: auto;
}

.sidebar-intro {
  padding: 24px 22px 18px;
  background:
    radial-gradient(circle at 100% 0%, rgba(255, 122, 24, 0.28), transparent 34%),
    linear-gradient(180deg, rgba(17, 32, 54, 0.96), rgba(11, 21, 37, 0.96));
  border-bottom: 1px solid rgba(123, 223, 242, 0.1);
}
.sidebar-chip {
  display: inline-flex;
  align-items: center;
  padding: 8px 10px;
  border-radius: 999px;
  margin-bottom: 14px;
  color: #08101d;
  background: linear-gradient(135deg, #7bdff2, #21c6b8);
}
.sidebar-intro h2 {
  font-family: 'Montserrat', sans-serif;
  font-size: 26px;
  line-height: 1.05;
  margin-bottom: 10px;
}
.sidebar-intro p {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.6;
}

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 14px;
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  background: linear-gradient(180deg, rgba(20, 34, 56, 0.95), rgba(13, 24, 42, 0.95));
  transition: transform .16s ease, border-color .16s ease, background .16s ease, box-shadow .16s ease;
}
.btn:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
}
.btn-primary {
  color: #09111f;
  background: linear-gradient(135deg, #ffd166, #ff7a18 60%, #ff9f43);
  box-shadow: 0 14px 28px rgba(255, 122, 24, 0.26);
}
.btn-primary:hover { background: linear-gradient(135deg, #ffd77c, #ff933f 60%, #ffae55); }
.btn-outline {
  background: transparent;
  border-color: var(--border);
}
.btn-outline:hover { border-color: var(--accent3); color: var(--accent3); }
.btn-danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
}
.btn-sm { padding: 8px 12px; font-size: 12px; }
.btn-block { width: 100%; }
.btn-accent {
  background: linear-gradient(135deg, #21c6b8, #7bdff2);
  color: #09111f;
}
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ============ TABS ============ */
.sidebar-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 18px 18px 0;
}
.tab-btn {
  min-height: 46px;
  padding: 10px 8px;
  border: 1px solid transparent;
  border-radius: 16px;
  background: rgba(17, 29, 49, 0.72);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .16s ease, border-color .16s ease, background .16s ease, color .16s ease;
}
.tab-btn:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
  color: var(--text);
}
.tab-btn.active {
  color: #09111f;
  border-color: transparent;
  background: linear-gradient(135deg, #7bdff2, #21c6b8 52%, #ffb06a);
}
.tab-panel {
  display: none;
  padding: 18px;
  overflow-y: auto;
}
.tab-panel.active { display: block; }

/* ============ AI PANEL ============ */
.ai-hero-card,
.ai-section,
.ai-tools-card,
.props-section,
.modal,
.template-card,
.icon-card,
.upload-zone,
#bg-gradient-opts,
.logo-item {
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(18, 31, 52, 0.96), rgba(11, 21, 37, 0.96));
  box-shadow: 0 18px 42px rgba(4, 10, 20, 0.24);
}
.ai-hero-card {
  padding: 20px;
  border-radius: 24px;
  margin-bottom: 14px;
  background:
    radial-gradient(circle at top right, rgba(255, 122, 24, 0.22), transparent 34%),
    linear-gradient(180deg, rgba(18, 31, 52, 0.98), rgba(11, 21, 37, 0.98));
}
.ai-hero-card h3 {
  font-family: 'Montserrat', sans-serif;
  font-size: 24px;
  margin-top: 6px;
  margin-bottom: 10px;
}
.ai-hero-card p { color: var(--text-muted); line-height: 1.6; font-size: 14px; }
.ai-panel-grid {
  display: grid;
  gap: 12px;
}
.ai-section,
.ai-tools-card,
.props-section {
  padding: 16px;
  border-radius: 22px;
}
.ai-section-emphasis {
  background:
    radial-gradient(circle at top left, rgba(123, 223, 242, 0.16), transparent 28%),
    linear-gradient(180deg, rgba(18, 31, 52, 0.96), rgba(11, 21, 37, 0.96));
}
.ai-tools-card { margin-top: 12px; }
.ai-tool-row .btn { flex: 1 1 220px; }
.ai-section textarea {
  width: 100%;
  padding: 12px 14px;
  background: rgba(8, 17, 31, 0.68);
  border: 1px solid rgba(123, 223, 242, 0.12);
  border-radius: 16px;
  color: var(--text);
  font-size: 14px;
  resize: vertical;
  font-family: inherit;
}
.ai-section textarea:focus { border-color: rgba(123, 223, 242, 0.38); outline: none; }
#ai-status { min-height: 18px; font-size: 12px; }
#btn-ai-generate:disabled { opacity: 0.55; cursor: not-allowed; }

/* ============ FORMS ============ */
.panel-header { margin-bottom: 12px; }
.section-label { color: var(--accent3); margin-bottom: 8px; }
.prop-group { margin-bottom: 12px; }
.prop-group label { display: block; margin-bottom: 6px; color: var(--text-muted); font-size: 12px; }
.input-sm,
.prop-group input[type="text"],
.prop-group input[type="number"],
.prop-group input[type="url"],
.prop-group select,
select,
.modal-body input,
.modal-body textarea,
.form-group input,
.form-group textarea {
  width: 100%;
  padding: 11px 13px;
  border-radius: 16px;
  border: 1px solid rgba(123, 223, 242, 0.12);
  background: var(--bg-input);
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: border-color .16s ease, background .16s ease;
}
.input-sm:focus,
.prop-group input:focus,
.prop-group select:focus,
select:focus,
.modal-body input:focus,
.modal-body textarea:focus,
.form-group input:focus,
.form-group textarea:focus {
  border-color: rgba(123, 223, 242, 0.42);
}
.input-row { display: flex; align-items: center; gap: 8px; }
.input-row input[type="number"] { width: 100%; }
input[type="range"] { width: 100%; accent-color: var(--accent); }
input[type="color"] {
  width: 44px;
  min-width: 44px;
  height: 38px;
  padding: 3px;
  border-radius: 14px;
  border: 1px solid rgba(123, 223, 242, 0.12);
  background: rgba(8, 17, 31, 0.68);
  cursor: pointer;
}
.color-row { display: flex; align-items: center; gap: 10px; }
.color-presets { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.cpre {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.16);
  cursor: pointer;
  transition: transform .16s ease, border-color .16s ease;
}
.cpre:hover { transform: scale(1.12); border-color: rgba(255,255,255,0.5); }

/* ============ CONTENT CARDS ============ */
.grid-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.template-card,
.icon-card {
  border-radius: 20px;
  overflow: hidden;
  cursor: pointer;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.template-card:hover,
.icon-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 122, 24, 0.36);
  box-shadow: 0 22px 44px rgba(255, 122, 24, 0.12);
}
.template-card .preview {
  background: linear-gradient(135deg, rgba(123, 223, 242, 0.12), rgba(255, 122, 24, 0.14));
}
.template-card .name,
.icon-card .name {
  padding: 10px 12px;
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.icon-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px;
}
.icon-card svg { width: 38px; height: 38px; color: var(--text); }

.shapes-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.shape-btn {
  width: 100%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 18px;
  border: 1px solid rgba(123, 223, 242, 0.12);
  background: rgba(17, 29, 49, 0.84);
  color: var(--text);
  cursor: pointer;
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
}
.shape-btn:hover { transform: translateY(-1px); border-color: rgba(123, 223, 242, 0.4); }
.shape-btn svg { width: 24px; height: 24px; }
.shape-options { padding-top: 14px; }

.text-presets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.text-preset-btn {
  min-height: 72px;
  padding: 10px 8px;
  border-radius: 18px;
  border: 1px solid rgba(123, 223, 242, 0.12);
  background: rgba(17, 29, 49, 0.82);
  cursor: pointer;
  transition: transform .16s ease, border-color .16s ease;
}
.text-preset-btn:hover { transform: translateY(-1px); border-color: rgba(255, 122, 24, 0.32); }

/* ============ CANVAS ============ */
.canvas-area {
  position: relative;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.workspace-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px;
  border-radius: 30px;
  border: 1px solid var(--border);
  background: rgba(9, 17, 31, 0.72);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}
.workspace-kicker { color: var(--accent3); display: inline-block; margin-bottom: 8px; }
.workspace-topbar h2 {
  font-family: 'Montserrat', sans-serif;
  font-size: 28px;
  margin-bottom: 8px;
}
.workspace-topbar p { max-width: 560px; color: var(--text-muted); font-size: 14px; line-height: 1.6; }
.canvas-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding-left: 12px;
}
.canvas-stage {
  position: relative;
  flex: 1;
  min-height: 520px;
  display: grid;
  place-items: center;
  padding: 22px;
  border-radius: 34px;
  border: 1px solid var(--border);
  background:
    linear-gradient(180deg, rgba(7, 15, 27, 0.82), rgba(9, 17, 31, 0.96)),
    linear-gradient(135deg, rgba(123, 223, 242, 0.08), transparent);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.canvas-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(12px);
  pointer-events: none;
}
.canvas-glow-one {
  width: 320px;
  height: 320px;
  top: -80px;
  left: -70px;
  background: rgba(255, 122, 24, 0.14);
}
.canvas-glow-two {
  width: 260px;
  height: 260px;
  bottom: -80px;
  right: -50px;
  background: rgba(123, 223, 242, 0.12);
}
.canvas-wrapper {
  position: relative;
  z-index: 1;
  padding: 28px;
  border-radius: 30px;
  border: 1px solid rgba(123, 223, 242, 0.12);
  background:
    linear-gradient(135deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01)),
    repeating-conic-gradient(#13233b 0% 25%, #0d1a2e 0% 50%);
  background-size: auto, 22px 22px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}
.canvas-container { border-radius: 18px; overflow: hidden; }
canvas { display: block; }

/* ============ RIGHT SIDEBAR ============ */
.props-section { margin-bottom: 14px; }
.props-section h3 {
  font-family: 'Montserrat', sans-serif;
  font-size: 16px;
  margin-bottom: 12px;
}
.bg-options { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.bg-opt {
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(123, 223, 242, 0.12);
  background: rgba(8, 17, 31, 0.54);
  color: var(--text-muted);
  cursor: pointer;
}
.bg-opt.active { background: linear-gradient(135deg, rgba(255, 122, 24, 0.24), rgba(123, 223, 242, 0.24)); color: var(--text); }
#bg-gradient-opts { margin-top: 8px; padding: 10px; border-radius: 18px; }

.logos-list { max-height: 240px; overflow-y: auto; }
.logo-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  margin-bottom: 8px;
  cursor: pointer;
}
.logo-item .name { font-size: 13px; }
.delete-btn {
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 16px;
  cursor: pointer;
}
.delete-btn:hover { color: var(--danger); }

/* ============ TEXT / EFFECTS ============ */
.toggle-btn {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  border: 1px solid rgba(123, 223, 242, 0.12);
  background: rgba(8, 17, 31, 0.54);
  color: var(--text-muted);
  cursor: pointer;
}
.toggle-btn.active { background: linear-gradient(135deg, #ff7a18, #ffb06a); color: #09111f; }
.gradient-presets { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.grad-preset {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  border: 2px solid transparent;
  cursor: pointer;
}
.grad-preset:hover { border-color: rgba(255,255,255,0.5); }
label.mini,
.hint,
.range-val,
.separator { color: var(--text-dim); }

/* ============ UPLOAD ============ */
.upload-zone {
  padding: 20px;
  border-radius: 22px;
  border-style: dashed;
  text-align: center;
  color: var(--text-muted);
  cursor: pointer;
}
.upload-zone:hover { border-color: rgba(255, 122, 24, 0.4); }
.drop-icon { font-size: 34px; margin-bottom: 10px; }
.upload-zone.drag-over,
.canvas-area.drag-over {
  border-color: rgba(255, 122, 24, 0.48) !important;
  background: rgba(255, 122, 24, 0.08) !important;
}

/* ============ MODALS ============ */
.modal-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(3, 8, 16, 0.72);
  backdrop-filter: blur(12px);
  z-index: 1000;
}
.modal {
  width: min(100%, 430px);
  padding: 22px;
  border-radius: 28px;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.modal-header h2,
.modal h3 {
  font-family: 'Montserrat', sans-serif;
  font-size: 22px;
}
.modal-body input,
.modal-body textarea { margin-bottom: 10px; }
.modal-close {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
}
.modal-close:hover { color: var(--text); }
.tab-switch { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 16px; }
.tab-switch button {
  padding: 10px;
  border-radius: 14px;
  border: 1px solid rgba(123, 223, 242, 0.12);
  background: rgba(8, 17, 31, 0.56);
  color: var(--text-muted);
  cursor: pointer;
}
.tab-switch button.active { background: linear-gradient(135deg, #ff7a18, #ffb06a); color: #09111f; }

.hidden { display: none !important; }
.alert { padding: 10px 12px; border-radius: 14px; font-size: 13px; margin-bottom: 8px; }
.alert-error { background: rgba(127, 29, 29, 0.25); color: #fecaca; border: 1px solid rgba(239, 68, 68, 0.3); }
.error-msg { color: #fca5a5; font-size: 13px; padding: 4px 0; }

/* ============ LANG ============ */
.lang-selector,
#lang-selector {
  display: flex;
  align-items: center;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 1200px) {
  .main-layout {
    grid-template-columns: 320px minmax(0, 1fr);
  }
  .sidebar-right,
  .sidebar.sidebar-right {
    grid-column: 1 / -1;
  }
}

@media (max-width: 960px) {
  .header {
    flex-wrap: wrap;
    align-items: flex-start;
  }
  .header-center {
    order: 3;
    justify-content: flex-start;
    width: 100%;
  }
  .main-layout {
    grid-template-columns: 1fr;
  }
  .workspace-topbar {
    flex-direction: column;
  }
  .sidebar-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .header,
  .main-layout { padding: 14px; }
  .main-layout { gap: 14px; }
  .sidebar-intro,
  .tab-panel,
  .sidebar-right,
  .sidebar.sidebar-right { padding: 16px; }
  .sidebar-tabs { padding: 16px 16px 0; }
  .workspace-topbar h2 { font-size: 24px; }
  .canvas-stage { min-height: 420px; padding: 14px; }
  .canvas-wrapper { padding: 18px; }
  .grid-list,
  .text-presets { grid-template-columns: 1fr; }
}
