/* CSS Variables untuk Theme Modern */
:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --secondary: #8b5cf6;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --dark: #1e293b;
  --light: #f8fafc;
  --gray: #64748b;
  --gray-light: #e2e8f0;
  
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --radius: 12px;
  --radius-sm: 8px;
}

/* Reset dan Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  color: var(--dark);
  line-height: 1.6;
}

/* Loading Screen */
.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  color: white;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top: 4px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

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

.hidden {
  display: none !important;
}

/* Main App Container */
.app-container {
  min-height: 100vh;
  background: var(--light);
}

/* Header */
.app-header {
  background: white;
  padding: 1rem;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.app-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
}

.menu-btn, .close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  transition: background 0.3s;
}

.menu-btn:hover, .close-btn:hover {
  background: var(--gray-light);
}

/* Side Menu */
.side-menu {
  position: fixed;
  top: 0;
  left: -280px;
  width: 280px;
  height: 100%;
  background: white;
  box-shadow: var(--shadow-lg);
  transition: left 0.3s ease;
  z-index: 1000;
}

.side-menu.active {
  left: 0;
}

.menu-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--gray-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.menu-items {
  padding: 1rem 0;
}

.menu-item {
  display: flex;
  align-items: center;
  padding: 1rem 1.5rem;
  text-decoration: none;
  color: var(--dark);
  transition: background 0.3s;
  border-left: 4px solid transparent;
}

.menu-item.active {
  background: #f1f5f9;
  border-left-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
}

.menu-item:hover {
  background: #f8fafc;
}

.menu-icon {
  margin-right: 1rem;
  font-size: 1.25rem;
}

/* Main Content */
.main-content {
  padding: 1rem;
  max-width: 100%;
  margin: 0 auto;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

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

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

.stat-card {
  background: white;
  padding: 1.5rem 1rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  transition: transform 0.3s;
}

.stat-card:hover {
  transform: translateY(-2px);
}

.stat-icon {
  font-size: 2rem;
  margin-right: 1rem;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--dark);
}

.stat-label {
  font-size: 0.875rem;
  color: var(--gray);
}

/* Quick Actions */
.section-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--dark);
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.action-btn {
  background: white;
  border: 2px solid var(--gray-light);
  padding: 1.5rem 1rem;
  border-radius: var(--radius);
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.action-btn:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.action-icon {
  font-size: 1.5rem;
}

/* Forms */
.form-container {
  background: white;
  padding: 1.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 2rem;
}

.form-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  text-align: center;
}

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

.input-label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--dark);
}

.input-field {
  width: 100%;
  padding: 1rem;
  border: 2px solid var(--gray-light);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  transition: border-color 0.3s;
}

.input-field:focus {
  outline: none;
  border-color: var(--primary);
}

/* Buttons */
.btn {
  padding: 1rem 1.5rem;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  text-decoration: none;
}

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

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.btn-secondary {
  background: var(--gray-light);
  color: var(--dark);
}

.btn-warning {
  background: var(--warning);
  color: white;
}

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

.btn-large {
  width: 100%;
  padding: 1.25rem;
  font-size: 1.125rem;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

/* HPP Section */
.hpp-section {
  background: #fef3c7;
  border: 2px solid #f59e0b;
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.hpp-title {
  color: #92400e;
  margin-bottom: 1rem;
  font-size: 1.125rem;
}

.hpp-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.hpp-item {
  background: white;
  padding: 1rem;
  border-radius: var(--radius-sm);
  border-left: 4px solid var(--warning);
}

.hpp-item-header {
  display: flex;
  justify-content: between;
  align-items: start;
  margin-bottom: 0.5rem;
}

.hpp-item-info {
  flex: 1;
}

.hpp-item-plu {
  font-weight: 600;
  color: var(--dark);
}

.hpp-item-desc {
  font-size: 0.875rem;
  color: var(--gray);
}

.hpp-input {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid var(--gray-light);
  border-radius: var(--radius-sm);
  font-size: 1rem;
}

/* Activity List */
.activity-list, .history-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.activity-item, .history-item {
  background: white;
  padding: 1rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border-left: 4px solid var(--primary);
}

.activity-header, .history-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 0.5rem;
}

.activity-title, .history-title {
  font-weight: 600;
  color: var(--dark);
}

.activity-time, .history-time {
  font-size: 0.875rem;
  color: var(--gray);
}

.activity-details, .history-details {
  display: flex;
  gap: 1rem;
  font-size: 0.875rem;
  color: var(--gray);
}

/* Empty States */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--gray);
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--dark);
  color: white;
  padding: 1rem 1.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  max-width: 90%;
  text-align: center;
}

.toast.success {
  background: var(--success);
}

.toast.error {
  background: var(--danger);
}

.toast.warning {
  background: var(--warning);
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: 1rem;
}

.modal-content {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
}

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

.modal-body {
  padding: 1.5rem;
}

/* Status Badges */
.status-badge {
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 600;
}

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

.status-badge.offline {
  background: #fee2e2;
  color: #991b1b;
}

/* Settings */
.settings-container {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.setting-group {
  background: white;
  padding: 1.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.setting-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--dark);
}

.status-item, .info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--gray-light);
}

/* Responsive Design */
@media (max-width: 480px) {
  .main-content {
    padding: 0.75rem;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  .action-grid {
    grid-template-columns: 1fr;
  }
  
  .form-container {
    padding: 1rem;
  }
  
  .activity-details, .history-details {
    flex-direction: column;
    gap: 0.5rem;
  }
}

@media (min-width: 768px) {
  .main-content {
    max-width: 600px;
  }
  
  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  :root {
    --light: #1e293b;
    --dark: #f8fafc;
    --gray: #94a3b8;
    --gray-light: #334155;
  }
  
  body {
    background: linear-gradient(135deg, #4c51bf 0%, #6b46c1 100%);
  }
  
  .app-header,
  .side-menu,
  .stat-card,
  .action-btn,
  .form-container,
  .setting-group,
  .activity-item,
  .history-item {
    background: #334155;
    color: var(--dark);
  }
  
  .input-field {
    background: #475569;
    border-color: #64748b;
    color: var(--dark);
  }
}

/* Animation for modern feel */
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.app-container {
  animation: slideUp 0.5s ease;
}
