/* ==========================================================================
   SISTEM INFORMASI KOPERASI TERPADU - MINIMALIST MODERN WHITE THEME
   ========================================================================== */

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

:root {
  --bg-body: #f8fafc;
  --bg-card: #ffffff;
  --bg-sidebar: #ffffff;
  --bg-sidebar-hover: #f1f5f9;
  --bg-sidebar-active: #eff6ff;
  
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #dbeafe;
  --primary-dark: #1e40af;
  
  --success: #10b981;
  --success-light: #d1fae5;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --danger: #ef4444;
  --danger-light: #fee2e2;
  --info: #0ea5e9;
  --info-light: #e0f2fe;
  
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.04), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.5;
  font-size: 14px;
  overflow-x: hidden;
}

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

/* Sidebar */
.app-sidebar {
  width: 260px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  transition: var(--transition);
}

.sidebar-header {
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-light);
}

.brand-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.brand-text h2 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.3px;
  line-height: 1.2;
}

.brand-text p {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

.sidebar-menu {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
}

.menu-category {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 700;
  color: var(--text-light);
  padding: 12px 14px 6px;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 13.5px;
  transition: var(--transition);
  margin-bottom: 3px;
}

.menu-item i {
  font-size: 18px;
  color: var(--text-light);
  transition: var(--transition);
}

.menu-item:hover {
  background-color: var(--bg-sidebar-hover);
  color: var(--primary);
}

.menu-item:hover i {
  color: var(--primary);
}

.menu-item.active {
  background-color: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

.menu-item.active i {
  color: var(--primary);
}

.menu-badge {
  margin-left: auto;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border-light);
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  background-color: var(--bg-body);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background-color: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

/* Main Content Area */
.app-main {
  flex: 1;
  margin-left: 260px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Navbar */
.app-navbar {
  height: 68px;
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 90;
}

.navbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.page-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.content-body {
  padding: 28px 30px;
  flex: 1;
}

/* ----------------- UI Components ----------------- */

/* Cards */
.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
  transition: var(--transition);
}

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

.card-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.card-body {
  padding: 24px;
}

.card-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--border-light);
  background-color: var(--bg-body);
  border-bottom-left-radius: var(--radius-lg);
  border-bottom-right-radius: var(--radius-lg);
}

/* Stat Metric Cards */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.stat-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

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

.stat-info h3 {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.stat-info .stat-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.5px;
}

.stat-info .stat-desc {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 4px;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.stat-icon.primary { background-color: var(--primary-light); color: var(--primary); }
.stat-icon.success { background-color: var(--success-light); color: var(--success); }
.stat-icon.warning { background-color: var(--warning-light); color: var(--warning); }
.stat-icon.danger { background-color: var(--danger-light); color: var(--danger); }
.stat-icon.info { background-color: var(--info-light); color: var(--info); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  font-size: 13.5px;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  line-height: 1.2;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 12px 24px;
  font-size: 15px;
}

.btn-primary {
  background-color: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  background-color: var(--primary-hover);
  color: #fff;
}

.btn-success {
  background-color: var(--success);
  color: #fff;
}
.btn-success:hover {
  background-color: #059669;
  color: #fff;
}

.btn-danger {
  background-color: var(--danger);
  color: #fff;
}
.btn-danger:hover {
  background-color: #dc2626;
  color: #fff;
}

.btn-warning {
  background-color: var(--warning);
  color: #fff;
}
.btn-warning:hover {
  background-color: #d97706;
  color: #fff;
}

.btn-outline {
  background-color: transparent;
  border-color: var(--border);
  color: var(--text-main);
}
.btn-outline:hover {
  background-color: var(--bg-sidebar-hover);
  border-color: var(--text-light);
}

.btn-light {
  background-color: var(--bg-sidebar-hover);
  color: var(--text-main);
}
.btn-light:hover {
  background-color: var(--border);
}

/* Badges & Status Pills */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: 999px;
  text-transform: capitalize;
}

.badge-primary { background-color: var(--primary-light); color: var(--primary); }
.badge-success { background-color: var(--success-light); color: #047857; }
.badge-warning { background-color: var(--warning-light); color: #b45309; }
.badge-danger { background-color: var(--danger-light); color: #b91c1c; }
.badge-info { background-color: var(--info-light); color: #0369a1; }
.badge-secondary { background-color: #f1f5f9; color: #475569; }

/* Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

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

.table th {
  background-color: var(--bg-body);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

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

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

/* Forms */
.form-group {
  margin-bottom: 18px;
}

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

.form-control, .form-select {
  width: 100%;
  padding: 10px 14px;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--text-main);
  background-color: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: var(--transition);
  outline: none;
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.form-row {
  display: flex;
  gap: 16px;
}

.form-col {
  flex: 1;
}

/* Member Avatar Upload Preview */
.avatar-upload {
  position: relative;
  width: 120px;
  height: 120px;
  margin: 0 auto 16px;
}

.avatar-preview {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 3px solid var(--border);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-color: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.avatar-edit {
  position: absolute;
  right: 0;
  bottom: 0;
  z-index: 1;
}

.avatar-edit input {
  display: none;
}

.avatar-edit label {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin-bottom: 0;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  border: 2px solid #fff;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
}

.avatar-edit label:hover {
  background: var(--primary-hover);
}

/* Alerts */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  font-size: 13.5px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 12px;
}

.alert-success { background-color: var(--success-light); color: #065f46; border: 1px solid #a7f3d0; }
.alert-error, .alert-danger { background-color: var(--danger-light); color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background-color: var(--warning-light); color: #92400e; border: 1px solid #fde68a; }
.alert-info { background-color: var(--info-light); color: #075985; border: 1px solid #bae6fd; }

/* Printable Member Card */
.member-card-wrapper {
  width: 340px;
  height: 215px;
  background: linear-gradient(135deg, #1e3a8a, #2563eb, #3b82f6);
  border-radius: 16px;
  padding: 20px;
  color: #fff;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 25px rgba(37, 99, 235, 0.35);
  font-family: 'Plus Jakarta Sans', sans-serif;
}

.member-card-wrapper::before {
  content: '';
  position: absolute;
  top: -50px;
  right: -50px;
  width: 150px;
  height: 150px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
}

.member-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  padding-bottom: 10px;
  margin-bottom: 12px;
}

.member-card-body {
  display: flex;
  gap: 16px;
  align-items: center;
}

.member-card-photo {
  width: 70px;
  height: 85px;
  border-radius: 8px;
  border: 2px solid #fff;
  object-fit: cover;
  background: #fff;
}

.member-card-details h4 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 4px;
}

.member-card-details p {
  font-size: 11px;
  opacity: 0.9;
  line-height: 1.4;
}

/* Modals */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  z-index: 999;
  align-items: center;
  justify-content: center;
}

.modal.show {
  display: flex;
}

.modal-dialog {
  background: #fff;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 550px;
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  animation: modalFadeIn 0.2s ease-out;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-body {
  padding: 24px;
  max-height: 75vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-light);
  background: var(--bg-body);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Responsive */
@media (max-width: 992px) {
  .app-sidebar {
    transform: translateX(-100%);
  }
  .app-sidebar.open {
    transform: translateX(0);
  }
  .app-main {
    margin-left: 0;
  }
}
