/* Gizmo System Styles */

.gizmo-container {
  position: relative;
  min-height: 100vh;
  padding: 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.gizmo-container.gizmo-edit-mode {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: 2px dashed rgba(255, 255, 255, 0.3);
}

/* Gizmo Base Styles */
.gizmo {
  position: absolute;
  cursor: default;
  user-select: none;
  transition: box-shadow 0.3s ease, transform 0.2s ease;
  border: 2px solid transparent;
  box-sizing: border-box;
}

.gizmo:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 40px rgba(0,0,0,0.3) !important;
}

.gizmo.gizmo-edit-mode {
  border-color: rgba(255, 255, 255, 0.5);
  cursor: move;
}

.gizmo.gizmo-dragging {
  transform: rotate(2deg) scale(1.05);
  box-shadow: 0 20px 50px rgba(0,0,0,0.4) !important;
  z-index: 1000 !important;
}

/* Gizmo Controls */
.gizmo-controls {
  background: rgba(0, 0, 0, 0.8);
  border-radius: 6px 6px 0 0;
  margin: -2px -2px 0 -2px;
  padding: 5px 10px;
  display: none;
}

.gizmo-edit-mode .gizmo-controls {
  display: block !important;
}

.gizmo-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 30px;
}

.gizmo-title {
  color: white;
  font-size: 12px;
  font-weight: 500;
  flex: 1;
}

.gizmo-buttons {
  display: flex;
  gap: 5px;
}

.gizmo-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  padding: 4px 6px;
  border-radius: 3px;
  cursor: pointer;
  font-size: 10px;
  transition: background 0.2s ease;
}

.gizmo-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.gizmo-drag-handle {
  cursor: grab;
}

.gizmo-drag-handle:active {
  cursor: grabbing;
}

.gizmo-delete:hover {
  background: #e74c3c;
}

/* Gizmo Content */
.gizmo-content {
  padding: 15px;
  height: 100%;
  box-sizing: border-box;
}

.gizmo-content h3 {
  margin: 0 0 15px 0;
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.gizmo-content h3 i {
  opacity: 0.8;
}

/* Edit Mode Toggle */
.gizmo-edit-toggle {
  background: #2D1B4E;
  color: white;
  border: none;
  padding: 10px 15px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.3s ease;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
  z-index: 1000;
  position: relative;
}

.gizmo-edit-toggle:hover {
  background: #1a0f2e;
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.gizmo-edit-toggle i {
  margin-right: 8px;
}

/* Specific Gizmo Types */

/* Bio Gizmo */
.gizmo-bio .bio-text {
  line-height: 1.6;
  font-size: 14px;
  opacity: 0.95;
}

.gizmo-bio .bio-text[contenteditable="true"] {
  outline: none;
  border: 1px dashed rgba(255, 255, 255, 0.3);
  padding: 8px;
  border-radius: 4px;
}

/* Interests Gizmo */
.gizmo-interests .interests-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

.gizmo-interests .interest-category h4 {
  margin: 0 0 8px 0;
  font-size: 13px;
  font-weight: 600;
  opacity: 0.9;
}

.gizmo-interests .interest-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.gizmo-interests .interest-tag {
  background: rgba(255, 255, 255, 0.2);
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
}

/* Friends Gizmo */
.gizmo-friends .friends-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
  gap: 10px;
}

.gizmo-friends .friend-item {
  text-align: center;
}

.gizmo-friends .friend-avatar {
  width: 50px;
  height: 50px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 5px auto;
  font-weight: bold;
  font-size: 14px;
}

.gizmo-friends .friend-name {
  font-size: 10px;
  font-weight: 500;
  opacity: 0.9;
}

/* Music Player Gizmo */
.gizmo-music .music-player {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 15px;
}

.gizmo-music .track-info {
  margin-bottom: 15px;
}

.gizmo-music .track-title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 3px;
}

.gizmo-music .track-artist {
  font-size: 12px;
  opacity: 0.8;
}

.gizmo-music .player-controls {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
}

.gizmo-music .control-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.gizmo-music .control-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.05);
}

.gizmo-music .progress-bar {
  background: rgba(255, 255, 255, 0.2);
  height: 4px;
  border-radius: 2px;
  overflow: hidden;
}

.gizmo-music .progress {
  background: white;
  height: 100%;
  transition: width 0.3s ease;
}

/* Status Gizmo */
.gizmo-status .status-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 15px;
}

.gizmo-status .user-avatar {
  width: 50px;
  height: 50px;
  background: rgba(45, 27, 78, 0.8);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 20px;
}

.gizmo-status .user-info {
  flex: 1;
}

.gizmo-status .username {
  font-weight: 600;
  font-size: 16px;
  margin-bottom: 3px;
}

.gizmo-status .online-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  opacity: 0.8;
}

.gizmo-status .status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #28a745;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { opacity: 1; }
  50% { opacity: 0.5; }
  100% { opacity: 1; }
}

.gizmo-status .status-message {
  font-style: italic;
  line-height: 1.4;
  font-size: 14px;
}

.gizmo-status .status-message[contenteditable="true"] {
  outline: none;
  border: 1px dashed rgba(0, 0, 0, 0.3);
  padding: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
}

/* Photo Gallery Gizmo */
.gizmo-photos .photo-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 15px;
}

.gizmo-photos .photo-item {
  aspect-ratio: 1;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.gizmo-photos .photo-item:hover {
  transform: scale(1.05);
}

.gizmo-photos .photo-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gizmo-photos .photo-actions {
  text-align: center;
}

.gizmo-photos .action-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  padding: 6px 12px;
  border-radius: 15px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.gizmo-photos .action-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

/* Activity Gizmo */
.gizmo-activity .activity-list {
  max-height: 180px;
  overflow-y: auto;
}

.gizmo-activity .activity-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.gizmo-activity .activity-item:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.gizmo-activity .activity-item i {
  width: 16px;
  text-align: center;
  margin-top: 2px;
  opacity: 0.7;
}

.gizmo-activity .activity-text {
  flex: 1;
}

.gizmo-activity .activity-action {
  font-size: 13px;
  line-height: 1.3;
  margin-bottom: 2px;
}

.gizmo-activity .activity-time {
  font-size: 11px;
  opacity: 0.7;
  font-weight: 500;
}

/* Text Gizmo */
.gizmo-text .text-content {
  outline: none;
  min-height: 40px;
  line-height: 1.4;
  font-size: 14px;
}

.gizmo-text .text-content:focus {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  padding: 8px;
}

/* Responsive Design */
@media (max-width: 768px) {
  .gizmo-container {
    padding: 10px;
  }
  
  .gizmo {
    min-width: 250px !important;
  }
  
  .gizmo-interests .interests-grid {
    grid-template-columns: 1fr;
  }
  
  .gizmo-friends .friends-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .gizmo-photos .photo-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Scrollbar styling for activity gizmo */
.gizmo-activity .activity-list::-webkit-scrollbar {
  width: 4px;
}

.gizmo-activity .activity-list::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
}

.gizmo-activity .activity-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
}

.gizmo-activity .activity-list::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.5);
}

/* Animation for when gizmos are added */
@keyframes gizmoFadeIn {
  from {
    opacity: 0;
    transform: scale(0.8) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.gizmo {
  animation: gizmoFadeIn 0.5s ease-out;
}

/* Grid overlay for edit mode */
.gizmo-container.gizmo-edit-mode::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    linear-gradient(rgba(255,255,255,0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.1) 1px, transparent 1px);
  background-size: 20px 20px;
  pointer-events: none;
  z-index: 1;
}