/* =============================================
   TELEGRAM CLONE - 3D ANIMATED UI STYLES
   ============================================= */

:root {
  /* Dark Theme Colors */
  --bg-primary: #0d1b2a;
  --bg-secondary: #1b263b;
  --bg-tertiary: #415a77;
  --bg-chat: #0a1929;
  --text-primary: #ffffff;
  --text-secondary: #a0aec0;
  --text-muted: #718096;
  --accent: #4ea8de;
  --accent-hover: #6dc0f2;
  --accent-gradient: linear-gradient(135deg, #4ea8de 0%, #48cae4 50%, #90e0ef 100%);
  --success: #48bb78;
  --warning: #ed8936;
  --error: #fc8181;
  --message-out: #1e4a6d;
  --message-in: #1b2838;
  --glass-bg: rgba(27, 38, 59, 0.8);
  --glass-border: rgba(78, 168, 222, 0.2);
  --shadow-3d: 0 10px 40px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 20px rgba(78, 168, 222, 0.3);
}

/* Light Theme */
[data-theme="light"] {
  --bg-primary: #f7fafc;
  --bg-secondary: #edf2f7;
  --bg-tertiary: #e2e8f0;
  --bg-chat: #ffffff;
  --text-primary: #1a202c;
  --text-secondary: #4a5568;
  --text-muted: #718096;
  --message-out: #dcf8c6;
  --message-in: #ffffff;
  --glass-bg: rgba(255, 255, 255, 0.9);
  --glass-border: rgba(78, 168, 222, 0.3);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#app {
  width: 100%;
  height: 100%;
  display: flex;
  perspective: 1500px;
}

/* =============================================
   3D EFFECTS & ANIMATIONS
   ============================================= */

@keyframes float {
  0%, 100% { transform: translateY(0) rotateX(0); }
  50% { transform: translateY(-10px) rotateX(2deg); }
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 20px rgba(78, 168, 222, 0.3); }
  50% { box-shadow: 0 0 40px rgba(78, 168, 222, 0.6); }
}

@keyframes slide-in-left {
  from { transform: translateX(-100%) rotateY(30deg); opacity: 0; }
  to { transform: translateX(0) rotateY(0); opacity: 1; }
}

@keyframes slide-in-right {
  from { transform: translateX(100%) rotateY(-30deg); opacity: 0; }
  to { transform: translateX(0) rotateY(0); opacity: 1; }
}

@keyframes slide-up {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes pop-in {
  0% { transform: scale(0.5); opacity: 0; }
  70% { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

@keyframes gradient-shift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes ripple {
  0% { transform: scale(0); opacity: 1; }
  100% { transform: scale(4); opacity: 0; }
}

@keyframes message-appear {
  0% { transform: translateY(20px) scale(0.9); opacity: 0; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

@keyframes typing-dots {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-8px); }
}

@keyframes story-progress {
  from { width: 0%; }
  to { width: 100%; }
}

.animate-float { animation: float 3s ease-in-out infinite; }
.animate-pulse-glow { animation: pulse-glow 2s ease-in-out infinite; }
.animate-slide-left { animation: slide-in-left 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94); }
.animate-slide-right { animation: slide-in-right 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94); }
.animate-slide-up { animation: slide-up 0.3s ease-out; }
.animate-pop { animation: pop-in 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
.animate-shake { animation: shake 0.3s ease-in-out; }
.animate-message { animation: message-appear 0.3s ease-out; }

/* =============================================
   GLASSMORPHISM COMPONENTS
   ============================================= */

.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-3d);
}

.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  box-shadow: var(--shadow-3d);
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.glass-card:hover {
  transform: translateY(-5px) rotateX(2deg);
  box-shadow: var(--shadow-glow), var(--shadow-3d);
}

/* =============================================
   LAYOUT COMPONENTS
   ============================================= */

.app-container {
  display: flex;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 350px;
  min-width: 350px;
  height: 100%;
  background: var(--bg-secondary);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--glass-border);
  transform-style: preserve-3d;
}

.sidebar-header {
  padding: 15px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(180deg, var(--bg-tertiary) 0%, transparent 100%);
  border-bottom: 1px solid var(--glass-border);
}

.sidebar-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.search-box {
  margin: 15px;
  position: relative;
}

.search-box input {
  width: 100%;
  padding: 12px 15px 12px 45px;
  border: none;
  border-radius: 12px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: all 0.3s ease;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.search-box input:focus {
  outline: none;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2), var(--shadow-glow);
}

.search-box i {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

/* Stories Bar */
.stories-bar {
  padding: 15px;
  display: flex;
  gap: 15px;
  overflow-x: auto;
  border-bottom: 1px solid var(--glass-border);
  scrollbar-width: none;
}

.stories-bar::-webkit-scrollbar {
  display: none;
}

.story-avatar {
  flex-shrink: 0;
  width: 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: transform 0.3s ease;
}

.story-avatar:hover {
  transform: scale(1.1);
}

.story-avatar .avatar-ring {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  padding: 3px;
  background: var(--accent-gradient);
  animation: gradient-shift 3s ease infinite;
  background-size: 200% 200%;
}

.story-avatar .avatar-ring.no-story {
  background: var(--bg-tertiary);
  animation: none;
}

.story-avatar .avatar-ring.viewed {
  background: var(--text-muted);
  animation: none;
}

.story-avatar .avatar-ring img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--bg-secondary);
}

.story-avatar .add-story {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--accent);
  transition: all 0.3s ease;
}

.story-avatar .add-story:hover {
  background: var(--accent);
  color: white;
}

.story-avatar span {
  font-size: 0.7rem;
  color: var(--text-secondary);
  max-width: 60px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Chat List */
.chat-list {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--bg-tertiary) transparent;
}

.chat-list::-webkit-scrollbar {
  width: 6px;
}

.chat-list::-webkit-scrollbar-track {
  background: transparent;
}

.chat-list::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: 3px;
}

.chat-item {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  border-left: 3px solid transparent;
  position: relative;
  overflow: hidden;
}

.chat-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(78, 168, 222, 0.1), transparent);
  transform: translateX(-100%);
  transition: transform 0.6s ease;
}

.chat-item:hover::before {
  transform: translateX(100%);
}

.chat-item:hover {
  background: rgba(78, 168, 222, 0.1);
}

.chat-item.active {
  background: rgba(78, 168, 222, 0.15);
  border-left-color: var(--accent);
}

.chat-item .avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  margin-right: 15px;
  object-fit: cover;
  border: 2px solid var(--glass-border);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.chat-item .avatar-placeholder {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  margin-right: 15px;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 600;
  color: white;
  box-shadow: 0 4px 15px rgba(78, 168, 222, 0.3);
}

.chat-item .chat-info {
  flex: 1;
  min-width: 0;
}

.chat-item .chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.chat-item .chat-name {
  font-weight: 600;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 5px;
}

.chat-item .chat-name .verified {
  color: var(--accent);
  font-size: 0.85rem;
}

.chat-item .chat-time {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.chat-item .chat-preview {
  font-size: 0.85rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-item .unread-badge {
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  background: var(--accent);
  color: white;
  font-size: 0.7rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  box-shadow: 0 2px 10px rgba(78, 168, 222, 0.4);
}

/* Main Chat Area */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-chat);
  position: relative;
  overflow: hidden;
}

.chat-header-bar {
  padding: 15px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border);
  z-index: 10;
}

.chat-header-bar .user-info {
  display: flex;
  align-items: center;
  gap: 15px;
}

.chat-header-bar .avatar {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  object-fit: cover;
  cursor: pointer;
  transition: transform 0.3s ease;
}

.chat-header-bar .avatar:hover {
  transform: scale(1.1);
}

.chat-header-bar .user-details h3 {
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
}

.chat-header-bar .user-details .status {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.chat-header-bar .user-details .status.online {
  color: var(--success);
}

.chat-header-bar .actions {
  display: flex;
  gap: 10px;
}

.chat-header-bar .actions button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-header-bar .actions button:hover {
  background: var(--accent);
  transform: scale(1.1);
  box-shadow: var(--shadow-glow);
}

/* Chat Background */
.chat-background {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-size: cover;
  background-position: center;
  opacity: 0.1;
  pointer-events: none;
}

/* Messages Area */
.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
  scrollbar-color: var(--bg-tertiary) transparent;
}

.messages-container::-webkit-scrollbar {
  width: 6px;
}

.messages-container::-webkit-scrollbar-track {
  background: transparent;
}

.messages-container::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: 3px;
}

.message {
  max-width: 65%;
  padding: 12px 16px;
  border-radius: 18px;
  position: relative;
  animation: message-appear 0.3s ease-out;
  word-wrap: break-word;
}

.message.outgoing {
  align-self: flex-end;
  background: var(--message-out);
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.message.incoming {
  align-self: flex-start;
  background: var(--message-in);
  border-bottom-left-radius: 4px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.message .content {
  font-size: 0.95rem;
  line-height: 1.4;
}

.message .meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  margin-top: 5px;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.message .meta .read-status {
  color: var(--accent);
}

/* Voice Message */
.voice-message {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 200px;
}

.voice-message .play-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.voice-message .play-btn:hover {
  transform: scale(1.1);
  box-shadow: var(--shadow-glow);
}

.voice-message .waveform {
  flex: 1;
  height: 30px;
  display: flex;
  align-items: center;
  gap: 2px;
}

.voice-message .waveform .bar {
  width: 3px;
  background: var(--accent);
  border-radius: 2px;
  transition: height 0.1s ease;
}

.voice-message .duration {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Video Note (Circle Video) */
.video-note {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  overflow: hidden;
  position: relative;
  cursor: pointer;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
  border: 3px solid var(--accent);
}

.video-note video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-note .play-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.video-note:hover .play-overlay {
  opacity: 1;
}

.video-note .play-overlay i {
  font-size: 3rem;
  color: white;
}

/* Sticker */
.message.sticker {
  background: transparent !important;
  box-shadow: none !important;
  padding: 0;
}

.message.sticker img {
  width: 150px;
  height: 150px;
  object-fit: contain;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.3));
}

/* Input Area */
.input-area {
  padding: 15px 20px;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--glass-border);
  display: flex;
  align-items: flex-end;
  gap: 15px;
}

.input-area .attach-btn,
.input-area .emoji-btn,
.input-area .sticker-btn {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  border: none;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.input-area .attach-btn:hover,
.input-area .emoji-btn:hover,
.input-area .sticker-btn:hover {
  background: var(--accent);
  transform: scale(1.1);
}

.input-area .input-wrapper {
  flex: 1;
  position: relative;
}

.input-area textarea {
  width: 100%;
  padding: 12px 20px;
  border: none;
  border-radius: 25px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.95rem;
  resize: none;
  max-height: 150px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: box-shadow 0.3s ease;
}

.input-area textarea:focus {
  outline: none;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2), var(--shadow-glow);
}

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

.input-area .send-btn,
.input-area .voice-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: none;
  background: var(--accent-gradient);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(78, 168, 222, 0.4);
}

.input-area .send-btn:hover,
.input-area .voice-btn:hover {
  transform: scale(1.1) rotate(10deg);
  box-shadow: var(--shadow-glow);
}

.input-area .voice-btn.recording {
  background: var(--error);
  animation: pulse-glow 1s infinite;
}

/* =============================================
   MODAL & POPUPS
   ============================================= */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  background: var(--bg-secondary);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
  animation: pop-in 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--glass-border);
  background: linear-gradient(180deg, var(--bg-tertiary) 0%, transparent 100%);
}

.modal-header h2 {
  font-size: 1.2rem;
  font-weight: 600;
}

.modal-header .close-btn {
  width: 35px;
  height: 35px;
  border-radius: 50%;
  border: none;
  background: var(--bg-primary);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.3s ease;
}

.modal-header .close-btn:hover {
  background: var(--error);
  transform: rotate(90deg);
}

.modal-content {
  padding: 20px;
  overflow-y: auto;
}

.modal-footer {
  padding: 15px 20px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--glass-border);
}

/* =============================================
   BUTTONS
   ============================================= */

.btn {
  padding: 12px 25px;
  border-radius: 12px;
  border: none;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary {
  background: var(--accent-gradient);
  color: white;
  box-shadow: 0 4px 15px rgba(78, 168, 222, 0.4);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(78, 168, 222, 0.5);
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: var(--accent);
  color: white;
}

.btn-danger {
  background: var(--error);
  color: white;
}

.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(252, 129, 129, 0.5);
}

/* =============================================
   AUTH SCREENS
   ============================================= */

.auth-container {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
  perspective: 1000px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  padding: 40px;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border-radius: 24px;
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-3d);
  animation: float 6s ease-in-out infinite;
}

.auth-card .logo {
  text-align: center;
  margin-bottom: 30px;
}

.auth-card .logo i {
  font-size: 4rem;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: pulse-glow 3s infinite;
}

.auth-card .logo h1 {
  font-size: 2rem;
  margin-top: 10px;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.auth-card .form-group {
  margin-bottom: 20px;
}

.auth-card label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--text-secondary);
}

.auth-card input {
  width: 100%;
  padding: 14px 18px;
  border: 2px solid var(--glass-border);
  border-radius: 12px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 1rem;
  transition: all 0.3s ease;
}

.auth-card input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--shadow-glow);
}

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

.auth-card .error-message {
  background: rgba(252, 129, 129, 0.2);
  color: var(--error);
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 15px;
  font-size: 0.9rem;
  animation: shake 0.3s ease;
}

.auth-card .auth-footer {
  text-align: center;
  margin-top: 20px;
  color: var(--text-secondary);
}

.auth-card .auth-footer a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.auth-card .auth-footer a:hover {
  text-decoration: underline;
}

/* =============================================
   PROFILE PANEL
   ============================================= */

.profile-panel {
  width: 100%;
  max-width: 400px;
  height: 100%;
  background: var(--bg-secondary);
  border-left: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  animation: slide-in-right 0.3s ease;
}

.profile-header {
  position: relative;
  height: 200px;
  overflow: hidden;
}

.profile-header .banner {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-header .banner-placeholder {
  width: 100%;
  height: 100%;
  background: var(--accent-gradient);
}

.profile-header .close-btn {
  position: absolute;
  top: 15px;
  right: 15px;
  width: 35px;
  height: 35px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.5);
  color: white;
  cursor: pointer;
  transition: all 0.3s ease;
}

.profile-header .close-btn:hover {
  background: var(--error);
  transform: rotate(90deg);
}

.profile-avatar-section {
  padding: 0 20px;
  margin-top: -50px;
  position: relative;
  z-index: 1;
}

.profile-avatar-section .avatar-wrapper {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  border: 4px solid var(--bg-secondary);
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

.profile-avatar-section .avatar-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-avatar-section .avatar-placeholder {
  width: 100%;
  height: 100%;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  font-weight: 600;
  color: white;
}

.profile-info {
  padding: 15px 20px;
}

.profile-info .name {
  font-size: 1.4rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.profile-info .name .verified {
  color: var(--accent);
}

.profile-info .username {
  color: var(--text-muted);
  margin-top: 2px;
}

.profile-info .bio {
  margin-top: 10px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.profile-info .status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  margin-top: 10px;
}

.profile-info .status-badge.online {
  background: rgba(72, 187, 120, 0.2);
  color: var(--success);
}

.profile-info .status-badge.offline {
  background: rgba(160, 174, 192, 0.2);
  color: var(--text-muted);
}

/* NFT Gifts Display */
.profile-gifts {
  padding: 15px 20px;
  border-top: 1px solid var(--glass-border);
}

.profile-gifts h3 {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 15px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.gifts-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.gift-item {
  aspect-ratio: 1;
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-tertiary);
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
}

.gift-item:hover {
  transform: scale(1.1);
  z-index: 1;
  box-shadow: var(--shadow-glow);
}

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

.gift-item .rarity-badge {
  position: absolute;
  bottom: 3px;
  right: 3px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.gift-item .rarity-badge.common { background: #9ca3af; }
.gift-item .rarity-badge.rare { background: #3b82f6; }
.gift-item .rarity-badge.epic { background: #8b5cf6; }
.gift-item .rarity-badge.legendary { background: #f59e0b; }

/* =============================================
   ADMIN PANEL
   ============================================= */

.admin-layout {
  display: flex;
  width: 100%;
  height: 100%;
}

.admin-sidebar {
  width: 250px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
}

.admin-sidebar .logo {
  padding: 20px;
  border-bottom: 1px solid var(--glass-border);
}

.admin-sidebar .logo h2 {
  font-size: 1.3rem;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.admin-sidebar nav {
  flex: 1;
  padding: 15px;
}

.admin-sidebar nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 15px;
  border-radius: 10px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.3s ease;
  margin-bottom: 5px;
}

.admin-sidebar nav a:hover {
  background: rgba(78, 168, 222, 0.1);
  color: var(--text-primary);
}

.admin-sidebar nav a.active {
  background: var(--accent);
  color: white;
}

.admin-sidebar nav a i {
  width: 20px;
}

.admin-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.admin-header {
  padding: 20px 30px;
  background: var(--glass-bg);
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.admin-header h1 {
  font-size: 1.5rem;
  font-weight: 600;
}

.admin-content {
  flex: 1;
  padding: 30px;
  overflow-y: auto;
}

/* Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  border-radius: 16px;
  padding: 20px;
  border: 1px solid var(--glass-border);
  transition: all 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-glow);
}

.stat-card .icon {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 15px;
}

.stat-card .icon.blue { background: rgba(78, 168, 222, 0.2); color: var(--accent); }
.stat-card .icon.green { background: rgba(72, 187, 120, 0.2); color: var(--success); }
.stat-card .icon.yellow { background: rgba(237, 137, 54, 0.2); color: var(--warning); }
.stat-card .icon.red { background: rgba(252, 129, 129, 0.2); color: var(--error); }

.stat-card .value {
  font-size: 2rem;
  font-weight: 700;
}

.stat-card .label {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 5px;
}

/* Data Tables */
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-secondary);
  border-radius: 12px;
  overflow: hidden;
}

.data-table th,
.data-table td {
  padding: 15px 20px;
  text-align: left;
}

.data-table th {
  background: var(--bg-tertiary);
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 1px;
}

.data-table tr {
  border-bottom: 1px solid var(--glass-border);
  transition: background 0.3s ease;
}

.data-table tr:hover {
  background: rgba(78, 168, 222, 0.05);
}

.data-table .user-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.data-table .user-cell img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.data-table .status-badge {
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.data-table .status-badge.active { background: rgba(72, 187, 120, 0.2); color: var(--success); }
.data-table .status-badge.blocked { background: rgba(252, 129, 129, 0.2); color: var(--error); }
.data-table .status-badge.pending { background: rgba(237, 137, 54, 0.2); color: var(--warning); }

.data-table .actions {
  display: flex;
  gap: 8px;
}

.data-table .actions button {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.3s ease;
}

.data-table .actions button:hover {
  background: var(--accent);
}

.data-table .actions button.danger:hover {
  background: var(--error);
}

/* =============================================
   STICKER PICKER
   ============================================= */

.sticker-picker {
  position: absolute;
  bottom: 100%;
  left: 0;
  width: 350px;
  max-height: 400px;
  background: var(--bg-secondary);
  border-radius: 16px;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  animation: slide-up 0.3s ease;
  margin-bottom: 10px;
}

.sticker-picker .tabs {
  display: flex;
  border-bottom: 1px solid var(--glass-border);
}

.sticker-picker .tabs button {
  flex: 1;
  padding: 12px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.3s ease;
}

.sticker-picker .tabs button:hover {
  color: var(--text-primary);
}

.sticker-picker .tabs button.active {
  color: var(--accent);
  border-bottom: 2px solid var(--accent);
}

.sticker-picker .content {
  padding: 15px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  max-height: 300px;
  overflow-y: auto;
}

.sticker-picker .sticker {
  aspect-ratio: 1;
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.sticker-picker .sticker:hover {
  background: var(--bg-tertiary);
  transform: scale(1.1);
}

.sticker-picker .sticker img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* =============================================
   STORY VIEWER
   ============================================= */

.story-viewer {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #000;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.story-viewer .progress-bar {
  position: absolute;
  top: 10px;
  left: 15px;
  right: 15px;
  display: flex;
  gap: 5px;
}

.story-viewer .progress-bar .segment {
  flex: 1;
  height: 3px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
  overflow: hidden;
}

.story-viewer .progress-bar .segment .fill {
  height: 100%;
  background: white;
  width: 0;
}

.story-viewer .progress-bar .segment .fill.active {
  animation: story-progress 5s linear forwards;
}

.story-viewer .progress-bar .segment .fill.complete {
  width: 100%;
}

.story-viewer .user-info {
  position: absolute;
  top: 25px;
  left: 15px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.story-viewer .user-info img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid white;
}

.story-viewer .user-info .name {
  color: white;
  font-weight: 600;
}

.story-viewer .user-info .time {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.8rem;
}

.story-viewer .close-btn {
  position: absolute;
  top: 25px;
  right: 15px;
  width: 35px;
  height: 35px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  cursor: pointer;
}

.story-viewer .story-content {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.story-viewer .nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  cursor: pointer;
  font-size: 1.2rem;
}

.story-viewer .nav-btn.prev { left: 15px; }
.story-viewer .nav-btn.next { right: 15px; }

/* =============================================
   GIFTS SHOP
   ============================================= */

.gifts-shop {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 20px;
  padding: 20px;
}

.gift-card {
  background: var(--glass-bg);
  border-radius: 16px;
  padding: 20px;
  text-align: center;
  border: 1px solid var(--glass-border);
  transition: all 0.3s ease;
  cursor: pointer;
}

.gift-card:hover {
  transform: translateY(-5px) scale(1.02);
  box-shadow: var(--shadow-glow);
}

.gift-card .gift-image {
  width: 80px;
  height: 80px;
  margin: 0 auto 15px;
  position: relative;
}

.gift-card .gift-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.3));
}

.gift-card .gift-name {
  font-weight: 600;
  margin-bottom: 5px;
}

.gift-card .gift-rarity {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 10px;
}

.gift-card .gift-rarity.common { color: #9ca3af; }
.gift-card .gift-rarity.rare { color: #3b82f6; }
.gift-card .gift-rarity.epic { color: #8b5cf6; }
.gift-card .gift-rarity.legendary { color: #f59e0b; }

.gift-card .gift-price {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-weight: 600;
  color: var(--accent);
}

.gift-card .gift-price i {
  color: #fbbf24;
}

/* =============================================
   STARS BALANCE
   ============================================= */

.stars-display {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.2), rgba(245, 158, 11, 0.2));
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.stars-display:hover {
  transform: scale(1.05);
  box-shadow: 0 0 20px rgba(251, 191, 36, 0.3);
}

.stars-display i {
  color: #fbbf24;
  font-size: 1.2rem;
}

.stars-display span {
  font-weight: 600;
  color: #fbbf24;
}

/* =============================================
   LOADING STATES
   ============================================= */

.loading-spinner {
  display: inline-block;
  width: 30px;
  height: 30px;
  border: 3px solid var(--bg-tertiary);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.skeleton {
  background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-secondary) 50%, var(--bg-tertiary) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: 8px;
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* =============================================
   EMPTY STATES
   ============================================= */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}

.empty-state i {
  font-size: 5rem;
  color: var(--bg-tertiary);
  margin-bottom: 20px;
}

.empty-state h3 {
  font-size: 1.3rem;
  margin-bottom: 10px;
}

.empty-state p {
  color: var(--text-muted);
  max-width: 300px;
}

/* =============================================
   RESPONSIVE
   ============================================= */

@media (max-width: 1024px) {
  .sidebar {
    width: 300px;
    min-width: 300px;
  }
  
  .profile-panel {
    position: fixed;
    right: 0;
    top: 0;
    z-index: 100;
  }
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: -100%;
    top: 0;
    z-index: 100;
    transition: left 0.3s ease;
  }
  
  .sidebar.open {
    left: 0;
  }
  
  .message {
    max-width: 85%;
  }
  
  .admin-sidebar {
    position: fixed;
    left: -100%;
    z-index: 100;
    transition: left 0.3s ease;
  }
  
  .admin-sidebar.open {
    left: 0;
  }
}

/* =============================================
   TYPING INDICATOR
   ============================================= */

.typing-indicator {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 12px 16px;
  background: var(--message-in);
  border-radius: 18px;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
}

.typing-indicator .dot {
  width: 8px;
  height: 8px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: typing-dots 1.4s infinite ease-in-out;
}

.typing-indicator .dot:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-indicator .dot:nth-child(3) {
  animation-delay: 0.4s;
}

/* =============================================
   RECORD OVERLAY
   ============================================= */

.record-overlay {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 30px;
  background: linear-gradient(180deg, transparent, var(--bg-primary));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  animation: slide-up 0.3s ease;
}

.record-overlay .timer {
  font-size: 2rem;
  font-weight: 600;
  color: var(--error);
}

.record-overlay .waveform-visual {
  height: 60px;
  display: flex;
  align-items: center;
  gap: 3px;
}

.record-overlay .waveform-visual .bar {
  width: 4px;
  background: var(--accent);
  border-radius: 2px;
  animation: waveform 0.5s infinite alternate;
}

@keyframes waveform {
  from { height: 10px; }
  to { height: 50px; }
}

.record-overlay .controls {
  display: flex;
  gap: 20px;
}

.record-overlay .controls button {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
}

.record-overlay .controls .cancel-btn {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.record-overlay .controls .send-btn {
  background: var(--accent-gradient);
  color: white;
}

/* =============================================
   VIDEO RECORD OVERLAY
   ============================================= */

.video-record-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #000;
  z-index: 2000;
  display: flex;
  flex-direction: column;
}

.video-record-overlay video {
  flex: 1;
  object-fit: cover;
}

.video-record-overlay .preview-circle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 250px;
  height: 250px;
  border-radius: 50%;
  overflow: hidden;
  border: 4px solid var(--accent);
  box-shadow: var(--shadow-glow);
}

.video-record-overlay .preview-circle video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-record-overlay .timer {
  position: absolute;
  top: 30px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 20px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 20px;
  color: white;
  font-weight: 600;
}

.video-record-overlay .controls {
  position: absolute;
  bottom: 50px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 30px;
}

.video-record-overlay .record-btn {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 4px solid white;
  background: transparent;
  cursor: pointer;
  position: relative;
}

.video-record-overlay .record-btn::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--error);
  transition: all 0.3s ease;
}

.video-record-overlay .record-btn.recording::after {
  width: 30px;
  height: 30px;
  border-radius: 6px;
}

/* =============================================
   NOTIFICATIONS
   ============================================= */

.notification-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 15px 25px;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border-radius: 12px;
  box-shadow: var(--shadow-3d);
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slide-in-right 0.3s ease;
  z-index: 3000;
}

.notification-toast.success { border-left: 4px solid var(--success); }
.notification-toast.error { border-left: 4px solid var(--error); }
.notification-toast.warning { border-left: 4px solid var(--warning); }

.notification-toast i {
  font-size: 1.3rem;
}

.notification-toast.success i { color: var(--success); }
.notification-toast.error i { color: var(--error); }
.notification-toast.warning i { color: var(--warning); }
