/* Design system tokens - Professional Corporate */
:root {
  /* Corporate Palette */
  --primary: #2c3e50;
  --primary-light: #34495e;
  --accent: #3498db;
  --accent-dark: #2980b9;
  --bg-body: #ecf0f1;
  --bg-card: #ffffff;
  --text-main: #2c3e50;
  --text-muted: #7f8c8d;
  --border: #bdc3c7;
  --success: #27ae60;
  --warning: #f39c12;
  --danger: #c0392b;
  
  /* Shadows & Radius */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 2px 4px rgba(0,0,0,0.1);
  --radius: 4px;
  
  /* Typography */
  --font-sans: 'Roboto', -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;

  /* Legacy variable mappings for compatibility */
  --color-bg: var(--bg-body);
  --color-card: var(--bg-card);
  --color-border: var(--border);
  --color-text: var(--text-main);
  --color-muted: var(--text-muted);
  --color-primary: var(--accent);
  --color-primary-600: var(--accent-dark);
  --color-success: var(--success);
  --color-warning: var(--warning);
  --color-danger: var(--danger);
  --radius-1: var(--radius);
  --radius-2: var(--radius);
  --shadow-1: var(--shadow-sm);
  --shadow-2: var(--shadow-md);
  
  /* Spacing */
  --space-0: 0;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
}

@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap');

* { box-sizing: border-box; }

html, body {
  padding: 0;
  margin: 0;
  font-family: var(--font-sans);
  color: var(--text-main);
  background: var(--bg-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img { max-width: 100%; display: block; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout Structure */
.app-container {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 250px;
  background-color: var(--primary);
  color: white;
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  left: 0;
  top: 0;
  z-index: 100;
}

.main-content {
  flex: 1;
  margin-left: 250px;
  padding: 2rem;
  width: calc(100% - 250px);
}

/* Sidebar Components */
.logo {
  padding: 1.5rem;
  font-size: 1.5rem;
  font-weight: 700;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: white;
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: var(--accent);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: white;
}

.sidebar nav {
  padding: 1rem 0;
  flex: 1;
  overflow-y: auto;
}

.nav-btn {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 1rem 1.5rem;
  color: #bdc3c7;
  font-family: inherit;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s;
  border-left: 4px solid transparent;
}

.nav-btn:hover {
  background-color: var(--primary-light);
  color: white;
}

.nav-btn.active {
  background-color: var(--primary-light);
  color: white;
  border-left-color: var(--accent);
}

.user-profile {
  padding: 1.5rem;
  border-top: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  gap: 1rem;
}

.avatar {
  width: 40px;
  height: 40px;
  background: #95a5a6;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: white;
}

/* Page Header */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #dcdcdc;
}

h1 {
  font-size: 1.75rem;
  font-weight: 500;
  color: var(--text-main);
  margin: 0;
}

h2 {
  font-size: 1.25rem;
  font-weight: 500;
  margin-bottom: 1rem;
  color: var(--primary);
  border-bottom: 2px solid var(--accent);
  display: inline-block;
  padding-bottom: 0.5rem;
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-top: 0.25rem;
}

/* Cards / Sections */
.card, .section {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid #e0e0e0;
  margin-bottom: 1.5rem;
}

.section > h2 {
  margin-top: 0;
}

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  padding: 1.5rem;
  border-left: 4px solid var(--accent);
}

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

.stat-value {
  font-size: 2rem;
  font-weight: 300;
  color: var(--text-main);
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 700;
}

.stat-trend {
  font-size: 0.8rem;
  font-weight: 500;
}

.trend-up { color: var(--success); }
.trend-down { color: var(--danger); }

/* Forms */
.form-row {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.form-group, .field {
  margin-bottom: 1.5rem;
  flex: 1;
}

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text-main);
}

.help {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 0.25rem;
}

input[type="text"],
input[type="number"],
input[type="email"],
input[type="tel"],
input[type="url"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color 0.2s;
  background-color: #fff;
  color: var(--text-main);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid transparent;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--bg-card);
  color: var(--text-main);
}

.btn:hover {
  box-shadow: var(--shadow-sm);
}

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

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

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

.btn-secondary {
  background-color: white;
  border-color: var(--border);
  color: var(--text-main);
}

.btn-secondary:hover {
  background-color: #f5f5f5;
  border-color: #95a5a6;
}

.btn-danger {
  background-color: var(--danger);
  color: white;
  border-color: #a93226;
}

.btn-danger:hover {
  background-color: #a93226;
}

.btn-block {
  width: 100%;
}

/* Tables */
.table-container {
  overflow-x: auto;
  border: 1px solid #e0e0e0;
  border-radius: var(--radius);
}

table, .table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  background: white;
}

th {
  text-align: left;
  padding: 0.8rem 1rem;
  background: #f8f9fa;
  border-bottom: 2px solid #dcdcdc;
  color: var(--text-main);
  font-weight: 700;
}

td {
  padding: 0.8rem 1rem;
  border-bottom: 1px solid #e0e0e0;
  color: var(--text-main);
}

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

tr:nth-child(even) {
  background-color: #f9f9f9;
}

/* Badges */
.badge, .status-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 3px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  border: 1px solid transparent;
}

.badge.success, .status-completed { background: #e8f8f5; color: var(--success); border-color: #a3e4d7; }
.badge.warn, .badge.warning, .status-ongoing { background: #fffbeb; color: var(--warning); border-color: #fcd34d; }
.badge.error, .badge.danger, .status-missed { background: #fdedec; color: var(--danger); border-color: #fadbd8; }
.badge.neutral { background: #f3f4f6; color: var(--text-muted); border-color: #e5e7eb; }

/* Alerts / Banners */
.alert, .banner {
  padding: 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.9rem;
  border: 1px solid transparent;
}

.alert-info, .banner.info {
  background: #ebf5fb;
  color: #2980b9;
  border-color: #aed6f1;
}

.alert-success, .banner.success {
  background: #e8f8f5;
  color: #27ae60;
  border-color: #a3e4d7;
}

.alert-warning, .banner.warning {
  background: #fef9e7;
  color: #f39c12;
  border-color: #f9e79f;
}

.alert-error, .banner.error {
  background: #fdedec;
  color: #c0392b;
  border-color: #fadbd8;
}

/* Stepper */
.stepper {
  display: flex;
  background: white;
  padding: 1rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 2rem;
  border: 1px solid #e0e0e0;
  gap: 0; /* Reset gap from old styles */
}

.step {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 0.5rem;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.9rem;
  background: none;
  border: none;
  box-shadow: none;
}

.step:not(:last-child)::after {
  content: '›';
  position: absolute;
  right: -5px;
  font-size: 1.5rem;
  color: #bdc3c7;
}

.step.active {
  color: var(--accent);
  font-weight: 700;
  border: none;
}

.step.done, .step.completed {
  color: var(--success);
  background: none;
  border: none;
}

.step .index, .step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #ecf0f1;
  margin-right: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.step.active .index {
  background: var(--accent);
  color: white;
}

.step.done .index {
  background: var(--success);
  color: white;
}

/* Pricing Grid */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.pricing-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s;
}

.pricing-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.pricing-card.popular {
  border: 2px solid var(--accent);
  box-shadow: 0 4px 12px rgba(52, 152, 219, 0.15);
}

.popular-badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: white;
  padding: 4px 16px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.pricing-header {
  text-align: center;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.plan-name {
  margin: 0 0 0.5rem 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-main);
}

.plan-price {
  display: flex;
  align-items: baseline;
  justify-content: center;
  margin-bottom: 0.5rem;
}

.price-amount {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1;
}

.price-period {
  font-size: 1rem;
  color: var(--text-muted);
  margin-left: 4px;
}

.plan-minutes {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 500;
}

.features-list {
  list-style: none;
  padding: 0;
  margin: 0 0 2rem 0;
  flex-grow: 1;
}

.features-list li {
  padding: 0.8rem 0;
  border-bottom: 1px solid #f3f4f6;
  display: flex;
  align-items: flex-start;
  font-size: 0.9rem;
  color: var(--text-main);
}

.features-list li::before {
  content: "✓";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  margin-right: 0.5rem;
  flex-shrink: 0;
  border-radius: 50%;
  background: #e8f8f5;
  color: var(--success);
  font-weight: 700;
  font-size: 12px;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(44, 62, 80, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 999;
  backdrop-filter: blur(2px);
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
  width: 100%;
  max-width: 560px;
  padding: 2rem;
}

.modal-title {
  margin: 0 0 1.5rem 0;
  font-size: 1.5rem;
  color: var(--primary);
  border-bottom: 1px solid #eee;
  padding-bottom: 1rem;
}

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

/* Utilities */
.sr-only, .visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.stack { display: flex; flex-direction: column; gap: 1rem; }
.hstack { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }

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

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.checkbox-item input[type="checkbox"] {
  width: auto;
  margin: 0;
}

.checkbox-item label {
  margin: 0;
  font-weight: normal;
  cursor: pointer;
}

/* Responsive */
@media (max-width: 768px) {
  .app-container {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
  }
  
  .main-content {
    margin-left: 0;
    width: 100%;
    padding: 1rem;
  }

  .nav-btn {
    display: inline-block;
    width: auto;
    border-left: none;
    border-bottom: 4px solid transparent;
  }

  .nav-btn.active {
    border-left: none;
    border-bottom-color: var(--accent);
  }

  .sidebar nav {
    overflow-x: auto;
    white-space: nowrap;
    padding-bottom: 0;
    display: flex;
  }
  
  .stepper {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .step:not(:last-child)::after {
    display: none;
  }
  
  .form-row {
    flex-direction: column;
    gap: 0;
  }
  
  .pricing-grid {
    grid-template-columns: 1fr;
  }
}

/* Sidebar Profile Button */
.user-profile-btn {
  width: 100%;
  padding: 1.5rem;
  border: none;
  border-top: 1px solid rgba(255,255,255,0.1);
  background: none;
  display: flex;
  align-items: center;
  gap: 1rem;
  cursor: pointer;
  text-align: left;
  color: white;
  transition: background-color 0.2s;
  font-family: inherit;
}

.user-profile-btn:hover {
  background-color: rgba(255,255,255,0.1);
}

.user-profile-btn:focus {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.user-info {
  flex: 1;
  overflow: hidden;
}

.user-name {
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-email {
  font-size: 0.8rem;
  opacity: 0.7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Profile Modal Details */
.value {
  padding: 0.5rem;
  background: #f8f9fa;
  border-radius: 4px;
  border: 1px solid #e0e0e0;
  font-size: 0.95rem;
}

.code-font {
  font-family: monospace;
  font-size: 0.85rem;
  color: #555;
}
