/* ============ RESET & BASE ============ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #f5f7fa;
  color: #2c3e50;
  line-height: 1.6;
}

/* ============ HEADER ============ */
header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 20px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
}

header h1 {
  font-size: 28px;
  margin-bottom: 5px;
}

header p {
  font-size: 14px;
  opacity: 0.9;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 15px;
  background: rgba(255,255,255,0.1);
  padding: 10px 15px;
  border-radius: 8px;
}

.user-info span {
  font-weight: 500;
}

.btn-logout {
  background: rgba(231, 76, 60, 0.9);
  color: white;
  border: none;
  padding: 8px 15px;
  border-radius: 5px;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.3s;
}

.btn-logout:hover {
  background: #c0392b;
  transform: translateY(-2px);
}

/* ============ NAVIGATION ============ */
nav {
  background: white;
  padding: 15px;
  text-align: center;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
  position: sticky;
  top: 0;
  z-index: 100;
}

nav button {
  margin: 5px;
  padding: 10px 20px;
  border: none;
  background: #667eea;
  color: white;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.3s;
  font-weight: 500;
  font-size: 14px;
}

nav button:hover {
  background: #5568d3;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

/* ============ MAIN CONTENT ============ */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

.page {
  display: none;
  animation: fadeIn 0.3s ease-in;
}

.page.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============ CARDS ============ */
.card {
  background: white;
  padding: 25px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  margin-bottom: 20px;
}

.card h2 {
  margin-bottom: 20px;
  color: #2c3e50;
  font-size: 22px;
  border-bottom: 3px solid #667eea;
  padding-bottom: 10px;
}

/* ============ DASHBOARD STATS ============ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

.stat-card {
  background: white;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  display: flex;
  align-items: center;
  gap: 15px;
  transition: all 0.3s;
}

.stat-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(0,0,0,0.15);
}

.stat-icon {
  font-size: 40px;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 12px;
}

.stat-info h3 {
  font-size: 32px;
  color: #2c3e50;
  margin-bottom: 5px;
}

.stat-info p {
  color: #7f8c8d;
  font-size: 14px;
}

/* ============ CHART ============ */
.chart-bars {
  padding: 20px 0;
}

.chart-bar-item {
  margin-bottom: 15px;
}

.chart-label {
  font-weight: 500;
  margin-bottom: 5px;
  color: #2c3e50;
}

.chart-bar-container {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chart-bar {
  height: 30px;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
  border-radius: 5px;
  transition: width 0.5s ease;
}

.chart-value {
  font-weight: bold;
  color: #667eea;
  min-width: 40px;
}

/* ============ FORMS ============ */
.form {
  margin-bottom: 20px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

input, select {
  padding: 10px 15px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 14px;
  transition: all 0.3s;
  flex: 1;
  min-width: 150px;
}

input:focus, select:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

input[type="date"] {
  min-width: 150px;
}

input[type="time"] {
  min-width: 120px;
}

input[type="number"] {
  min-width: 100px;
}

button {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s;
  font-weight: 600;
  font-size: 14px;
  background: #667eea;
  color: white;
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

button:active {
  transform: translateY(0);
}

.btn-primary {
  background: #3498db;
  color: white;
  padding: 8px 15px;
  font-size: 13px;
  margin-right: 5px;
}

.btn-primary:hover {
  background: #2980b9;
}

.btn-delete {
  background: #e74c3c;
  color: white;
  padding: 8px 15px;
  font-size: 13px;
}

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

/* ============ SEARCH & FILTER ============ */
.search-box, .filter-box {
  margin-bottom: 20px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.search-box input, .filter-box input {
  flex: 1;
  min-width: 250px;
}

.filter-box select {
  min-width: 150px;
}

/* ============ TABLES ============ */
.table-container {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 15px;
  background: white;
}

th, td {
  border: 1px solid #e0e0e0;
  padding: 12px;
  text-align: left;
}

th {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  font-weight: 600;
  color: white;
  position: sticky;
  top: 0;
}

tr:hover {
  background: #f8f9fa;
}

td {
  color: #2c3e50;
}

/* ============ STATUS BADGES ============ */
.status-badge {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
}

.status-badge.dipinjam {
  background: #fee;
  color: #e74c3c;
}

.status-badge.kembali {
  background: #d5f4e6;
  color: #27ae60;
}

.stok-rendah {
  color: #e74c3c;
  font-weight: bold;
}

/* ============ REPORT ============ */
.report-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.report-buttons button {
  flex: 1;
  min-width: 200px;
}

.report-preview {
  margin-top: 20px;
  padding: 20px;
  background: #f8f9fa;
  border-radius: 8px;
  min-height: 100px;
}

/* ============ LOADING ============ */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 5px solid #f3f3f3;
  border-top: 5px solid #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ============ ANIMATIONS ============ */
@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
  header h1 {
    font-size: 22px;
  }
  
  .header-content {
    flex-direction: column;
    text-align: center;
  }
  
  nav button {
    padding: 8px 12px;
    font-size: 12px;
    margin: 3px;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  .form {
    flex-direction: column;
  }
  
  input, select, button {
    width: 100%;
  }
  
  .search-box input, .filter-box input, .filter-box select {
    width: 100%;
    min-width: 100%;
  }
  
  table {
    font-size: 12px;
  }
  
  th, td {
    padding: 8px;
  }
  
  .btn-primary, .btn-delete {
    padding: 6px 10px;
    font-size: 11px;
  }
  
  .report-buttons {
    flex-direction: column;
  }
  
  .report-buttons button {
    width: 100%;
  }
}

@media (max-width: 480px) {
  main {
    padding: 10px;
  }
  
  .card {
    padding: 15px;
  }
  
  .stat-card {
    padding: 15px;
  }
  
  .stat-icon {
    font-size: 30px;
    width: 50px;
    height: 50px;
  }
  
  .stat-info h3 {
    font-size: 24px;
  }
}

/* ============ PRINT STYLES ============ */
@media print {
  nav, .btn-logout, button, .search-box, .filter-box, .form {
    display: none !important;
  }
  
  body {
    background: white;
  }
  
  .card {
    box-shadow: none;
    page-break-inside: avoid;
  }
}

/* ============ INFO SECTION (USER DASHBOARD) ============ */
.info-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.announcement-card, .info-card, .tips-card {
  background: white;
  border-radius: 12px;
  padding: 25px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
  transition: transform 0.3s, box-shadow 0.3s;
}

.announcement-card:hover, .info-card:hover, .tips-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 20px rgba(0,0,0,0.12);
}

.announcement-card h3, .info-card h3, .tips-card h3 {
  color: #667eea;
  margin-bottom: 15px;
  font-size: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.announcement-item {
  background: linear-gradient(135deg, #f5f7fa 0%, #e8ecf1 100%);
  padding: 20px;
  border-radius: 8px;
  border-left: 4px solid #667eea;
}

.announcement-item h4 {
  color: #2c3e50;
  margin-bottom: 10px;
  font-size: 18px;
}

.announcement-item p {
  color: #555;
  margin-bottom: 10px;
  line-height: 1.6;
}

.announcement-item small {
  color: #7f8c8d;
  font-style: italic;
  display: block;
  margin-top: 10px;
}

.info-list {
  list-style: none;
  padding: 0;
}

.info-list li {
  padding: 10px 0;
  border-bottom: 1px solid #e0e0e0;
  color: #555;
}

.info-list li:last-child {
  border-bottom: none;
}

.info-list li strong {
  color: #667eea;
  font-weight: 600;
}

/* ============ UTILITY CLASSES ============ */
.text-center {
  text-align: center;
}

.mt-20 {
  margin-top: 20px;
}

.mb-20 {
  margin-bottom: 20px;
}

.hidden {
  display: none !important;
}

/* ============ SCROLLBAR ============ */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

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

::-webkit-scrollbar-thumb {
  background: #667eea;
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: #5568d3;
}

.info-list {
  list-style: none;
  padding: 0;
}

.info-list li {
  padding: 12px 0;
  border-bottom: 1px solid #ecf0f1;
  color: #555;
  line-height: 1.6;
}

.info-list li:last-child {
  border-bottom: none;
}

.info-list li strong {
  color: #667eea;
  font-weight: 600;
}

@media (max-width: 768px) {
  .info-section {
    grid-template-columns: 1fr;
  }
  
  .announcement-card, .info-card, .tips-card {
    padding: 20px;
  }
}
