:root {
  --bg-color: #0f172a;
  --text-color: #f8fafc;
  --primary-color: #6366f1;
  --primary-hover: #4f46e5;
  --card-bg: rgba(30, 41, 59, 0.7);
  --border-color: rgba(255, 255, 255, 0.1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
  background-color: var(--bg-color);
  background-image: linear-gradient(rgba(15, 23, 42, 0.7), rgba(15, 23, 42, 0.8)), url('/images/umixcraft_bg.png');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  color: var(--text-color);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
header {
  padding: 1.5rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(10px);
}

.logo {
  font-size: 1.8rem;
  font-weight: 800;
  color: #fff;
  text-decoration: none;
  background: linear-gradient(to right, #38bdf8, #818cf8, #c084fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-link {
  color: #cbd5e1;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s;
}

.nav-link:hover {
  color: #fff;
}

.btn-sm {
  padding: 0.4rem 1rem;
  font-size: 0.9rem;
}

/* Profile Dropdown */
.profile-dropdown {
  position: relative;
  display: inline-block;
}

.profile-avatar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  padding: 0.4rem 0.8rem;
  border-radius: 2rem;
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
}

.profile-avatar:hover {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: var(--primary-color);
}

.avatar-circle {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: white;
  font-size: 0.9rem;
}

.profile-email {
  color: #f8fafc;
  font-weight: 500;
  font-size: 0.95rem;
}

.dropdown-arrow {
  font-size: 0.6rem;
  color: #94a3b8;
  margin-left: 0.2rem;
}

.dropdown-content {
  position: absolute;
  right: 0;
  top: calc(100% + 0.5rem);
  background-color: rgba(15, 23, 42, 0.95);
  min-width: 200px;
  border-radius: 0.75rem;
  border: 1px solid var(--border-color);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 100;
  overflow: hidden;
}

.profile-dropdown:hover .dropdown-content {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-content a {
  color: #cbd5e1;
  padding: 0.75rem 1rem;
  text-decoration: none;
  display: block;
  font-size: 0.95rem;
  transition: background 0.2s, color 0.2s;
}

.dropdown-content a:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: #fff;
}

nav a {
  color: #cbd5e1;
  text-decoration: none;
  margin-left: 1.5rem;
  font-weight: 500;
  transition: color 0.3s;
}

nav a:hover {
  color: #fff;
}

.btn {
  background-color: var(--primary-color);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 600;
  display: inline-block;
  text-align: center;
}

.btn:hover {
  background-color: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
  background-color: transparent;
  border: 1px solid var(--primary-color);
}

.btn-secondary:hover {
  background-color: rgba(99, 102, 241, 0.1);
}

/* Main content */
main {
  flex: 1;
  padding: 2rem;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
}

.card {
  background-color: var(--card-bg);
  padding: 2rem;
  border-radius: 1rem;
  border: 1px solid var(--border-color);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(12px);
  max-width: 400px;
  width: 100%;
}

.card h1, .card h2 {
  margin-bottom: 1.5rem;
  text-align: center;
}

/* Forms */
.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: #cbd5e1;
  font-size: 0.9rem;
}

.form-group input {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border-color);
  background-color: rgba(15, 23, 42, 0.6);
  color: white;
  outline: none;
  transition: border-color 0.3s;
}

.form-group input:focus {
  border-color: var(--primary-color);
}

.card .btn {
  width: 100%;
}

/* Utilities */
.text-center { text-align: center; }
.mt-4 { margin-top: 1rem; }
.text-muted { color: #94a3b8; font-size: 0.9rem; }
.text-muted a { color: var(--primary-color); text-decoration: none; }

/* Admin Table */
.table-container {
  overflow-x: auto;
  width: 100%;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1.5rem;
}

th, td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

th {
  color: #cbd5e1;
  font-weight: 600;
  background-color: rgba(0, 0, 0, 0.2);
}

tr:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

.badge {
  padding: 0.25rem 0.5rem;
  border-radius: 1rem;
  font-size: 0.8rem;
  font-weight: bold;
}

.badge.admin {
  background-color: rgba(192, 132, 252, 0.2);
  color: #c084fc;
}

.badge.user {
  background-color: rgba(99, 102, 241, 0.2);
  color: #818cf8;
}

/* App Cards */
.apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 2rem;
  width: 100%;
  max-width: 1000px;
}

.app-card {
  background: rgba(15, 23, 42, 0.75);
  border-radius: 1rem;
  border: 2px solid rgba(56, 189, 248, 0.4);
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.15);
  padding: 1.5rem;
  transition: all 0.3s ease;
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
}

.app-card:hover {
  transform: translateY(-5px);
  border-color: #c084fc;
  box-shadow: 0 10px 30px rgba(192, 132, 252, 0.3);
}

.app-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.app-icon {
  width: 65px;
  height: 65px;
  border-radius: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  object-fit: cover;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.app-info h3 {
  color: #fff;
  font-size: 1.3rem;
  margin-bottom: 0.3rem;
}

.app-platform {
  font-size: 0.8rem;
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.1);
  padding: 0.2rem 0.6rem;
  border-radius: 1rem;
}

.app-desc {
  color: #94a3b8;
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 1.5rem;
  flex: 1;
}

.app-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Admin Layout */
.admin-layout {
  display: flex;
  width: 100%;
  max-width: 1200px;
  margin: 2rem auto;
  gap: 2rem;
  padding: 0 1rem;
}

.sidebar {
  width: 250px;
  background: rgba(30, 41, 59, 0.6);
  border-radius: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 1.5rem;
  backdrop-filter: blur(10px);
  height: fit-content;
}

.sidebar-title {
  color: #c084fc;
  font-size: 1.2rem;
  margin-bottom: 1.5rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sidebar-link {
  background: transparent;
  border: none;
  color: #cbd5e1;
  padding: 0.8rem 1rem;
  text-align: left;
  border-radius: 0.5rem;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sidebar-link:hover, .sidebar-link.active {
  background: rgba(192, 132, 252, 0.2);
  color: #fff;
  border-left: 4px solid #c084fc;
}

.admin-content {
  flex-grow: 1;
  min-width: 0;
}

.tab-section {
  display: none;
  animation: fadeIn 0.3s ease-in-out;
}

.tab-section.active {
  display: block;
}

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

@media (max-width: 768px) {
  header {
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
  }
  .logo {
    font-size: 1.5rem;
  }
  .header-right {
    flex-wrap: wrap;
    justify-content: center;
  }
  nav a {
    margin-left: 0.5rem;
    margin-right: 0.5rem;
    font-size: 0.9rem;
  }
  main {
    padding: 1rem;
  }
  h1 {
    font-size: 2.5rem !important;
  }
  .apps-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  .admin-layout {
    flex-direction: column;
    margin: 1rem auto;
    gap: 1rem;
  }
  .sidebar {
    width: 100%;
  }
  .card {
    padding: 1.2rem;
  }
  .profile-dropdown {
    margin-top: 0.5rem;
  }
}

@media (max-width: 480px) {
  .app-actions {
    flex-direction: column;
    gap: 0.5rem;
  }
  .app-actions span, .app-actions a {
    width: 100%;
    text-align: center;
  }
  h1 {
    font-size: 2rem !important;
  }
  h2 {
    font-size: 1.5rem !important;
  }
}
.premium-profile-card {
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.95), rgba(30, 41, 59, 0.95));
  border: 1px solid rgba(99, 102, 241, 0.3);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  padding: 2.5rem;
  border-radius: 1.5rem;
  max-width: 460px;
  width: 100%;
  position: relative;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.4s ease;
  margin: 0 auto;
}
.premium-profile-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 50px rgba(99, 102, 241, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  border-color: rgba(99, 102, 241, 0.6);
}
.premium-avatar {
  width: 130px;
  height: 130px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid #6366f1;
  box-shadow: 0 0 25px rgba(99, 102, 241, 0.4);
  display: block;
  transition: all 0.4s ease;
  image-rendering: -webkit-optimize-contrast;
  margin: 0 auto 1.5rem auto;
}

.premium-role-badge {
  background: linear-gradient(90deg, #6366f1, #c084fc);
  padding: 0.3rem 1.2rem;
  border-radius: 2rem;
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
  display: inline-block;
  margin-bottom: 0.5rem;
}
.admin-actions {
  position: absolute;
  top: 1.2rem;
  right: 1.2rem;
  display: flex;
  gap: 0.5rem;
}
.action-btn-sm {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
  padding: 0.4rem 0.7rem;
  border-radius: 0.6rem;
  font-size: 0.75rem;
  text-decoration: none;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  font-weight: 600;
}
.action-btn-sm:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  transform: translateY(-2px);
}
.action-btn-sm.logout:hover {
  background: rgba(244, 63, 94, 0.15);
  color: #f43f5e;
  border-color: rgba(244, 63, 94, 0.3);
}
.avatar-wrapper {
  position: relative;
  display: inline-block;
  cursor: pointer;
  margin: 0 auto 1.5rem auto;
  border-radius: 50%;
}
.avatar-wrapper .premium-avatar {
  margin: 0;
}
.avatar-edit-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(2px);
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  transition: all 0.3s ease;
  border: 3px solid transparent;
}
.avatar-wrapper:hover .avatar-edit-overlay {
  opacity: 1;
  border-color: #818cf8;
}
.avatar-wrapper:hover .premium-avatar {
  transform: scale(1.05) rotate(5deg);
  box-shadow: 0 0 40px rgba(99, 102, 241, 0.7);
  border-color: #818cf8;
}
.avatar-wrapper:active .avatar-edit-overlay {
  transform: scale(0.95);
}
