/* CSS Variables for Theme */
:root {
  --primary-start: #00c6ff;
  --primary-end: #0072ff;
  --secondary-start: #00ff9d;
  --secondary-end: #00c9a7;
  --bg-light: #f8fafc;
  --bg-dark: #0f172a;
  --card-white: #ffffff;
  --text-dark: #1e293b;
  --text-light: #f1f5f9;
  --shadow-sm: 0 10px 25px -5px rgba(0,0,0,0.05), 0 8px 10px -6px rgba(0,0,0,0.02);
  --shadow-md: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.02);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --transition: all 0.3s ease;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg-light);
  color: var(--text-dark);
  transition: var(--transition);
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

body.dark {
  background: var(--bg-dark);
  color: var(--text-light);
}

/* Dark mode body override */
body.dark .post-preview { background: #2d3748 !important; color: #e2e8f0; }

/* Container with Sidebar Support */
.app-container {
  display: flex;
  min-height: 100vh;
  position: relative;
  /* No transform here to preserve fixed positioning */
}

.main-content {
  flex: 1;
  margin-left: 280px;
  padding: 24px 32px;
  transition: var(--transition);
}

/* Sidebar Styles */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 280px;
  height: 100vh;
  background: var(--card-white);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-md);
  padding: 24px 20px;
  transition: var(--transition);
  z-index: 1000;
  overflow-y: auto;
}

body.dark .sidebar {
  background: #1e293b;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
  padding-bottom: 16px;
  border-bottom: 1px solid #e2e8f0;
}

body.dark .sidebar-header {
  border-bottom-color: #334155;
}

.sidebar-header h2 {
  background: linear-gradient(135deg, var(--primary-start), var(--primary-end));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-size: 1.5rem;
}

.close-sidebar {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
}

.nav-links {
  list-style: none;
  padding: 0;
}

.nav-links li {
  margin-bottom: 12px;
}

.nav-links a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  color: var(--text-dark);
  text-decoration: none;
  transition: var(--transition);
  font-weight: 500;
}

body.dark .nav-links a {
  color: var(--text-light);
}

.nav-links a:hover,
.nav-links li.active a {
  background: linear-gradient(135deg, var(--primary-start), var(--primary-end));
  color: white;
  transform: translateX(4px);
  box-shadow: var(--shadow-sm);
}

/* Mobile Menu Toggle - Updated */
.menu-toggle {
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 1100;
  background: linear-gradient(135deg, var(--primary-start), var(--primary-end));
  border: none;
  color: white;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.menu-toggle:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-md);
}

/* Cards */
.card {
  background: var(--card-white);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  margin-bottom: 24px;
}

body.dark .card {
  background: #1e293b;
  color: var(--text-light);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

/* Dashboard Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
  margin-bottom: 32px;
}

.stat-card {
  background: linear-gradient(135deg, var(--primary-start), var(--primary-end));
  border-radius: var(--radius-md);
  padding: 20px;
  color: white;
  transition: var(--transition);
}

.stat-card h3 {
  font-size: 2rem;
  margin: 12px 0;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 40px;
  font-weight: 600;
  text-decoration: none;
  transition: var(--transition);
  border: none;
  cursor: pointer;
  background: #e2e8f0;
  color: var(--text-dark);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-start), var(--primary-end));
  color: white;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  transform: scale(1.02);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: linear-gradient(135deg, var(--secondary-start), var(--secondary-end));
  color: var(--text-dark);
}

/* Forms */
.form-group {
  margin-bottom: 20px;
  position: relative;
}

.form-group.floating {
  position: relative;
}

.form-group.floating input,
.form-group.floating textarea {
  width: 100%;
  padding: 16px 12px 8px;
  border: 2px solid #e2e8f0;
  border-radius: var(--radius-sm);
  font-size: 16px;
  transition: var(--transition);
  background: transparent;
}

body.dark .form-group.floating input,
body.dark .form-group.floating textarea {
  border-color: #334155;
  color: white;
}

.form-group.floating label {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  transition: var(--transition);
  pointer-events: none;
  background: transparent;
  padding: 0 4px;
}

.form-group.floating input:focus ~ label,
.form-group.floating input:not(:placeholder-shown) ~ label,
.form-group.floating textarea:focus ~ label,
.form-group.floating textarea:not(:placeholder-shown) ~ label {
  top: 0;
  font-size: 12px;
  background: var(--card-white);
  color: var(--primary-start);
}

body.dark .form-group.floating input:focus ~ label,
body.dark .form-group.floating input:not(:placeholder-shown) ~ label {
  background: #1e293b;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--primary-start);
  box-shadow: 0 0 0 3px rgba(0, 114, 255, 0.2);
}

/* Leaderboard Enhancements */
.leaderboard-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  background: var(--card-white);
  transition: var(--transition);
}

body.dark .leaderboard-item {
  background: #1e293b;
}

.rank-1 { border-left: 6px solid #ffd700; }
.rank-2 { border-left: 6px solid #c0c0c0; }
.rank-3 { border-left: 6px solid #cd7f32; }

.avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-start), var(--primary-end));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 1.2rem;
  color: white;
}

/* Dark Mode Toggle - Updated */
.dark-mode-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--card-white);
  border: none;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  transition: var(--transition);
}

.dark-mode-toggle:hover {
  transform: scale(1.05);
}

/* Responsive */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    width: 260px;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .main-content {
    margin-left: 0;
    padding: 70px 16px 24px;
  }
  .close-sidebar {
    display: block;
  }
}

/* Ensure main content margin when sidebar is present */
.app-container {
    display: flex;
    min-height: 100vh;
}
.main-content {
    flex: 1;
    margin-left: 280px;
    padding: 24px 32px;
    transition: margin-left 0.3s ease;
}
@media (max-width: 768px) {
    .main-content {
        margin-left: 0;
    }
}
.stat-card {
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}
.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}
.btn-outline {
    background: transparent;
    border: 2px solid var(--primary-start);
    color: var(--primary-start);
}
.btn-outline:hover {
    background: var(--primary-start);
    color: white;
}

.alert {
    padding: 12px 16px;
    border-radius: 12px;
    margin-bottom: 16px;
    animation: slideIn 0.3s ease;
}
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-danger { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.alert-info { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }
.alert-warning { background: #fff3cd; color: #856404; border: 1px solid #ffeeba; }
@keyframes slideIn {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Grid for cards */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    margin-top: 20px;
}

.card-img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 12px 12px 0 0;
    margin: -20px -20px 16px -20px;
    width: calc(100% + 40px);
}

/* Before/After gallery */
.before-after {
    display: flex;
    gap: 12px;
    justify-content: space-between;
    margin-bottom: 16px;
}
.before-after > div {
    position: relative;
    flex: 1;
}
.before-after img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 12px;
}
.label {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: rgba(0,0,0,0.6);
    color: white;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 10px;
}
.before-after-preview {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}
.before-after-preview img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
}

/* Modal animations */
.modal {
    animation: fadeIn 0.3s ease;
}
.modal-content {
    animation: slideIn 0.3s ease;
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes slideIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Responsive */
@media (max-width: 640px) {
    .grid { grid-template-columns: 1fr; }
    .before-after { flex-direction: column; }
}

/* ---------- NOTIFICATION AREA STYLES ---------- */
.notification-area {
    position: relative;
    margin-left: auto;
}

.notification-bell {
    position: relative;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.notification-bell .badge {
    position: absolute;
    top: -8px;
    right: -12px;
    background: #ef4444;
    color: white !important;
    font-size: 11px;
    font-weight: bold;
    border-radius: 50%;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    z-index: 10;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.notification-dropdown {
    position: absolute;
    top: 35px;
    right: 0;
    width: 320px;
    background: var(--card-white);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    display: none;
    z-index: 1000;
    overflow: hidden;
}

.notification-bell.open .notification-dropdown {
    display: block;
}

.dropdown-header {
    padding: 12px;
    font-weight: bold;
    border-bottom: 1px solid #e2e8f0;
}

.dropdown-list {
    max-height: 400px;
    overflow-y: auto;
}

.notification-item {
    padding: 12px;
    border-bottom: 1px solid #e2e8f0;
    cursor: pointer;
    transition: background 0.2s;
}

.notification-item.unread {
    background: #eff6ff;
}

.notification-item:hover {
    background: #f8fafc;
}

.notification-item .title {
    font-weight: bold;
    margin-bottom: 4px;
}

.notification-item .message {
    font-size: 13px;
    color: #4b5563;
    margin-bottom: 4px;
}

.notification-item .time {
    font-size: 11px;
    color: #9ca3af;
}

.dropdown-footer {
    padding: 10px;
    text-align: center;
    border-top: 1px solid #e2e8f0;
}

.dropdown-footer a {
    color: var(--primary-start);
    text-decoration: none;
}

body.dark .notification-dropdown {
    background: #1e293b;
}

body.dark .dropdown-header,
body.dark .dropdown-footer {
    border-color: #334155;
}

body.dark .notification-item {
    border-color: #334155;
}

body.dark .notification-item.unread {
    background: #0c4a6e;
}

body.dark .notification-item .message {
    color: #cbd5e1;
}

body.dark .notification-item .time {
    color: #94a3b8;
}

/* ---------- MOBILE MENU TOGGLE FIX ---------- */
/* Hide mobile menu toggle on desktop */
.menu-toggle {
    display: none;
}

@media (max-width: 768px) {
    .menu-toggle {
        display: block;
        position: fixed;
        top: 20px;
        left: 20px;
        z-index: 1100;
        background: linear-gradient(135deg, var(--primary-start), var(--primary-end));
        border: none;
        color: white;
        width: 44px;
        height: 44px;
        border-radius: 50%;
        font-size: 1.2rem;
        cursor: pointer;
        box-shadow: var(--shadow-sm);
    }
}