/* Reset dan base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  padding: 20px;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  background: white;
  border-radius: 15px;
  padding: 30px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.1);
}

h1 {
  text-align: center;
  color: #333;
  margin-bottom: 30px;
  font-size: 2.5em;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

/* Form styles */
form {
  background: #f8f9fa;
  padding: 25px;
  border-radius: 10px;
  margin-bottom: 30px;
  border: 2px solid #e9ecef;
}

form input {
  width: 100%;
  padding: 12px 15px;
  margin: 8px 0;
  border: 2px solid #ddd;
  border-radius: 8px;
  font-size: 16px;
  transition: all 0.3s ease;
}

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

form input.error {
  border-color: #dc3545;
  box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

form input.success {
  border-color: #28a745;
  box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.1);
}

form button {
  background: linear-gradient(45deg, #667eea, #764ba2);
  color: white;
  padding: 12px 25px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  transition: all 0.3s ease;
  width: 100%;
  margin-top: 10px;
}

form button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

form button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

form button:disabled:hover {
  transform: none;
  box-shadow: none;
}

/* Error dan success messages */
.error-message {
  background: #f8d7da;
  color: #721c24;
  padding: 15px;
  border-radius: 8px;
  margin: 15px 0;
  border: 1px solid #f5c6cb;
  text-align: center;
  font-weight: 500;
}

.success-message {
  background: #d4edda;
  color: #155724;
  padding: 15px;
  border-radius: 8px;
  margin: 15px 0;
  border: 1px solid #c3e6cb;
  text-align: center;
  font-weight: 500;
}

.no-data {
  text-align: center;
  padding: 40px;
  color: #6c757d;
  font-size: 18px;
  background: #f8f9fa;
  border-radius: 10px;
  border: 2px dashed #dee2e6;
}

/* Data list styles */
#dataList {
  display: grid;
  gap: 20px;
}

.item {
  background: white;
  border: 2px solid #e9ecef;
  border-radius: 12px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 20px;
  transition: all 0.3s ease;
  box-shadow: 0 5px 15px rgba(0,0,0,0.08);
}

.item:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 25px rgba(0,0,0,0.15);
  border-color: #667eea;
}

.item img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid #667eea;
}

.item div:first-of-type {
  flex: 1;
  font-size: 18px;
  font-weight: 600;
  color: #333;
}

.item div:last-of-type {
  display: flex;
  gap: 10px;
}

.edit-btn, .delete-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
}

.edit-btn {
  background: #ffc107;
  color: #212529;
}

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

.delete-btn {
  background: #dc3545;
  color: white;
}

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

/* Modal styles */
.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(5px);
}

.modal-content {
  background-color: white;
  margin: 5% auto;
  padding: 30px;
  border-radius: 15px;
  width: 90%;
  max-width: 500px;
  position: relative;
  box-shadow: 0 25px 50px rgba(0,0,0,0.25);
  animation: modalSlideIn 0.3s ease-out;
}

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

.close {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  position: absolute;
  top: 15px;
  right: 20px;
  transition: color 0.3s ease;
}

.close:hover {
  color: #333;
}

#currentImage {
  margin: 15px 0;
  text-align: center;
}

#currentImage img {
  max-width: 200px;
  max-height: 200px;
  border-radius: 10px;
  border: 3px solid #667eea;
}

/* Loading states */
.loading {
  opacity: 0.6;
  pointer-events: none;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid #f3f3f3;
  border-top: 2px solid #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Responsive design */
@media (max-width: 768px) {
  .container {
    padding: 20px;
    margin: 10px;
  }
  
  h1 {
    font-size: 2em;
  }
  
  .item {
    flex-direction: column;
    text-align: center;
    gap: 15px;
  }
  
  .item div:last-of-type {
    justify-content: center;
  }
  
  .modal-content {
    width: 95%;
    margin: 10% auto;
    padding: 20px;
  }
}

/* Input validation feedback */
.input-group {
  position: relative;
  margin: 8px 0;
}

.input-group .validation-message {
  position: absolute;
  bottom: -20px;
  left: 0;
  font-size: 12px;
  color: #dc3545;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.input-group input.error + .validation-message {
  opacity: 1;
}

.input-group input.success + .validation-message {
  color: #28a745;
  opacity: 1;
}

/* File input styling */
input[type="file"] {
  padding: 10px;
  border: 2px dashed #ddd;
  background: #f8f9fa;
  cursor: pointer;
}

input[type="file"]:hover {
  border-color: #667eea;
  background: #f0f2ff;
}

input[type="file"]::-webkit-file-upload-button {
  background: #667eea;
  color: white;
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  margin-right: 10px;
}

/* Alert styling */
.alert {
  padding: 15px;
  margin: 15px 0;
  border-radius: 8px;
  border-left: 4px solid;
  font-weight: 500;
}

.alert-info {
  background: #d1ecf1;
  color: #0c5460;
  border-left-color: #17a2b8;
}

.alert-warning {
  background: #fff3cd;
  color: #856404;
  border-left-color: #ffc107;
}

.alert-danger {
  background: #f8d7da;
  color: #721c24;
  border-left-color: #dc3545;
}

.alert-success {
  background: #d4edda;
  color: #155724;
  border-left-color: #28a745;
}

/* Notifikasi styling */
.error-notification,
.success-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 15px 20px;
  border-radius: 8px;
  color: white;
  font-weight: bold;
  z-index: 10000;
  animation: slideIn 0.3s ease-out;
  max-width: 400px;
  word-wrap: break-word;
  box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.error-notification {
  background-color: #dc3545;
  border-left: 4px solid #c82333;
}

.success-notification {
  background-color: #28a745;
  border-left: 4px solid #1e7e34;
}

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