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

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background-color: #f5f5f5;
  color: #333;
}

/* Header */
.header {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: white;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-left i {
  font-size: 2rem;
}

.header-left h1 {
  font-size: 1.5rem;
  font-weight: 600;
}

.header-left p {
  font-size: 0.9rem;
  opacity: 0.9;
}

.header-right {
  font-size: 0.9rem;
}

/* Navigation */
.nav {
  background: white;
  padding: 0 2rem;
  display: flex;
  gap: 0.5rem;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.nav-btn {
  background: none;
  border: none;
  padding: 1rem 1.5rem;
  cursor: pointer;
  font-size: 0.9rem;
  color: #666;
  border-bottom: 3px solid transparent;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-btn:hover {
  color: #2563eb;
  background-color: #f8fafc;
}

.nav-btn.active {
  color: #2563eb;
  border-bottom-color: #2563eb;
  background-color: #f8fafc;
}

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

.page {
  display: none;
}

.page.active {
  display: block;
}

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

.stat-card {
  background: white;
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
}

.stat-card.blue::before {
  background: #2563eb;
}
.stat-card.green::before {
  background: #059669;
}
.stat-card.cyan::before {
  background: #0891b2;
}
.stat-card.orange::before {
  background: #ea580c;
}

.stat-content h3 {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 0.5rem;
}

.stat-number {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.stat-card.blue .stat-number {
  color: #2563eb;
}
.stat-card.green .stat-number {
  color: #059669;
}
.stat-card.cyan .stat-number {
  color: #0891b2;
}
.stat-card.orange .stat-number {
  color: #ea580c;
}

.stat-content p {
  font-size: 0.8rem;
  color: #888;
}

.stat-card i {
  font-size: 3rem;
  opacity: 0.1;
}

/* Page Header */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.page-header h2 {
  font-size: 1.8rem;
  color: #1f2937;
  margin-bottom: 0.25rem;
}

.page-header p {
  color: #666;
  font-size: 0.9rem;
}

/* Buttons */
.btn-primary {
  background: #2563eb;
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.3s ease;
}

.btn-primary:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
}

.btn-secondary {
  background: #6b7280;
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.3s ease;
}

.btn-secondary:hover {
  background: #4b5563;
}

.btn-edit {
  background: #3b82f6;
  color: white;
  border: none;
  padding: 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  margin-right: 0.5rem;
  transition: all 0.3s ease;
}

.btn-edit:hover {
  background: #2563eb;
}

.btn-delete {
  background: #ef4444;
  color: white;
  border: none;
  padding: 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-delete:hover {
  background: #dc2626;
}

.btn-success {
  background: #10b981;
  color: white;
  border: none;
  padding: 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  margin-right: 0.5rem;
  transition: all 0.3s ease;
}

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

.btn-info {
  background: #06b6d4;
  color: white;
  border: none;
  padding: 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-info:hover {
  background: #0891b2;
}

/* Search */
.search-container {
  margin-bottom: 1.5rem;
}

.search-box {
  position: relative;
  max-width: 400px;
}

.search-box i {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: #666;
}

.search-box input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 3rem;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 0.9rem;
  transition: all 0.3s ease;
}

.search-box input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Tables */
.table-container {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

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

.data-table th {
  background: #f8fafc;
  padding: 1rem;
  text-align: left;
  font-weight: 600;
  color: #374151;
  border-bottom: 1px solid #e5e7eb;
}

.data-table td {
  padding: 1rem;
  border-bottom: 1px solid #f3f4f6;
}

.data-table tr:hover {
  background: #f9fafb;
}

/* Status Badges */
.status-badge {
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
}

.status-badge.active {
  background: #dbeafe;
  color: #1d4ed8;
}

.status-badge.rented {
  background: #fef3c7;
  color: #d97706;
}

.status-badge.available {
  background: #d1fae5;
  color: #065f46;
}

/* Recent Section */
.recent-section {
  background: white;
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.recent-section h2 {
  margin-bottom: 1.5rem;
  color: #1f2937;
}

/* Report Filters */
.report-filters {
  background: white;
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  margin-bottom: 2rem;
  display: flex;
  gap: 2rem;
  align-items: end;
  flex-wrap: wrap;
}

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

.filter-group label {
  font-weight: 500;
  color: #374151;
  font-size: 0.9rem;
}

.filter-group select,
.filter-group input {
  padding: 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 0.9rem;
  min-width: 150px;
}

.filter-group select:focus,
.filter-group input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Report Preview */
.report-preview {
  background: white;
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.report-preview h3 {
  margin-bottom: 1.5rem;
  color: #1f2937;
}

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

.summary-item {
  padding: 1rem;
  background: #f8fafc;
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.summary-item span {
  color: #666;
  font-size: 0.9rem;
}

.summary-item strong {
  color: #1f2937;
  font-weight: 600;
}

/* Modals - PERBAIKAN UTAMA */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  overflow-y: auto; /* Tambah scroll untuk modal */
  padding: 20px 0; /* Tambah padding atas bawah */
}

.modal-content {
  background-color: white;
  margin: 0 auto; /* Ubah margin untuk centering */
  padding: 0;
  border-radius: 12px;
  width: 90%;
  max-width: 500px;
  max-height: calc(100vh - 40px); /* Batasi tinggi maksimal */
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  animation: modalSlideIn 0.3s ease;
  display: flex;
  flex-direction: column;
  position: relative;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-50px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-header {
  padding: 1.5rem 2rem;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0; /* Prevent header from shrinking */
}

.modal-header h3 {
  color: #1f2937;
  font-size: 1.25rem;
}

.close {
  color: #9ca3af;
  font-size: 1.5rem;
  font-weight: bold;
  cursor: pointer;
  transition: color 0.3s ease;
}

.close:hover {
  color: #374151;
}

/* Forms - PERBAIKAN SCROLL */
form {
  padding: 2rem;
  overflow-y: auto; /* Tambah scroll untuk form */
  flex: 1; /* Allow form to grow and shrink */
  max-height: calc(100vh - 200px); /* Batasi tinggi form */
}

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

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

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 0.9rem;
  transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid #e5e7eb;
  flex-shrink: 0; /* Prevent actions from shrinking */
  background: white; /* Ensure background is white */
  position: sticky; /* Make it stick to bottom */
  bottom: 0;
  margin-left: -2rem;
  margin-right: -2rem;
  padding-left: 2rem;
  padding-right: 2rem;
}

/* Responsive */
@media (max-width: 768px) {
  .header {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }

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

  .main {
    padding: 1rem;
  }

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

  .page-header {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }

  .report-filters {
    flex-direction: column;
    align-items: stretch;
  }

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

  .data-table {
    min-width: 800px;
  }

  .modal {
    padding: 10px 0; /* Kurangi padding di mobile */
  }

  .modal-content {
    width: 95%;
    max-height: calc(100vh - 20px); /* Adjust for mobile */
  }

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

@media (max-width: 480px) {
  .header-left h1 {
    font-size: 1.2rem;
  }

  .header-left p {
    font-size: 0.8rem;
  }

  .nav-btn {
    padding: 0.75rem 1rem;
    font-size: 0.8rem;
  }

  .stat-card {
    padding: 1.5rem;
  }

  .stat-number {
    font-size: 1.5rem;
  }

  .modal {
    padding: 5px 0; /* Minimal padding di mobile kecil */
  }

  .modal-content {
    width: 98%;
    max-height: calc(100vh - 10px);
  }

  form {
    padding: 1.5rem;
    max-height: calc(100vh - 150px); /* Adjust for smaller screens */
  }

  .form-actions {
    margin-left: -1.5rem;
    margin-right: -1.5rem;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}

/* Additional scroll styling */
form::-webkit-scrollbar {
  width: 6px;
}

form::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

form::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

form::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

.modal::-webkit-scrollbar {
  width: 8px;
}

.modal::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
}

.modal::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 4px;
}

.modal::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.5);
}
