/* ========================================
   PROFILE - Layout full-screen + Sidebar
   ======================================== */

:root {
  --sidebar-bg: #f5f5f5;
  --sidebar-hover: #98b23f29;
  --sidebar-active: #1b7a8029;
  --sidebar-accent: #1b7a80;
  --sidebar-text: #1b7a80;
  --sidebar-text-muted: #8b949e;
  --main-bg: #f5f5f5;
  --main-surface: #131920;
  --card-bg: #ffffff;
  --card-border: #1b7a80;
  --avatar-border: #98b23f6b;
  --text-primary: #1b7a80;
  --text-secondary: #8b949e;
  --input-bg: #f5f5f5;
  --input-border: #98b23f;
  --input-focus: #98b23f5c;
  --btn-primary: #1b7a80;
  --btn-primary-hover: #1b7a80;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --success: #22c55e;
  --admin: #98b23f;
  --user: #3b82f6;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Outfit", -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--main-bg);
  color: var(--text-primary);
  overflow-x: hidden;
}

hr {
  border: 0.5px solid #1b7a80;
  width: 90%;
  height: 1px;
}

/* ========================================
   PAGE LOADER
   ======================================== */

.page-loader {
  position: fixed;
  inset: 0;
  background: var(--main-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.page-loader.hide {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader-ring {
  width: 56px;
  height: 56px;
  border: 3px solid rgba(99, 102, 241, 0.2);
  border-top-color: var(--sidebar-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ========================================
   PROFILE CONTENT WRAPPER
   ======================================== */

#profileContent {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ========================================
   LAYOUT FULL-SCREEN
   ======================================== */

.profile-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  width: 100%;
}

/* ========================================
   SIDEBAR
   ======================================== */

.sidebar {
  width: 280px;
  min-width: 280px;
  height: 100%;
  min-height: 100vh;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--card-border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  z-index: 100;
}

.sidebar-header {
  padding: 1.5rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--card-border);
  position: relative;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-logo-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sidebar-logo img {
  display: block;
  max-width: 160px;
  width: 100%;
  height: auto;
}

.sidebar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  color: var(--sidebar-text);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
  position: absolute;
  right: 1.25rem;
}

.sidebar-toggle:hover {
  background: var(--sidebar-hover);
}

/* Nav */

.sidebar-nav {
  flex: 1;
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  color: var(--sidebar-text-muted);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  transition: all 0.2s ease;
  border: none;
  background: none;
  width: 100%;
  cursor: pointer;
  font-family: inherit;
}

.nav-item ion-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
  display: block;
  color: inherit;
}

.nav-item span {
  color: inherit;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-text);
}

.nav-item.active {
  background: var(--sidebar-active);
  color: var(--sidebar-accent);
}

.nav-item.logout {
  color: #f87171;
}

.nav-item.logout:hover {
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
}

.sidebar-footer {
  padding: 1rem 0.75rem;
  border-top: 1px solid var(--card-border);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 199;
  opacity: 0;
  pointer-events: none;
}


/* ========================================
   MAIN CONTENT
   ======================================== */

.main-content {
  flex: 1;
  min-height: 100vh;
  overflow-y: auto;
  background: 
    radial-gradient(ellipse 80% 50% at 50% -20%, #1b7a80, transparent),
    var(--main-bg);
  position: relative;
}

.mobile-menu-btn {
  display: none;
  position: fixed;
  top: 1rem;
  left: 1.25rem;
  z-index: 150;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  color: var(--sidebar-text);
  font-size: 1.5rem;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: all 0.2s ease;
}

.mobile-menu-btn:hover {
  background: var(--sidebar-hover);
}

.profile-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 3rem 2rem 4rem;
}

.cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.profile-title {
  font-size: 2rem;
  font-weight: 700;
  margin: 0 0 2rem;
  letter-spacing: -0.02em;
}

/* ========================================
   AVATAR
   ======================================== */

.avatar-section {
  text-align: center;
  margin-bottom: 2.5rem;
}

.avatar-wrapper {
  width: 120px;
  height: 120px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid var(--avatar-border);
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.avatar-wrapper:hover {
  transform: scale(1.03);
  box-shadow: 0 0 0 1px var(--sidebar-accent), 0 8px 32px rgba(99, 102, 241, 0.2);
}

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

/* ========================================
   CARDS
   ======================================== */

.cards-grid .card {
  margin-bottom: 0;
}

.card {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 1.75rem;
  margin-bottom: 1.5rem;
}

.card h2 {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0 0 1.25rem;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.form-group input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group input::placeholder {
  color: var(--text-secondary);
  opacity: 0.7;
}

.form-group input:focus {
  outline: none;
  border-color: var(--sidebar-accent);
  box-shadow: 0 0 0 3px var(--input-focus);
}

.meta-info {
  margin-bottom: 1.25rem;
}

.meta-info p {
  margin: 0.5rem 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.meta-info strong {
  color: var(--text-primary);
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 500;
  font-family: inherit;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary {
  width: 100%;
  background: var(--btn-primary);
  color: white;
}

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

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: var(--sidebar-hover);
  color: var(--text-primary);
}

.card .btn-ghost {
  width: 100%;
  margin-top: 0.75rem;
}

/* ========================================
   MESSAGES
   ======================================== */

.msg {
  font-size: 0.875rem;
  margin-top: 0.75rem;
}

.admin {
  color: var(--admin);
}

.user {
  color: var(--user);
}

/* ========================================
   MODAL
   ======================================== */

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  background: var(--main-surface);
  border: 1px solid var(--card-border);
  padding: 2rem;
  border-radius: 20px;
  width: 340px;
  max-width: 90vw;
  text-align: center;
}

.modal-content h3 {
  margin: 0 0 1.5rem;
  font-size: 1.25rem;
}

.close-modal-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.25rem;
  transition: color 0.2s ease;
}

.close-modal-btn:hover {
  color: var(--text-primary);
}

.code-inputs {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin: 1.5rem 0 1rem;
}

.code-inputs input {
  width: 44px;
  height: 52px;
  font-size: 1.25rem;
  text-align: center;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 10px;
  color: var(--text-primary);
  font-family: inherit;
  font-weight: 600;
  transition: border-color 0.2s ease;
}

.code-inputs input:focus {
  outline: none;
  border-color: var(--sidebar-accent);
}

#codeTimer {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin: 0 0 1rem;
}

.modal-content .btn {
  margin: 0.25rem;
}

/* ========================================
   UTILITY
   ======================================== */

.hidden {
  display: none !important;
}

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

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.4);
    z-index: 200;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay.visible {
    display: block;
    opacity: 1;
    pointer-events: auto;
    transition: opacity 0.2s ease;
  }

  .sidebar-toggle {
    display: flex;
  }

  .sidebar-header {
    justify-content: space-between;
    padding: 1.5rem 1.25rem;
    border-bottom: 1px solid var(--card-border);
    position: relative;
  }

  .mobile-menu-btn {
    display: flex;
  }

  .main-content {
    width: 100%;
  }

  .profile-container {
    padding: 2rem 1.25rem 3rem;
    padding-top: 4rem;
  }

  .profile-title {
    font-size: 1.5rem;
  }

  .cards-grid {
    grid-template-columns: 1fr;
  }

  .cards-grid .card {
    margin-bottom: 1.5rem;
  }

  .cards-grid .card:last-child {
    margin-bottom: 0;
  }
}
