/* ============================================================
   RESET & VARIABLES
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0d0d0f;
  --sidebar:   #131317;
  --surface:   #1a1a20;
  --surface2:  #222229;
  --border:    #2a2a35;
  --border2:   #35353f;
  --text:      #e8e8f0;
  --muted:     #6666888;
  --accent:    #a855f7;
  --accent2:   #ec4899;
  --grad:      linear-gradient(135deg, #a855f7, #ec4899);
  --radius:    14px;
  --sidebar-w: 220px;
  --cell:      180px;   /* base bento cell size */
  --gap:       10px;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 12px;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 200;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 10px 22px;
}

.logo-mark {
  font-size: 22px;
  background: var(--grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-text {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

/* NAV */
.sidebar-nav { display: none; } /* ilerde açmak için: display: flex; */
.sidebar-nav-hidden {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  color: #66668a;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  user-select: none;
}

.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; }

.nav-item:hover { background: var(--surface); color: var(--text); }

.nav-item.active {
  background: var(--surface2);
  color: var(--text);
}

/* USER CARD */
.sidebar-bottom { position: relative; }

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s;
  user-select: none;
}

.user-card:hover { background: var(--surface); border-color: var(--border); }
.user-card.open  { background: var(--surface); border-color: var(--border); }

.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--grad);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
  flex-shrink: 0;
}

.user-info { flex: 1; min-width: 0; }
.user-name  { font-size: 13px; font-weight: 600; display: block; }
.user-plan  { font-size: 11px; color: #66668a; display: block; }

.chevron {
  width: 14px; height: 14px;
  color: #66668a;
  transition: transform 0.2s;
  flex-shrink: 0;
}

.user-card.open .chevron { transform: rotate(180deg); }

/* DROPDOWN */
.user-dropdown {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0; right: 0;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 8px 32px #00000088;
  animation: popUp 0.15s ease;
}

@keyframes popUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  font-size: 13px;
  color: var(--text);
  text-decoration: none;
  transition: background 0.12s;
}

.dropdown-item svg { width: 15px; height: 15px; color: #66668a; }
.dropdown-item:hover { background: var(--surface); }
.dropdown-item.danger { color: #f87171; }
.dropdown-item.danger svg { color: #f87171; }

.dropdown-sep {
  height: 1px;
  background: var(--border);
  margin: 2px 0;
}

/* ============================================================
   MAIN
   ============================================================ */
.main-wrapper {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-y: auto;
}

/* ============================================================
   TOP NAV
   ============================================================ */
.topnav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 26px;
  border-bottom: 1px solid var(--border);
  background: var(--sidebar);
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 20px;
}

.topnav-title h1 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.topnav-title span {
  display: block;
  font-size: 12px;
  color: #66668a;
  margin-top: 2px;
}

.topnav-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* SEARCH */
.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px #a855f722;
}

.search-box svg { width: 14px; height: 14px; color: #66668a; flex-shrink: 0; }

.search-box input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  width: 190px;
}

.search-box input::placeholder { color: #55556a; }

.search-clear {
  background: none;
  border: none;
  color: #66668a;
  font-size: 16px;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
  transition: color 0.15s;
}

.search-clear:hover { color: var(--text); }

/* NOTIF */
.notif-wrap { position: relative; }

.icon-btn {
  width: 38px; height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: #66668a;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  position: relative;
}

.icon-btn svg { width: 16px; height: 16px; }
.icon-btn:hover { background: var(--surface2); color: var(--text); }
.icon-btn.open  { background: var(--surface2); color: var(--text); border-color: var(--border2); }

.notif-dot {
  position: absolute;
  top: 7px; right: 7px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent2);
  border: 2px solid var(--surface);
}

.notif-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 300px;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 12px 40px #00000099;
  animation: popDown 0.15s ease;
  z-index: 300;
}

@keyframes popDown {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.notif-header {
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 600;
  color: #66668a;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}

.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  transition: background 0.12s;
  cursor: pointer;
}

.notif-item:hover { background: var(--surface); }

.notif-item.unread { background: #a855f708; }

.notif-icon {
  width: 30px; height: 30px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}

.notif-icon.purple { background: #a855f722; color: var(--accent); }
.notif-icon.pink   { background: #ec489922; color: var(--accent2); }
.notif-icon.gray   { background: var(--surface); color: #66668a; }

.notif-item p { font-size: 13px; margin-bottom: 3px; }
.notif-item span { font-size: 11px; color: #66668a; }

.notif-footer {
  padding: 11px;
  text-align: center;
  font-size: 12px;
  color: var(--accent);
  border-top: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.12s;
}

.notif-footer:hover { background: var(--surface); }

/* ============================================================
   CATEGORY TAB BAR
   ============================================================ */
.cat-bar {
  background: var(--sidebar);
  border-bottom: 1px solid var(--border);
  padding: 0 26px;
  overflow: hidden;
}

.cat-track {
  display: flex;
  align-items: center;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 10px 0;
}

.cat-track::-webkit-scrollbar { display: none; }

.cat-tab {
  flex-shrink: 0;
  padding: 6px 14px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: #66668a;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  user-select: none;
}

.cat-tab:hover { background: var(--surface2); color: var(--text); }

.cat-tab.active {
  background: var(--text);
  color: #0d0d0f;
  font-weight: 700;
}

/* ============================================================
   GRID CONTAINER
   ============================================================ */
.grid-container {
  padding: 22px 26px 32px;
  flex: 1;
}

/* ============================================================
   BENTO GRID
   ============================================================ */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: var(--cell);
  gap: var(--gap);
}

/* ---- Card sizes ---- */
.size-big    { grid-column: span 2; grid-row: span 2; }
.size-tall   { grid-column: span 1; grid-row: span 2; }
.size-wide   { grid-column: span 2; grid-row: span 1; }
.size-normal { grid-column: span 1; grid-row: span 1; }

/* ============================================================
   TEMPLATE CARD
   ============================================================ */
.t-card {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  background: var(--surface);
  border: 1.5px solid transparent;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

.t-card img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.t-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 10px 40px #a855f730;
}

.t-card:hover img { transform: scale(1.05); }

.t-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px #a855f740;
}

/* gradient overlay */
.card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, #000000cc 0%, #00000055 40%, transparent 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 16px;
  pointer-events: none;
}

.card-overlay h2 {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 3px;
}

.size-big .card-overlay h2 { font-size: 22px; }

.card-overlay p {
  font-size: 12px;
  color: #ffffffbb;
}

/* Use button (shown on hover) */
.card-use-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.85);
  background: var(--grad);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  padding: 9px 20px;
  border-radius: 30px;
  display: flex;
  align-items: center;
  gap: 7px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  white-space: nowrap;
}

.card-use-btn svg { width: 14px; height: 14px; }

.t-card:hover .card-use-btn {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* ============================================================
   PROMPT PANEL
   ============================================================ */
.prompt-panel {
  grid-column: 1 / -1;
  background: var(--surface);
  border: 1.5px solid var(--accent);
  border-radius: var(--radius);
  padding: 20px 22px 18px;
  animation: panelIn 0.22s ease;
  box-shadow: 0 4px 40px #a855f720;
}

@keyframes panelIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.panel-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
}

.panel-title-name {
  background: var(--grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.panel-close {
  width: 28px; height: 28px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: transparent;
  color: #66668a;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s;
}

.panel-close:hover { background: var(--surface2); color: var(--text); }

.panel-textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.65;
  padding: 12px 14px;
  resize: vertical;
  min-height: 90px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.panel-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px #a855f718;
}

.panel-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  gap: 10px;
}

.panel-char-count {
  font-size: 12px;
  color: #55556a;
}

.panel-btns {
  display: flex;
  gap: 8px;
}

.btn-reset {
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: #66668a;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.btn-reset:hover { background: var(--surface2); color: var(--text); }

.btn-generate {
  padding: 9px 22px;
  border-radius: 8px;
  border: none;
  background: var(--grad);
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: flex; align-items: center; gap: 7px;
  transition: opacity 0.15s, transform 0.1s;
}

.btn-generate:hover { opacity: 0.88; }
.btn-generate:active { transform: scale(0.97); }
.btn-generate:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-generate svg { width: 14px; height: 14px; }

.btn-generate .spinner {
  width: 14px; height: 14px;
  border: 2px solid #ffffff55;
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 80px 0;
  color: #55556a;
}

.empty-state svg { width: 48px; height: 48px; }
.empty-state p { font-size: 16px; font-weight: 600; color: #66668a; }
.empty-state span { font-size: 13px; }

/* ============================================================
   TOAST
   ============================================================ */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--surface2);
  border: 1px solid var(--border2);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  padding: 11px 20px;
  border-radius: 30px;
  box-shadow: 0 8px 32px #00000088;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ============================================================
   UTILITY
   ============================================================ */
.hidden { display: none !important; }

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1000px) {
  .bento-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 760px) {
  .sidebar { display: none; }
  .main-wrapper { margin-left: 0; }
  .bento-grid {
    grid-template-columns: repeat(2, 1fr);
    --cell: 160px;
  }
  .size-big { grid-column: span 2; }
}

@media (max-width: 480px) {
  .bento-grid { grid-template-columns: 1fr 1fr; --cell: 140px; }
  .size-big, .size-wide { grid-column: span 2; }
  .topnav { flex-direction: column; align-items: flex-start; gap: 10px; }
  .search-box input { width: 130px; }
}
