/*
 * SocialGO - Main Stylesheet
 * Modern, Clean, Mobile-First Design
 */

:root {
  --primary-color: #4F46E5;
  --primary-dark: #4338CA;
  --primary-light: #EEF2FF;
  --secondary-color: #6c757d;
  --success-color: #198754;
  --danger-color: #dc3545;
  --warning-color: #ffc107;
  --info-color: #0dcaf0;
  --light-color: #f8f9fa;
  --dark-color: #1e1b4b;
  --sidebar-width: 260px;
  --topbar-height: 60px;
  --border-radius: 12px;
  --border-radius-sm: 8px;
  --box-shadow: 0 2px 12px rgba(0,0,0,0.07);
  --box-shadow-lg: 0 4px 24px rgba(0,0,0,0.12);
  --transition: all 0.25s ease;
  --bg-main: #f0f2f8;
}

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

html {
  scroll-behavior: smooth;
  height: 100%;
  overflow-x: hidden;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: #374151;
  background-color: var(--bg-main);
  height: 100%;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

/* Prevent iOS zoom on input focus */
input, select, textarea {
  font-size: 16px;
}

/* ===== LAYOUT ===== */
.wrapper {
  display: flex;
  min-height: 100vh;
  width: 100%;
  position: relative;
  background: var(--bg-main);
}

/* ===== SIDEBAR OVERLAY (mobile) ===== */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 999;
  backdrop-filter: blur(2px);
}

.sidebar-overlay.show {
  display: block;
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(180deg, #1e1b4b 0%, #312e81 100%);
  color: #fff;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
  overflow: hidden;
  box-shadow: 4px 0 16px rgba(0,0,0,0.15);
}

.sidebar-header {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  min-height: 64px;
  flex-shrink: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  text-decoration: none;
  overflow: hidden;
}

.brand-icon {
  width: 36px;
  height: 36px;
  background: rgba(255,255,255,0.15);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  backdrop-filter: blur(4px);
}

.brand-text {
  font-size: 18px;
  font-weight: 700;
  white-space: nowrap;
  background: linear-gradient(90deg, #fff, #c4b5fd);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-close {
  background: rgba(255,255,255,0.1);
  border: none;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  border-radius: 8px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.sidebar-close:hover {
  background: rgba(255,255,255,0.2);
}

.sidebar-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.2) transparent;
}

.sidebar-body::-webkit-scrollbar {
  width: 3px;
}

.sidebar-body::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.2);
  border-radius: 4px;
}

.nav-section {
  margin-bottom: 4px;
}

.nav-section-title {
  display: block;
  padding: 8px 20px 4px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: rgba(255,255,255,0.35);
  font-weight: 700;
}

.sidebar-nav .nav-link {
  padding: 7px 16px;
  color: rgba(255,255,255,0.72);
  display: flex;
  align-items: center;
  gap: 10px;
  transition: var(--transition);
  border-left: 3px solid transparent;
  border-radius: 0;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.sidebar-nav .nav-link:hover {
  color: #fff;
  background: rgba(255,255,255,0.08);
  border-left-color: rgba(196,181,253,0.6);
}

.sidebar-nav .nav-link.active {
  color: #fff;
  background: rgba(167,139,250,0.18);
  border-left-color: #a78bfa;
  font-weight: 600;
}

.sidebar-nav .nav-link i {
  font-size: 17px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid rgba(255,255,255,0.1);
  flex-shrink: 0;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}

.user-avatar {
  width: 36px;
  height: 36px;
  background: rgba(255,255,255,0.15);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.user-details {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex: 1;
  min-width: 0;
}

.user-name {
  font-weight: 600;
  font-size: 13px;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  text-transform: capitalize;
}

/* ===== MAIN CONTENT ===== */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
  width: calc(100% - var(--sidebar-width));
  background: var(--bg-main);
}

/* Public layout: no sidebar margin */
.public-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: #f8f7ff;
}

.public-wrapper .main-content {
  margin-left: 0 !important;
  width: 100% !important;
  background: transparent;
  padding: 0;
  display: block;
  min-height: auto;
}

/* ===== TOPBAR ===== */
.topbar {
  height: var(--topbar-height);
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  flex-shrink: 0;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.sidebar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary-color) 0%, #6366f1 100%);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 1.25rem;
  flex-shrink: 0;
  line-height: 1;
  box-shadow: 0 3px 10px rgba(79, 70, 229, 0.35);
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.sidebar-toggle:hover {
  transform: scale(1.06);
  box-shadow: 0 5px 14px rgba(79, 70, 229, 0.5);
}

.sidebar-toggle:active {
  transform: scale(0.96);
}

.page-title {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
  color: #1e1b4b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.balance-display {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--primary-light);
  border-radius: var(--border-radius-sm);
  color: var(--primary-color);
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.balance-display:hover {
  background: #e0e7ff;
}

.balance-display i {
  font-size: 16px;
}

.balance-label {
  display: none;
}

@media (min-width: 576px) {
  .balance-label {
    display: inline;
  }
}

.balance-amount {
  font-weight: 700;
  font-size: 14px;
}

.notifications-dropdown .btn-link {
  color: #6b7280;
  font-size: 20px;
  position: relative;
  padding: 6px;
  text-decoration: none;
}

.notifications-dropdown .btn-link:hover {
  color: var(--primary-color);
}

.notification-badge {
  position: absolute;
  top: 0px;
  right: 0px;
  width: 17px;
  height: 17px;
  background: var(--danger-color);
  color: #fff;
  font-size: 9px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  border: 2px solid #fff;
}

.user-dropdown .dropdown-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: #374151;
  padding: 4px 8px;
  border-radius: var(--border-radius-sm);
  transition: var(--transition);
}

.user-dropdown .dropdown-toggle:hover {
  background: #f3f4f6;
}

.user-avatar-sm {
  width: 32px;
  height: 32px;
  background: var(--primary-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 16px;
  flex-shrink: 0;
}

/* ===== PAGE CONTENT ===== */
.page-content {
  flex: 1;
  padding: 20px;
  width: 100%;
}

/* ===== FOOTER ===== */
.footer {
  padding: 14px 24px;
  background: #fff;
  border-top: 1px solid #e5e7eb;
  flex-shrink: 0;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--secondary-color);
  flex-wrap: wrap;
  gap: 8px;
}

.footer-nav a {
  color: var(--secondary-color);
  text-decoration: none;
  margin-left: 12px;
}

.footer-nav a:hover {
  color: var(--primary-color);
}

/* ===== FLASH MESSAGES ===== */
.flash-message {
  border: none;
  border-radius: var(--border-radius-sm);
  padding: 12px 16px;
  margin-bottom: 16px;
}

/* ===== CARDS ===== */
.card {
  border: none;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  background: #fff;
}

.card-header {
  background: transparent;
  border-bottom: 1px solid #f0f0f0;
  padding: 14px 20px;
  font-weight: 600;
  font-size: 14px;
}

.card-body {
  padding: 20px;
}

/* ===== STAT CARDS ===== */
.stat-card {
  background: #fff;
  border-radius: var(--border-radius);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--box-shadow);
  transition: var(--transition);
  height: 100%;
}

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

.stat-icon {
  width: 50px;
  height: 50px;
  border-radius: var(--border-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: #fff;
  flex-shrink: 0;
}

.stat-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.stat-label {
  font-size: 12px;
  color: var(--secondary-color);
  margin-bottom: 2px;
  font-weight: 500;
}

.stat-value {
  font-size: 19px;
  font-weight: 700;
  color: var(--dark-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===== WELCOME BANNER ===== */
.welcome-banner {
  background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
  border-radius: var(--border-radius);
  padding: 24px 28px;
  color: #fff;
}

.welcome-banner h2 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 6px;
}

.welcome-banner p {
  opacity: 0.9;
  margin: 0;
  font-size: 14px;
}

/* ===== TABLES ===== */
.table {
  font-size: 13px;
}

.table th {
  font-weight: 600;
  color: var(--secondary-color);
  border-top: none;
  padding: 10px 14px;
  white-space: nowrap;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.table td {
  padding: 10px 14px;
  vertical-align: middle;
}

.table-responsive {
  border-radius: var(--border-radius-sm);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ===== BADGES ===== */
.badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 11px;
}

/* ===== BUTTONS ===== */
.btn {
  border-radius: var(--border-radius-sm);
  font-weight: 500;
  padding: 8px 18px;
  transition: var(--transition);
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(0,0,0,0.1);
}

.btn-primary {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
}

.btn-primary:hover {
  background-color: var(--primary-dark);
  border-color: var(--primary-dark);
}

.btn-outline-primary {
  color: var(--primary-color);
  border-color: var(--primary-color);
}

.btn-outline-primary:hover {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
}

.btn-lg {
  padding: 11px 24px;
}

/* ===== FORMS ===== */
.form-control, .form-select {
  border-radius: var(--border-radius-sm);
  border: 1px solid #d1d5db;
  padding: 10px 14px;
  font-size: 16px;
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.12);
}

/* ===== NEWS ITEMS ===== */
.news-item {
  padding: 12px 0;
  border-bottom: 1px solid #f0f0f0;
}

.news-item:last-child {
  border-bottom: none;
}

.news-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.news-badge.announcement { background: #EEF2FF; color: var(--primary-color); }
.news-badge.update { background: #d4edda; color: var(--success-color); }
.news-badge.maintenance { background: #fff3cd; color: #856404; }

.news-title {
  margin-bottom: 4px;
  font-weight: 600;
  font-size: 14px;
}

.news-date {
  font-size: 12px;
  color: var(--secondary-color);
  margin: 0;
}

/* ===== DROPDOWN ===== */
.dropdown-menu {
  border: none;
  box-shadow: var(--box-shadow-lg);
  border-radius: var(--border-radius-sm);
  font-size: 14px;
}

/* ===== NOTIFICATIONS ===== */
.notifications-menu {
  min-width: 300px;
  max-width: 340px;
}

.notification-item {
  padding: 10px 16px;
  white-space: normal;
}

.notification-item.unread {
  background: #f5f3ff;
}

.notification-title {
  font-weight: 600;
  margin: 0 0 2px;
  font-size: 13px;
}

.notification-text {
  color: var(--secondary-color);
  margin: 0 0 2px;
  font-size: 12px;
}

.notification-time {
  font-size: 11px;
  color: #9ca3af;
}

/* ===== MOBILE CARD TABLES (user panel) ===== */
.table-mobile {
  width: 100%;
}

/* ===== API KEY FIELD ===== */
.key-field-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.key-field-wrap .form-control {
  padding-right: 90px;
  font-size: 13px;
  letter-spacing: 0.03em;
}

.key-actions {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  gap: 2px;
}

.key-btn {
  background: none;
  border: none;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  color: #6c757d;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.15s;
}

.key-btn:hover { background: #f0f0f0; color: #333; }
.key-btn-copy:hover { background: #e8f0fe; color: var(--primary-color); }

/* ===== CONTAINER FIX ===== */
.page-content .container-fluid {
  padding-left: 0;
  padding-right: 0;
}

.admin-content .container-fluid {
  padding-left: 0;
  padding-right: 0;
}

/* ===== RESPONSIVE - TABLET ===== */
@media (max-width: 991px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: none;
  }

  .sidebar.show {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,0.3);
  }

  .main-content {
    margin-left: 0;
    width: 100%;
  }

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

  .page-title {
    font-size: 16px;
  }
}

/* ===== RESPONSIVE - MOBILE ===== */
@media (max-width: 767px) {
  .page-content {
    padding: 12px;
  }

  .topbar {
    padding: 0 12px;
    gap: 8px;
  }

  .stat-card {
    padding: 14px;
  }

  .stat-icon {
    width: 44px;
    height: 44px;
    font-size: 18px;
  }

  .stat-value {
    font-size: 16px;
  }

  .welcome-banner {
    padding: 18px;
  }

  .welcome-banner h2 {
    font-size: 17px;
  }

  .footer-content {
    flex-direction: column;
    text-align: center;
    gap: 4px;
  }

  .footer {
    padding: 12px 16px;
  }

  .card-body {
    padding: 14px;
  }

  .card-header {
    padding: 12px 14px;
  }

  .notifications-menu {
    min-width: 260px;
    max-width: calc(100vw - 20px);
  }

  .page-title {
    font-size: 15px;
  }

  .balance-amount {
    font-size: 13px;
    font-weight: 700;
  }

  .balance-display {
    padding: 5px 10px;
  }

  /* Mobile card tables for user panel */
  .table-mobile thead {
    display: none;
  }

  .table-mobile tbody tr {
    display: block;
    margin-bottom: 10px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
  }

  .table-mobile tbody tr:last-child {
    margin-bottom: 0;
  }

  .table-mobile tbody td {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 9px 14px;
    border: none;
    border-bottom: 1px solid #f5f5f5;
    text-align: right;
    font-size: 13px;
    gap: 8px;
    min-height: 38px;
    word-break: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
  }

  .table-mobile tbody td:last-child {
    border-bottom: none;
  }

  .table-mobile tbody td::before {
    content: attr(data-label);
    font-weight: 700;
    color: #374151;
    text-align: left;
    flex-shrink: 0;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding-top: 2px;
    min-width: 90px;
  }

  .table-mobile tbody td[colspan] {
    display: block;
    text-align: center;
  }

  .table-mobile tbody td[colspan]::before {
    display: none;
  }

  .table-mobile tbody td.td-actions {
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 6px;
  }

  .table-mobile tbody td.td-actions::before {
    display: none;
  }

  /* Card table override */
  .card .table-responsive {
    overflow-x: visible;
  }
}

@media (max-width: 480px) {
  .topbar-right .balance-display {
    display: none;
  }

  .page-content {
    padding: 10px;
  }

  .card-body {
    padding: 12px;
  }

  .stat-value {
    font-size: 15px;
  }
}

/* ===== PAGINATION ===== */
.page-link {
  border-radius: 6px !important;
  margin: 0 2px;
  font-size: 13px;
}

.pagination {
  flex-wrap: wrap;
  gap: 2px;
}

/* ===== BANNER PREVIEW INLINE ANIMATIONS ===== */
.bp-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(35px);
  animation: bpOrbFloat 6s ease-in-out infinite;
}
@keyframes bpAuroraShift {
  0%   { transform: scale(1) rotate(0deg); opacity:.8; }
  50%  { transform: scale(1.08) rotate(1.5deg); opacity:1; }
  100% { transform: scale(1.04) rotate(-1deg); opacity:.85; }
}
@keyframes bpOrbFloat {
  0%,100% { transform: translateY(0) scale(1); }
  50%      { transform: translateY(-12px) scale(1.08); }
}
@keyframes bpTwinkle {
  0%,100% { opacity:0; transform:scale(.5); }
  50%      { opacity:1; transform:scale(1.5); }
}
@keyframes bpGridDrift {
  0%   { background-position: 0 0; }
  100% { background-position: 30px 30px; }
}
@keyframes bpGlowPulse {
  0%   { opacity:.6; }
  100% { opacity:1; }
}
@keyframes bpScanMove {
  0%   { top:-2px; opacity:0; }
  10%  { opacity:1; }
  90%  { opacity:1; }
  100% { top:100%; opacity:0; }
}
@keyframes bpHexSpin {
  0%   { transform: translateY(-50%) rotate(0deg); }
  100% { transform: translateY(-50%) rotate(360deg); }
}
@keyframes bpCFloat {
  0%,100% { opacity:0; transform:translateY(0); }
  20%,80% { opacity:1; }
  50%      { transform:translateY(-20px); opacity:.8; }
}
@keyframes bpShimmer {
  0%,100% { opacity:.4; }
  50%      { opacity:1; }
}
@keyframes bpPulse {
  0%,100% { transform:scale(1); opacity:.6; }
  50%      { transform:scale(1.25); opacity:1; }
}
@keyframes bpVividPulse {
  0%,100% { opacity:0; }
  50%      { opacity:.08; }
}
