/* ==========================================================================
   Super-Me - Professional & Clean Webview Design System
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
  --primary: #1e293b;
  --primary-hover: #0f172a;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-light: #eff6ff;
  --success: #10b981;
  --success-light: #ecfdf5;
  --warning: #f59e0b;
  --warning-light: #fffbeb;
  --danger: #ef4444;
  --danger-light: #fef2f2;
  --bg-main: #f8fafc;
  --card-bg: #ffffff;
  --border-color: #e2e8f0;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --sidebar-width: 250px;
  --header-height: 70px;
}

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

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  font-size: 14px;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* App Header Topbar */
.iam-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 1000;
  box-shadow: var(--shadow-sm);
}

.iam-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.iam-brand img {
  height: 42px;
  width: auto;
  border-radius: var(--radius-sm);
}

.iam-brand-text {
  display: flex;
  flex-direction: column;
}

.iam-brand-title {
  font-size: 18px;
  font-weight: 700;
  color: #990033;
  letter-spacing: -0.5px;
}

.iam-brand-subtitle {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.iam-header-user {
  display: flex;
  align-items: center;
  gap: 16px;
}

.iam-user-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-main);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
}

.iam-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #990033, #e7b15d);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
}

.iam-user-info {
  display: flex;
  flex-direction: column;
}

.iam-user-name {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-main);
}

.iam-user-role {
  font-size: 11px;
  color: var(--text-muted);
}

.btn-logout {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background-color: #fee2e2;
  color: #dc2626;
  border-radius: var(--radius-md);
  text-decoration: none;
  font-weight: 600;
  font-size: 12px;
  transition: all 0.2s ease;
  border: none;
  cursor: pointer;
}

.btn-logout:hover {
  background-color: #fca5a5;
  color: #991b1b;
}

/* App Sidebar Navigation */
.iam-sidebar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: #ffffff;
  border-right: 1px solid var(--border-color);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  z-index: 900;
  overflow-y: auto;
}

.iam-nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.iam-nav-item a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 13px;
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}

.iam-nav-item a i {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

.iam-nav-item a:hover {
  background-color: var(--bg-main);
  color: var(--text-main);
}

.iam-nav-item a.active {
  background-color: #990033;
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 4px 10px rgba(153, 0, 51, 0.25);
}

.iam-nav-item a.active i {
  color: #ffffff;
}

.iam-nav-section {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: #94a3b8;
  padding: 12px 14px 4px;
  letter-spacing: 0.5px;
}

/* Main Content Area */
.iam-main {
  margin-top: var(--header-height);
  margin-left: var(--sidebar-width);
  padding: 28px;
  min-height: calc(100vh - var(--header-height));
  transition: all 0.3s ease;
}

/* Webview Container & Cards */
.iam-container {
  max-width: 1200px;
  margin: 0 auto;
}

.iam-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  margin-bottom: 24px;
  transition: box-shadow 0.2s ease;
}

.iam-card:hover {
  box-shadow: var(--shadow-md);
}

.iam-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-color);
}

.iam-card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 10px;
}

.iam-card-title i {
  color: #990033;
}

/* Metric Stats Grid */
.iam-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.iam-stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.iam-stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: #990033;
}

.iam-stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: var(--accent-light);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.iam-stat-icon.green {
  background: var(--success-light);
  color: var(--success);
}

.iam-stat-icon.amber {
  background: var(--warning-light);
  color: var(--warning);
}

.iam-stat-icon.purple {
  background: #f3e8ff;
  color: #9333ea;
}

.iam-stat-info {
  display: flex;
  flex-direction: column;
}

.iam-stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.iam-stat-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

/* Action Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
}

.btn-primary {
  background-color: #990033;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(153, 0, 51, 0.3);
}

.btn-primary:hover {
  background-color: #7a0029;
  box-shadow: 0 4px 12px rgba(153, 0, 51, 0.4);
}

.btn-secondary {
  background-color: #f1f5f9;
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background-color: #e2e8f0;
}

.btn-success {
  background-color: var(--success);
  color: #ffffff;
}

.btn-success:hover {
  background-color: #059669;
}

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

.btn-outline-primary:hover {
  background: #990033;
  color: #ffffff;
}

/* Forms & Modern Controls */
.iam-form-group {
  margin-bottom: 18px;
}

.iam-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 6px;
}

.iam-input,
.iam-select,
.iam-textarea {
  width: 100%;
  padding: 10px 14px;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--text-main);
  background-color: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}

.iam-input:focus,
.iam-select:focus,
.iam-textarea:focus {
  outline: none;
  border-color: #990033;
  box-shadow: 0 0 0 3px rgba(153, 0, 51, 0.15);
}

.iam-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

/* Badges & Status Chips */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
  line-height: 1.2;
}

.badge-pill {
  border-radius: 9999px;
  padding: 5px 14px;
}

.badge-pending {
  background-color: var(--warning-light);
  color: #b45309;
  border: 1px solid #fde68a;
}

.badge-approved,
.badge-success {
  background-color: var(--success-light);
  color: #047857;
  border: 1px solid #a7f3d0;
}

.badge-rejected,
.badge-danger {
  background-color: var(--danger-light);
  color: #b91c1c;
  border: 1px solid #fecaca;
}

/* Modern Clean Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.iam-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.iam-table th {
  background-color: #f8fafc;
  color: var(--text-muted);
  font-weight: 700;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.iam-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  vertical-align: middle;
}

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

.iam-table tr:hover {
  background-color: #f1f5f9;
}

/* Mobile Webview & Responsive Utilities */
.mobile-nav-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 22px;
  color: var(--text-main);
  cursor: pointer;
}

@media (max-width: 900px) {
  .mobile-nav-toggle {
    display: block;
  }
  
  .iam-sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }

  .iam-sidebar.active {
    transform: translateX(0);
  }

  .iam-main {
    margin-left: 0;
    padding: 16px;
  }

  .iam-header {
    padding: 0 16px;
  }

  .iam-user-name, .iam-user-role {
    display: none;
  }
}

/* Printable SPKL & Slip Styling */
@media print {
  .iam-header, .iam-sidebar, .btn, .no-print {
    display: none !important;
  }

  .iam-main {
    margin: 0 !important;
    padding: 0 !important;
  }

  .iam-card {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
  }
}
