:root {
  --bg:#0d0f11; --panel:#111315; --glass:rgba(0,0,0,0.45);
  --hover:#1a1d1f; --border:#222526; --accent:#0055ff; --accent2:#1679fa;
  --radius:14px; --blur:14px; --text-muted:#9aa2ac;
}
*{box-sizing:border-box;} body{margin:0;background:var(--bg);color:#fff;font-family:Inter,system-ui;overflow-y: auto;min-height: 100dvh;display:flex;flex-direction:column;}

/* NAVBAR */
.navbar{padding:14px 22px;border-bottom:1px solid var(--border);background:var(--panel);display:flex;justify-content:space-between;align-items:center;width: 100%; margin:auto; max-width:980px;}
.logo{font-weight:700;font-size:20px;}

/* TEMPLATE STRIP */
.templates-strip-desc p {padding: 10px 20px; margin: 0;opacity: 0.7;width: 100%; margin:auto; max-width:980px;}
.templates-strip{padding:10px 20px;border-bottom:1px solid var(--border);display:flex;gap:12px;overflow-x:auto;background:#0f1113;width: 100%; margin:auto; max-width:980px;}
.template-item{min-width:100px;height:100px;border-radius:var(--radius);overflow:hidden;cursor:pointer;border:2px solid transparent;transition:.2s;background:#000;}
.template-item.selected{border-color:var(--accent);} .template-item img{width:100%;height:100%;object-fit:cover;}

/* FEED GRID */
.feed{flex:1;overflow-y:auto;padding:20px; padding-bottom: 120px; max-width: 980px; width: 100%; margin: auto;} .grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));gap:18px;width: 100%;justify-content: left;}
.card{position:relative;background:var(--panel);border-radius:var(--radius);overflow:hidden;cursor:pointer;}
.card img{width:100%;height:100%; object-fit:cover;display:block;border-radius:var(--radius);} 

/* Hover overlay */
.card-overlay{position:absolute;bottom:0;left:0;width:100%;padding:10px;display:flex;gap:10px;align-items:center;justify-content:flex-start;background:var(--glass);backdrop-filter:blur(var(--blur));opacity:0;transition:.25s;}
.card:hover .card-overlay{opacity:1;}
.icon-btn{width:32px;height:32px;display:flex;align-items:center;justify-content:center;border-radius:8px;background:rgba(255,255,255,0.08);cursor:pointer;}
.icon-btn:hover{background:rgba(255,255,255,0.18);} 

/* Skeleton */
.skel{width:100%;min-height: 290px;height:100%;background:linear-gradient(90deg,#1a1d1f 0%,#2a2d30 50%,#1a1d1f 100%);background-size:200% 100%;animation:shimmer 1.4s infinite;border-radius:var(--radius);} @keyframes shimmer{0%{background-position:-200%}100%{background-position:200%}}

/* Composer */
.composer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  padding: 16px 22px;
  display: flex;
  align-items: center;
  gap: 14px;
  z-index: 50;
  margin: auto;
  max-width: 980px;
  right: 0;
}

/* Avatar stays the same */
.avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  overflow: hidden;
  background: #6363636d;
  color: #ffffffc2;
  border: 2px solid transparent;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
}

.avatar img {
  object-fit: cover;
  width: 100%;
}

/* ChatGPT-style input box */
.prompt-box {
  flex: 1;
  display: flex;
  align-items: center;
  padding: 10px 14px;
  background: #0f1113;
  border: 1px solid #2a2d30;
  border-radius: 14px;
  gap: 10px;
  position: relative;
  transition: border-color .2s;
}

.prompt-box:focus-within {
  border-color: #444;
}

.prompt-box textarea {
  flex: 1;
  resize: none;
  border: none;
  outline: none;
  background: transparent;
  color: #fff;
  font-size: 15px;
  line-height: 1.4;
  max-height: 150px;
}

/* Send button like ChatGPT */
.send-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #196be6;
  border: 1px solid #303236;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #c8c8cc;
  transition: .2s;
  transform: rotate(270deg);
}

.send-btn:hover {
  background: #2a74e4;
  color: white;
}
/* Fullscreen Popup */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(20px);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal.active {
  opacity: 1;
  visibility: visible;
}

.modal-container {
  width: 94vw;
  max-width: 1400px;
  max-height: 90vh;
  display: flex;
  gap: 24px;
  background: var(--panel);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border);
}

/* Image side */
.modal-image-container {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px;
  background: #0a0b0c;
  display: block;
  box-sizing: border-box;
}

.modal-image {
  width: 100%;
  max-width: 100%;
  max-height: 100%;
  /* border-radius: 16px; */
  object-fit: contain;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* Controls side */
.modal-controls {
  width: 380px;
  padding: 30px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  background: #111315;
  border-left: 1px solid var(--border);
}

/* Close button */
.modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 20px;
  z-index: 101;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: rotate(90deg);
}

/* Prompt section */
.modal-prompt-section h3 {
  margin: 0 0 12px 0;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
}

.prompt-input-wrapper {
  position: relative;
}

.prompt-input-wrapper textarea {
  width: 100%;
  min-height: 120px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid #2a2d30;
  border-radius: 14px;
  color: #fff;
  font-size: 15px;
  line-height: 1.5;
  resize: vertical;
  outline: none;
  transition: all 0.2s ease;
  font-family: inherit;
}

.prompt-input-wrapper textarea:focus {
  background: rgba(255, 255, 255, 0.08);
  border-color: #444;
  box-shadow: 0 0 0 2px rgba(123, 97, 255, 0.1);
}

.prompt-input-wrapper textarea::placeholder {
  color: #6b7280;
}

/* Actions grid */
.modal-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 8px;
}

.modal-action-btn {
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid #2a2d30;
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.modal-action-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: #3a3d40;
  transform: translateY(-1px);
}

.modal-action-btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border: none;
  color: #ffffff;
  font-weight: 600;
}
.modal-btn{padding:10px 16px;border-radius:10px;border:none;cursor:pointer;font-weight:600;}
.modal-primary{background:linear-gradient(90deg,var(--accent),var(--accent2));color:#fff;} .modal-ghost{background:rgba(255,255,255,0.08);color:#fff;}

.modal-action-btn.primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

/* Preset prompts */
.preset-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 12px;
}

.preset-btn {
  padding: 8px 14px;
  background: rgb(255 255 255 / 10%);
  border: 1px solid rgba(123, 97, 255, 0.2);
  border-radius: 10px;
  color: #ffffff;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.preset-btn:hover {
  background: rgba(255, 255, 255, 0.247);
  transform: scale(0.98);
}

/* Additional options */
.modal-options {
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.option-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.option-row:last-child {
  border-bottom: none;
}

.option-label {
  color: var(--text-muted);
  font-size: 14px;
}

.option-value {
  color: #fff;
  font-size: 14px;
  font-weight: 500;
}

/* Loading state */
.modal-loading {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-loading.active {
  opacity: 1;
  pointer-events: all;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Responsive */
@media (max-width: 824px) {
  .modal-container {
    flex-direction: column;
    max-height: 95vh;
    gap: 0;
  }
  
  .modal-controls {
    width: 100%;
    max-height: 50vh;
    overflow-y: auto;
    padding: 10px;
  }
  
  .modal-image-container {
    padding: 0px;
    max-height: 45vh;
  }
}
@media (max-width: 767px) {
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
  }
}
/* Avatar Manager */
.avatar-modal{position:fixed;inset:0;background:rgba(0,0,0,0.65);display:none;align-items:center;justify-content:center;padding:20px;z-index:70;}
.avatar-modal-content{background:var(--panel);padding:20px;border-radius:var(--radius);max-width:900px;width:100%;max-height:90vh;overflow:auto;}
.avatar-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(110px,1fr));gap:12px;} .avatar-cell{border-radius:12px;overflow:hidden;border:2px solid transparent;cursor:pointer;} .avatar-cell.selected{border-color:var(--accent);} 
.avatar-cell img{width:100%;height:110px;object-fit:cover;}
.back-btn {transform: rotate(180deg); cursor: pointer;}

/* AI top bar */
.ai-bar {
  position: absolute;
  top: -34px;
  right: 0;
  width: 100%;
  display: flex;
  justify-content: end;
  gap: 10px;
  align-items: center;
  padding: 6px 20px;
}

/* Model select */
.ai-model select {
  background: #0f1113;
  border: 1px solid #2a2d30;
  color: #fff;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 13px;
  cursor: pointer;
  outline: none;
}

.ai-model select:hover {
  border-color: #3a3d40;
}

/* Attach button */
.ai-attach {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 12px;
  background: #0f1113;
  border: 1px solid #2a2d30;
  color: #c8c8cc;
  cursor: pointer;
  font-size: 13px;
  transition: .2s;
}

.ai-attach:hover {
  background: #1a1d1f;
  color: #fff;
}

/* Composer fix for bar */
.composer {
  position: fixed;
  bottom: 0;
}

.ai-input-dropdown {
  position: relative;
  width: 240px;
}

.ai-input-dropdown input {
  width: 100%;
  padding: 10px 14px;
  border-radius: 14px;
  background: #0f1113;
  border: 1px solid #2a2d30;
  color: #fff;
  cursor: pointer;
}

.ai-dropdown-menu {
  position: absolute;
  bottom: calc(100% + 6px);
  width: 100%;
  background: #0d0f11;
  border: 1px solid #2a2d30;
  border-radius: 14px;
  display: none;
  padding: 6px;
  box-shadow: 0 20px 40px rgba(0,0,0,.45);
  z-index: 50;
}

.ai-input-dropdown.open .ai-dropdown-menu {
  display: block;
}

.ai-option {
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
}

.ai-option:hover {
  background: #1a1d1f;
}

.ai-option span {
  color: #ffd24d;
}

.ai-option.disabled {
  opacity: .4;
  cursor: not-allowed;
}