/*
 * 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;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: #374151;
  background-color: #f4f6fb;
}

/* ===== LAYOUT ===== */
.wrapper {
  display: flex;
  min-height: 100vh;
  position: relative;
}

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

.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: var(--transition);
  overflow: hidden;
}

.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;
}

.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);
}

.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: 4px;
}

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

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

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

.sidebar-nav .nav-link {
  padding: 10px 20px;
  color: rgba(255,255,255,0.75);
  display: flex;
  align-items: center;
  gap: 12px;
  transition: var(--transition);
  border-left: 3px solid transparent;
  border-radius: 0;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}

.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(255,255,255,0.12);
  border-left-color: #a78bfa;
}

.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;
}

.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;
}

/* 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;
  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);
}

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

.sidebar-toggle {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--dark-color);
  display: none;
  padding: 4px;
  border-radius: 6px;
  flex-shrink: 0;
  line-height: 1;
}

.sidebar-toggle:hover {
  background: #f3f4f6;
}

.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;
}

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

.balance-label {
  display: none;
}

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

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

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

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

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

.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: 24px;
}

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

.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: 16px 20px;
  font-weight: 600;
}

.card-body {
  padding: 20px;
}

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

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

.stat-icon {
  width: 52px;
  height: 52px;
  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;
}

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

.stat-value {
  font-size: 20px;
  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: 28px 32px;
  color: #fff;
}

.welcome-banner h2 {
  font-size: 22px;
  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;
}

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

.table-responsive {
  border-radius: var(--border-radius-sm);
}

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

/* ===== BUTTONS ===== */
.btn {
  border-radius: var(--border-radius-sm);
  font-weight: 500;
  padding: 9px 18px;
  transition: var(--transition);
}

.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);
}

.form-floating > .form-control {
  padding: 16px 14px;
  height: calc(3.5rem + 2px);
}

/* ===== 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;
}

/* ===== 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.2);
  }

  .main-content {
    margin-left: 0;
  }

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

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

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

  .topbar {
    padding: 0 14px;
  }

  .stat-card {
    padding: 14px;
  }

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

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

  .welcome-banner {
    padding: 20px;
  }

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

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

  .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;
  }

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

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

/* ===== 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);
}
