/* =========================================
   1. VARIABLES & GLOBAL RESET
   ========================================= */
:root {
  --primary: #1a56db;
  --secondary: #64748b;
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --border: #e2e8f0;
  --text-dark: #0f172a;

  --shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.1), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.05), 0 4px 6px -4px rgba(15, 23, 42, 0.05);
  --radius-button: 6px;
  --radius-card: 12px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-dark);
  line-height: 1.6;
  min-height: 100vh;
  width: 100%;
  display: flex;
  flex-direction: column;
}

/* =========================================
   2. NAVIGATION BAR
   ========================================= */
nav {
  width: 100%;
  height: 56px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--text-dark);
  color: white;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 1000;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
}

nav a {
  color: #94a3b8;
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: color 0.2s var(--ease-out);
}

nav a:hover {
  color: white;
}

.nav-left, .nav-right {
  display: flex;
  gap: 1.25rem;
  align-items: center;
  flex: 1;
}

.nav-right {
  justify-content: flex-end;
}

.nav-left a:first-child {
  font-size: 1rem;
  font-weight: 600;
  color: white;
  letter-spacing: -0.02em;
}

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

.active-content {
  background: rgba(255, 255, 255, 0.1);
  padding: 0.375rem 0.875rem;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  font-weight: 500;
  color: white;
  display: inline-flex;
  align-items: center;
  font-size: 0.875rem;
  transition: all 0.2s var(--ease-out);
}

.active-content:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.25);
}

/* =========================================
   3. LAYOUT CONTAINERS
   ========================================= */
.main-content {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
  flex-grow: 1;
}

.form-container, .auth-card, .profile-card, .confirm-card {
  background: var(--bg-card);
  padding: 2.5rem;
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  width: 100%;
  max-width: 480px;
  margin: 3rem auto;
}

h1, h2, h3 {
  text-align: left;
  color: var(--text-dark);
  font-weight: 600;
  letter-spacing: -0.025em;
  margin-bottom: 1.5rem;
}

h1 { font-size: 1.5rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.125rem; }

.responsive-container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
}

/* =========================================
   4. FORMS & INPUTS
   ========================================= */
.form-group {
  width: 100%;
  margin-bottom: 1.25rem;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  column-gap: 1rem;
  row-gap: 1.25rem;
  width: 100%;
}

label {
  display: block;
  font-weight: 500;
  color: #475569;
  margin-bottom: 0.375rem;
  font-size: 0.8125rem;
}

input, select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-button);
  font-size: 0.875rem;
  color: var(--text-dark);
  background-color: var(--bg-card);
  box-shadow: var(--shadow-sm);
  transition: all 0.15s var(--ease-out);
}

input:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary), 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.checkbox-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 1rem 0;
  cursor: pointer;
}

.checkbox-group input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--primary);
  box-shadow: none;
  cursor: pointer;
}

/* =========================================
   5. BUTTONS
   ========================================= */
.btn {
  padding: 0.5rem 1rem;
  border-radius: var(--radius-button);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s var(--ease-out);
}

.btn:hover {
  filter: brightness(0.96);
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--primary);
  color: white !important;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.btn-outline {
  background: var(--bg-card);
  border-color: #cbd5e1;
  color: #334155;
}

.btn-outline:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

.btn-danger {
  background: var(--danger);
  color: white !important;
}

.btn-block {
  width: 100%;
  display: flex;
  margin-top: 0.75rem;
}

.btn-status-activate {
  border-color: var(--success) !important;
  color: var(--success) !important;
}

.btn-status-activate:hover {
  background: var(--success) !important;
  color: white !important;
}

.btn-status-inactivate {
  border-color: var(--warning) !important;
  color: var(--warning) !important;
}

.btn-status-inactivate:hover {
  background: var(--warning) !important;
  color: white !important;
}

/* =========================================
   6. BADGES & STATUS
   ========================================= */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.125rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: none;
  line-height: 1.2;
  white-space: nowrap;
}

.badge-self {
  background-color: #eff6ff;
  color: var(--primary);
  border: 1px solid #bfdbfe;
}

.status-paid {
  background-color: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.status-pending {
  background-color: #fffbeb;
  color: #92400e;
  border: 1px solid #fde68a;
}

.status-denied {
  background-color: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

/* =========================================
   7. LISTS & TABLES
   ========================================= */
.record-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.record-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s var(--ease-out), box-shadow 0.15s var(--ease-out);
}

.record-card:hover {
  border-color: #cbd5e1;
  box-shadow: var(--shadow-md);
}

.billing-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  margin: 1.5rem 0;
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.billing-table th {
  background-color: #f8fafc;
  color: #64748b;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.billing-table td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border);
  color: #334155;
  font-size: 0.875rem;
  text-align: left;
}

.billing-table tr:last-child td {
  border-bottom: none;
}

.billing-table tr:hover td {
  background-color: #f8fafc;
}

/* =========================================
   8. DASHBOARD & GRIDS
   ========================================= */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  width: 100%;
}

.action-card {
  background: var(--bg-card);
  padding: 2rem 1.5rem;
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 0.375rem;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s var(--ease-out);
}

.action-card:hover {
  border-color: #cbd5e1;
  box-shadow: var(--shadow-lg);
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  width: 100%;
}

.info-item {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.info-item label {
  color: var(--secondary);
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  margin-bottom: 0;
}

.info-item span {
  font-weight: 500;
  color: var(--text-dark);
  font-size: 1rem;
}

.error-msg {
  background: #fef2f2;
  color: var(--danger);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-button);
  border: 1px solid #fee2e2;
  font-size: 0.875rem;
  font-weight: 500;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  width: 100%;
}

.tool-card {
  background: var(--bg-card);
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.winner-card {
  border: 1px solid #bfdbfe;
  box-shadow: 0 0 0 1px var(--primary), var(--shadow-sm);
  background-color: #f8fafc;
}

/* =========================================
   9. MOBILE RESPONSIVENESS
   ========================================= */
@media (max-width: 768px) {
  nav {
    flex-direction: row;
    padding: 0 1rem;
    height: 52px;
  }

  .nav-center {
    display: none;
  }

  .nav-left, .nav-right {
    flex: initial;
  }

  .main-content {
    padding: 1.5rem 1rem;
  }

  .form-container, .auth-card, .profile-card, .confirm-card {
    padding: 1.75rem 1.25rem;
    margin: 1rem 0;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .record-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
  }

  .billing-table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .detail-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .responsive-container {
    width: 100%;
  }
}

.wide-wrapper {
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
}

.wide-wrapper .profile-card {
  max-width: 100%;
}

.split-dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: start;
}

@media (max-width: 850px) {
  .split-dashboard-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}
