/* ============================================
   WEBS-360 Admin Panel Styles
   ============================================ */

/* === LOGIN === */
.admin-login {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
  text-align: center;
  backdrop-filter: blur(20px);
}

.login-header h2 {
  font-size: 1.3rem;
  margin-bottom: 0.3rem;
}

.login-header p {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
}

/* === FORM ELEMENTS === */
.form-group {
  margin-bottom: 1rem;
  text-align: left;
  flex: 1;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}

.form-input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: inherit;
  transition: var(--transition);
  outline: none;
}

.form-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.form-input::placeholder {
  color: var(--text-muted);
}

textarea.form-input {
  resize: vertical;
  min-height: 80px;
}

.form-row {
  display: flex;
  gap: 1rem;
}

.form-error {
  color: #ef4444;
  font-size: 0.8rem;
  margin-top: 0.5rem;
  padding: 0.5rem;
  background: rgba(239, 68, 68, 0.1);
  border-radius: 6px;
}

.form-success {
  color: #22c55e;
  font-size: 0.85rem;
  margin-top: 1rem;
  padding: 0.6rem;
  background: rgba(34, 197, 94, 0.1);
  border-radius: 6px;
  text-align: center;
}

.form-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

/* === TOGGLE SWITCH === */
.toggle-label {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  font-size: 0.9rem;
  white-space: nowrap;
}

.toggle-label input {
  display: none;
}

.toggle-switch {
  width: 40px;
  height: 22px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 11px;
  position: relative;
  transition: var(--transition);
}

.toggle-switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: var(--transition);
}

.toggle-label input:checked + .toggle-switch {
  background: var(--accent-primary);
}

.toggle-label input:checked + .toggle-switch::after {
  left: 21px;
  background: white;
}

/* === TOPBAR === */
.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  background: rgba(6, 6, 15, 0.9);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
}

.admin-topbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.admin-topbar-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.admin-btn-sm {
  padding: 0.4rem 0.8rem;
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 0.8rem;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.admin-btn-sm:hover {
  border-color: var(--accent-primary);
  color: var(--text-primary);
}

.admin-btn-danger {
  color: #ef4444;
}

.admin-btn-danger:hover {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

/* === TABS === */
.admin-tabs {
  display: flex;
  gap: 0;
  padding: 0 1.5rem;
  border-bottom: 1px solid var(--border-color);
  background: rgba(6, 6, 15, 0.6);
}

.admin-tab {
  padding: 0.85rem 1.5rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
}

.admin-tab:hover {
  color: var(--text-secondary);
}

.admin-tab.active {
  color: var(--accent-secondary);
  border-bottom-color: var(--accent-primary);
}

/* === ADMIN CONTENT === */
.admin-content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.admin-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.admin-section-header h2 {
  font-size: 1.3rem;
}

.admin-form {
  max-width: 700px;
}

.admin-empty {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
  font-size: 0.95rem;
  background: var(--bg-card);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius);
}

/* === PROJECT LIST === */
.admin-projects-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.admin-project-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.admin-project-item:hover {
  border-color: var(--border-glow);
  background: var(--bg-card-hover);
}

.admin-project-item.inactive {
  opacity: 0.5;
}

.admin-project-thumb {
  width: 100px;
  height: 65px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg-secondary);
}

.admin-project-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.admin-project-info {
  flex: 1;
  min-width: 0;
}

.admin-project-info h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-project-info p {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-project-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  flex-shrink: 0;
}

.badge {
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
}

.badge-active {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
}

.badge-inactive {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.order-badge {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}

.admin-project-actions {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
}

/* === MODAL === */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2rem;
  overflow-y: auto;
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  width: 100%;
  max-width: 750px;
  padding: 0;
  margin: 2rem 0;
  animation: fadeInUp 0.3s ease;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
  font-size: 1.15rem;
}

.modal-close {
  width: 32px;
  height: 32px;
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.modal-close:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  border-color: #ef4444;
}

.modal-content .admin-form {
  max-width: 100%;
  padding: 1.5rem;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding-top: 1.5rem;
  margin-top: 1rem;
  border-top: 1px solid var(--border-color);
}

/* === IMAGE PREVIEWS === */
.image-preview-single img {
  max-height: 120px;
  border-radius: 8px;
  margin-top: 0.5rem;
  border: 1px solid var(--border-color);
}

.image-gallery-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 0.5rem;
  min-height: 40px;
}

.gallery-item {
  position: relative;
  aspect-ratio: 16/10;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid var(--border-color);
  cursor: grab;
  transition: var(--transition);
}

.gallery-item:active {
  cursor: grabbing;
}

.gallery-item.dragging {
  opacity: 0.4;
  border-color: var(--accent-primary);
}

.gallery-item.drag-over {
  border-color: var(--accent-cyan);
  transform: scale(1.05);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-item-actions {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  padding: 4px;
}

.gallery-order {
  background: rgba(0, 0, 0, 0.7);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}

.gallery-remove {
  background: rgba(239, 68, 68, 0.85);
  color: white;
  border: none;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  font-size: 0.7rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
}

.gallery-item:hover .gallery-remove {
  opacity: 1;
}

/* === SALE TYPE OPTIONS === */
.sale-type-option {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  padding: 0.5rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-glass);
  transition: var(--transition);
  font-size: 0.85rem;
}

.sale-type-option:hover {
  border-color: var(--accent-primary);
  background: rgba(99, 102, 241, 0.08);
}

.sale-type-option input[type="radio"] {
  accent-color: var(--accent-primary);
  margin: 0;
}

.sale-type-option:has(input:checked) {
  border-color: var(--accent-primary);
  background: rgba(99, 102, 241, 0.12);
  box-shadow: 0 0 0 1px var(--accent-primary);
}

.sale-type-label {
  color: var(--text-secondary);
  white-space: nowrap;
}

.sale-type-option:has(input:checked) .sale-type-label {
  color: var(--text-primary);
  font-weight: 500;
}

/* === RESPONSIVE ADMIN === */
@media (max-width: 768px) {
  .admin-project-item {
    flex-wrap: wrap;
  }

  .admin-project-thumb {
    width: 70px;
    height: 50px;
  }

  .admin-project-info {
    flex: 1 1 calc(100% - 90px);
  }

  .admin-project-meta {
    flex-direction: row;
    width: 100%;
    justify-content: flex-start;
  }

  .admin-project-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .form-row {
    flex-direction: column;
    gap: 0;
  }

  .modal-overlay {
    padding: 0.5rem;
  }

  .modal-content {
    margin: 0.5rem 0;
  }

  .admin-topbar {
    padding: 0.6rem 1rem;
  }

  .admin-tabs {
    padding: 0 0.5rem;
    overflow-x: auto;
  }

  .admin-tab {
    padding: 0.75rem 1rem;
    font-size: 0.8rem;
    white-space: nowrap;
  }

  .admin-content {
    padding: 1.5rem 1rem;
  }
}
