/**
 * Cuti-E Super Admin - Standalone Styles
 * Combined base styles and super admin specific styles
 */

/* ==========================================================================
   CSS Variables
   ========================================================================== */

:root {
  /* Colors */
  --pink-primary: #FF69B4;
  --pink-hover: #FF1493;
  --pink-light: #FFB6D9;

  --gray-50: #F9FAFB;
  --gray-100: #F3F4F6;
  --gray-200: #E5E7EB;
  --gray-300: #D1D5DB;
  --gray-400: #9CA3AF;
  --gray-500: #6B7280;
  --gray-600: #4B5563;
  --gray-700: #374151;
  --gray-800: #1F2937;
  --gray-900: #111827;

  --blue: #3B82F6;
  --green: #10B981;
  --orange: #F59E0B;
  --red: #EF4444;
  --purple: #8B5CF6;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;

  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", Consolas, monospace;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);

  /* Border radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;

  /* Transitions */
  --transition: all 0.2s ease;
}

/* ==========================================================================
   Reset & Base Styles
   ========================================================================== */

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  line-height: 1.6;
  color: var(--gray-900);
  background: var(--gray-50);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
  color: var(--gray-900);
}

h1 { font-size: 2.25rem; }
h2 { font-size: 1.875rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

p {
  margin-bottom: var(--space-4);
  color: var(--gray-700);
}

a {
  color: var(--pink-primary);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--pink-hover);
}

/* ==========================================================================
   Navigation
   ========================================================================== */

.nav {
  background: linear-gradient(135deg, #1a1a2e, #16213e);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: white;
  font-size: 1.25rem;
  font-weight: 600;
}

.nav-logo {
  font-size: 1.5rem;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-link {
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  transition: color 0.2s;
}

.nav-link:hover {
  color: white;
}

.nav-link-active {
  color: white !important;
  font-weight: 600;
}

/* ==========================================================================
   Main Content
   ========================================================================== */

.main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
}

/* ==========================================================================
   Stats Section
   ========================================================================== */

.stats-section, .activity-section, .tier-section {
  margin-bottom: 2rem;
}

.stats-section h2, .activity-section h2, .tier-section h2,
.customers-section h2, .audit-section h2 {
  margin-bottom: 1rem;
  color: #333;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.stats-grid-small {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.stat-card {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
  text-align: center;
  transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
}

.stat-card-small {
  padding: 1rem;
}

.stat-value {
  font-size: 2.5rem;
  font-weight: 700;
  color: #FF69B4;
  line-height: 1;
}

.stat-card-small .stat-value {
  font-size: 1.75rem;
}

.stat-label {
  font-size: 0.875rem;
  color: #666;
  margin-top: 0.5rem;
}

/* ==========================================================================
   Tier Breakdown
   ========================================================================== */

.tier-breakdown {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.tier-item {
  background: white;
  border-radius: 8px;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.tier-name {
  font-weight: 500;
  color: #333;
}

.tier-count {
  font-size: 1.25rem;
  font-weight: 700;
  color: #FF69B4;
}

/* ==========================================================================
   Section Header
   ========================================================================== */

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.search-box {
  display: flex;
  gap: 0.5rem;
}

/* ==========================================================================
   Tables
   ========================================================================== */

.table-container {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 0.875rem 1rem;
  text-align: left;
  border-bottom: 1px solid #eee;
}

.table th {
  background: #f8f9fa;
  font-weight: 600;
  color: #333;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.table tbody tr:hover {
  background: #fafafa;
}

.table .loading,
.table .empty,
.table .error {
  text-align: center;
  color: #666;
  padding: 2rem;
}

.table .error {
  color: #dc3545;
}

/* ==========================================================================
   Badges
   ========================================================================== */

.badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-warning {
  background: #fff3cd;
  color: #856404;
}

.badge-free {
  background: #e9ecef;
  color: #495057;
}

.badge-starter {
  background: #d4edda;
  color: #155724;
}

.badge-pro {
  background: #cce5ff;
  color: #004085;
}

.badge-business {
  background: #fff3cd;
  color: #856404;
}

.badge-success {
  background: #d4edda;
  color: #155724;
}

.badge-error {
  background: #f8d7da;
  color: #721c24;
}

.badge-small {
  padding: 0.125rem 0.5rem;
  font-size: 0.625rem;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}

.btn-primary {
  background: #FF69B4;
  color: white;
}

.btn-primary:hover {
  background: #FF1493;
}

.btn-outline {
  background: transparent;
  border: 1px solid #ddd;
  color: #333;
}

.btn-outline:hover {
  background: #f8f9fa;
  border-color: #ccc;
}

.btn-danger {
  background: #dc3545;
  color: white;
}

.btn-danger:hover {
  background: #c82333;
}

.btn-small {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ==========================================================================
   Form Elements
   ========================================================================== */

.input, .select {
  padding: 0.5rem 0.75rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.875rem;
  min-width: 200px;
}

.input:focus, .select:focus {
  outline: none;
  border-color: #FF69B4;
  box-shadow: 0 0 0 3px rgba(255, 105, 180, 0.1);
}

/* ==========================================================================
   Modals
   ========================================================================== */

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: white;
  border-radius: 12px;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-large {
  max-width: 800px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #eee;
}

.modal-header h3 {
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #666;
}

.modal-close:hover {
  color: #333;
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  padding: 1rem 1.5rem;
  border-top: 1px solid #eee;
}

/* ==========================================================================
   Customer Details
   ========================================================================== */

.customer-details {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.detail-group h4 {
  margin: 0 0 0.75rem 0;
  color: #333;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.detail-group p {
  margin: 0.5rem 0;
  color: #666;
}

.detail-group strong {
  color: #333;
}

.admin-list, .app-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.admin-list li, .app-list li {
  padding: 0.5rem 0;
  border-bottom: 1px solid #eee;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.admin-list li:last-child, .app-list li:last-child {
  border-bottom: none;
}

.admin-list small {
  color: #999;
  font-size: 0.75rem;
}

/* ==========================================================================
   Pagination
   ========================================================================== */

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1rem;
  background: white;
  border-top: 1px solid #eee;
}

/* ==========================================================================
   Toast Notifications
   ========================================================================== */

.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  padding: 1rem 1.5rem;
  border-radius: 8px;
  background: #333;
  color: white;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s;
  z-index: 2000;
}

.toast.active {
  transform: translateY(0);
  opacity: 1;
}

.toast-success {
  background: #28a745;
}

.toast-error {
  background: #dc3545;
}

/* ==========================================================================
   Usage Bar
   ========================================================================== */

.usage-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 100px;
}

.usage-bar {
  flex: 1;
  height: 8px;
  background: #e9ecef;
  border-radius: 4px;
  overflow: hidden;
}

.usage-bar-fill {
  height: 100%;
  background: #28a745;
  border-radius: 4px;
  transition: width 0.3s ease;
}

.usage-bar-fill.usage-warn {
  background: #ffc107;
}

.usage-bar-fill.usage-over {
  background: #dc3545;
}

.usage-text {
  font-size: 0.75rem;
  font-weight: 600;
  color: #666;
  min-width: 35px;
}

.usage-text-warn {
  color: #dc3545;
}

.usage-unlimited {
  font-size: 0.75rem;
  color: #28a745;
  font-weight: 500;
}

/* ==========================================================================
   Page Header
   ========================================================================== */

.page-header {
  margin-bottom: 2rem;
}

.page-header h1 {
  margin: 0 0 0.5rem 0;
  color: #333;
}

.page-description {
  color: #666;
  margin: 0;
}

/* ==========================================================================
   Count Badge
   ========================================================================== */

.count-badge {
  display: inline-block;
  background: #FF69B4;
  color: white;
  padding: 0.125rem 0.5rem;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 600;
  vertical-align: middle;
  margin-left: 0.5rem;
}

/* ==========================================================================
   Filters Section
   ========================================================================== */

.filters-section {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.filter-group label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.filter-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

/* Date Range */
.date-range {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.date-range span {
  color: #666;
  font-size: 0.875rem;
}

.input-date {
  min-width: auto;
  width: 140px;
}

/* ==========================================================================
   Events Section
   ========================================================================== */

.events-section {
  margin-bottom: 2rem;
}

.events-table td {
  vertical-align: middle;
}

.events-table .event-type {
  font-weight: 500;
}

/* Event Type Badges */
.event-badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.25px;
}

.event-badge-created { background: #d4edda; color: #155724; }
.event-badge-renewed { background: #cce5ff; color: #004085; }
.event-badge-upgraded { background: #e2e3f3; color: #3d5afe; }
.event-badge-downgraded { background: #fff3cd; color: #856404; }
.event-badge-cancelled { background: #f8d7da; color: #721c24; }
.event-badge-expired { background: #e9ecef; color: #495057; }
.event-badge-reactivated { background: #d1ecf1; color: #0c5460; }
.event-badge-payment-failed { background: #f8d7da; color: #721c24; }
.event-badge-payment-recovered { background: #d4edda; color: #155724; }
.event-badge-refund { background: #f8d7da; color: #721c24; }
.event-badge-grace { background: #fff3cd; color: #856404; }
.event-badge-promo { background: #f3e5f5; color: #7b1fa2; }
.event-badge-trial { background: #e0f7fa; color: #00838f; }
.event-badge-default { background: #e9ecef; color: #495057; }

/* Platform Badges */
.platform-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.125rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
}

.platform-ios { background: #e3f2fd; color: #1565c0; }
.platform-android { background: #e8f5e9; color: #2e7d32; }
.platform-web { background: #f3e5f5; color: #7b1fa2; }
.platform-admin { background: #fff3e0; color: #e65100; }
.platform-system { background: #e9ecef; color: #495057; }

/* ==========================================================================
   Form Groups
   ========================================================================== */

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

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: #333;
  margin-bottom: 0.5rem;
}

.form-group .input,
.form-group .select {
  width: 100%;
}

.textarea {
  min-height: 80px;
  resize: vertical;
  font-family: inherit;
}

/* ==========================================================================
   JSON Viewer
   ========================================================================== */

.json-viewer {
  background: #1e1e1e;
  color: #d4d4d4;
  padding: 1rem;
  border-radius: 8px;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 0.8125rem;
  line-height: 1.5;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ==========================================================================
   Event Detail
   ========================================================================== */

.event-detail-row {
  display: flex;
  margin-bottom: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #eee;
}

.event-detail-row:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.event-detail-label {
  font-weight: 500;
  color: #666;
  width: 140px;
  flex-shrink: 0;
}

.event-detail-value {
  color: #333;
  flex: 1;
}

/* ==========================================================================
   Timeline View
   ========================================================================== */

.timeline {
  position: relative;
  padding-left: 2rem;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 0.5rem;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #e9ecef;
}

.timeline-event {
  position: relative;
  padding: 1rem;
  margin-bottom: 1rem;
  background: #f8f9fa;
  border-radius: 8px;
}

.timeline-event::before {
  content: '';
  position: absolute;
  left: -1.75rem;
  top: 1.25rem;
  width: 10px;
  height: 10px;
  background: #FF69B4;
  border-radius: 50%;
  border: 2px solid white;
  box-shadow: 0 0 0 2px #FF69B4;
}

.timeline-event:last-child {
  margin-bottom: 0;
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.5rem;
  gap: 1rem;
}

.timeline-time {
  font-size: 0.75rem;
  color: #999;
  white-space: nowrap;
}

.timeline-body {
  font-size: 0.875rem;
  color: #666;
}

/* ==========================================================================
   FAB (Floating Action Button)
   ========================================================================== */

.fab-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 100;
}

.fab {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #FF69B4;
  color: white;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(255, 105, 180, 0.4);
  transition: all 0.3s;
}

.fab:hover {
  background: #FF1493;
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(255, 105, 180, 0.5);
}

.fab-menu {
  position: absolute;
  bottom: 70px;
  right: 0;
  display: none;
  flex-direction: column;
  gap: 0.5rem;
}

.fab-menu.active {
  display: flex;
}

.fab-action {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: white;
  border: none;
  border-radius: 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.fab-action:hover {
  background: #f8f9fa;
  transform: translateX(-4px);
}

.fab-icon {
  width: 24px;
  height: 24px;
  background: #FF69B4;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 600;
}

.fab-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: #333;
}

/* ==========================================================================
   Customer Link
   ========================================================================== */

.customer-link {
  color: #FF69B4;
  text-decoration: none;
  cursor: pointer;
}

.customer-link:hover {
  text-decoration: underline;
  color: #FF1493;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 768px) {
  .nav {
    flex-direction: column;
    gap: 1rem;
  }

  .nav-links {
    flex-wrap: wrap;
    justify-content: center;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .section-header {
    flex-direction: column;
    gap: 1rem;
  }

  .search-box {
    width: 100%;
    flex-direction: column;
  }

  .input, .select {
    width: 100%;
  }

  .table-container {
    overflow-x: auto;
  }

  .modal-content {
    margin: 1rem;
  }

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

  .filter-actions {
    flex-direction: column;
  }

  .filter-actions .btn {
    width: 100%;
  }

  .date-range {
    flex-direction: column;
    align-items: stretch;
  }

  .date-range span {
    text-align: center;
  }

  .input-date {
    width: 100%;
  }

  .event-detail-row {
    flex-direction: column;
    gap: 0.25rem;
  }

  .event-detail-label {
    width: auto;
  }

  .timeline-header {
    flex-direction: column;
    gap: 0.25rem;
  }

  .fab-container {
    bottom: 1rem;
    right: 1rem;
  }
}
