/* ==============================================================================
   PUSAT FILE - Modern, Clean & Responsive CSS
   Khusus untuk lingkungan sekolah (guru & siswa)
   ============================================================================== */

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --primary-border: #bfdbfe;
  
  --bg-body: #f8fafc;
  --bg-card: #ffffff;
  --bg-hover: #f1f5f9;
  
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  
  --border-color: #e2e8f0;
  --border-focus: #3b82f6;
  
  --success: #10b981;
  --success-bg: #ecfdf5;
  --success-border: #a7f3d0;
  
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --danger-border: #fecaca;
  
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.08), 0 2px 4px -2px rgb(0 0 0 / 0.06);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.04);
  
  --transition: all 0.2s ease-in-out;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  padding: 24px 16px;
  -webkit-font-smoothing: antialiased;
}

/* ==============================================================================
   LAYOUT & CONTAINER
   ============================================================================== */

.app-container {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* ==============================================================================
   HEADER
   ============================================================================== */

.app-header {
  text-align: center;
  padding: 16px 0 8px;
}

.app-header .header-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background-color: var(--primary-light);
  color: var(--primary);
  font-size: 0.825rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  margin-bottom: 12px;
  border: 1px solid var(--primary-border);
}

.app-header h1 {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 8px;
}

.app-header p {
  color: var(--text-muted);
  font-size: 1.05rem;
  font-weight: 400;
}

/* ==============================================================================
   CARDS
   ============================================================================== */

.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
  padding: 24px;
  transition: var(--transition);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

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

/* ==============================================================================
   UPLOAD SECTION
   ============================================================================== */

.dropzone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 36px 20px;
  text-align: center;
  background-color: #fafbfd;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.dropzone:hover,
.dropzone.drag-active {
  border-color: var(--primary);
  background-color: var(--primary-light);
  transform: translateY(-1px);
}

.dropzone-icon {
  font-size: 3rem;
  margin-bottom: 12px;
  color: var(--primary);
  display: block;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.dropzone-text {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 4px;
}

.dropzone-subtext {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.file-hint {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-top: 14px;
}

/* Selected File Preview */
.selected-file-card {
  display: none;
  align-items: center;
  justify-content: space-between;
  background-color: var(--primary-light);
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-top: 18px;
  animation: fadeIn 0.3s ease;
}

.selected-file-card.active {
  display: flex;
}

.file-info-group {
  display: flex;
  align-items: center;
  gap: 14px;
  overflow: hidden;
}

.file-icon-badge {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  background: white;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.file-text-details {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.file-selected-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 400px;
}

.file-selected-size {
  font-size: 0.825rem;
  color: var(--text-muted);
}

.btn-remove-file {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.btn-remove-file:hover {
  color: var(--danger);
  background-color: var(--danger-bg);
}

/* Upload Progress */
.progress-container {
  display: none;
  margin-top: 18px;
  animation: fadeIn 0.3s ease;
}

.progress-container.active {
  display: block;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-main);
}

.progress-bar-bg {
  width: 100%;
  height: 10px;
  background-color: var(--border-color);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #3b82f6, #2563eb);
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
  background-size: 20px 20px;
  background-image: linear-gradient(
    45deg,
    rgba(255, 255, 255, 0.15) 25%,
    transparent 25%,
    transparent 50%,
    rgba(255, 255, 255, 0.15) 50%,
    rgba(255, 255, 255, 0.15) 75%,
    transparent 75%,
    transparent
  );
  animation: progressStripes 1s linear infinite;
}

@keyframes progressStripes {
  0% { background-position: 0 0; }
  100% { background-position: 20px 0; }
}

/* Upload Action Controls */
.upload-actions {
  margin-top: 20px;
  display: flex;
  gap: 12px;
}

/* Status Alert Message */
.status-alert {
  display: none;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  margin-top: 16px;
  font-size: 0.95rem;
  font-weight: 600;
  animation: fadeIn 0.3s ease;
}

.status-alert.active {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-alert.success {
  background-color: var(--success-bg);
  border: 1px solid var(--success-border);
  color: #065f46;
}

.status-alert.error {
  background-color: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: #991b1b;
}

/* ==============================================================================
   BUTTONS
   ============================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.btn-primary {
  background-color: var(--primary);
  color: white;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(37, 99, 235, 0.3);
}

.btn-primary:disabled {
  background-color: var(--text-light);
  cursor: not-allowed;
  opacity: 0.6;
  box-shadow: none;
}

.btn-secondary {
  background-color: white;
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
  background-color: var(--bg-hover);
  border-color: #cbd5e1;
}

.btn-outline-primary {
  background-color: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
}

.btn-outline-primary:hover {
  background-color: var(--primary-light);
}

.btn-block {
  width: 100%;
}

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

/* ==============================================================================
   FILE LIST SECTION & TOOLBAR
   ============================================================================== */

.total-badge {
  background-color: var(--bg-hover);
  color: var(--text-main);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
}

.toolbar {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 12px;
  margin-bottom: 20px;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  font-size: 1rem;
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  font-family: inherit;
  font-size: 0.9rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: white;
  color: var(--text-main);
  outline: none;
  transition: var(--transition);
}

.search-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.select-filter {
  padding: 10px 14px;
  font-family: inherit;
  font-size: 0.9rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: white;
  color: var(--text-main);
  outline: none;
  cursor: pointer;
  transition: var(--transition);
}

.select-filter:focus {
  border-color: var(--border-focus);
}

.btn-refresh {
  padding: 10px 16px;
}

.btn-refresh.loading span {
  display: inline-block;
  animation: spin 1s linear infinite;
}

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

/* ==============================================================================
   FILE LIST & CARDS
   ============================================================================== */

.file-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background-color: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: var(--transition);
}

.file-item:hover {
  border-color: #cbd5e1;
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.file-main {
  display: flex;
  align-items: center;
  gap: 16px;
  overflow: hidden;
  flex: 1;
}

.file-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  flex-shrink: 0;
}

/* File Type Badges & Colors */
.type-pdf { background-color: #fee2e2; color: #dc2626; }
.type-doc { background-color: #dbeafe; color: #1d4ed8; }
.type-xls { background-color: #d1fae5; color: #059669; }
.type-ppt { background-color: #ffedd5; color: #ea580c; }
.type-img { background-color: #ede9fe; color: #7c3aed; }
.type-zip { background-color: #f1f5f9; color: #475569; }
.type-default { background-color: #e2e8f0; color: #334155; }

.file-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow: hidden;
}

.file-name {
  font-weight: 600;
  font-size: 0.98rem;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 450px;
}

.file-submeta {
  font-size: 0.825rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.file-submeta .bullet {
  color: var(--text-light);
}

.file-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: 16px;
  flex-shrink: 0;
}

/* ==============================================================================
   EMPTY STATE & LOADING
   ============================================================================== */

.empty-state {
  text-align: center;
  padding: 48px 20px;
  display: none;
}

.empty-state.active {
  display: block;
}

.empty-icon {
  font-size: 3.5rem;
  color: var(--text-light);
  margin-bottom: 12px;
}

.empty-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
}

.empty-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Skeleton Loading */
.skeleton-container {
  display: none;
  flex-direction: column;
  gap: 12px;
}

.skeleton-container.active {
  display: flex;
}

.skeleton-item {
  height: 80px;
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: skeletonLoading 1.5s infinite;
  border-radius: var(--radius-md);
}

@keyframes skeletonLoading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ==============================================================================
   MODAL DIALOG (CONFIRMATION)
   ============================================================================== */

.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 999;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.2s ease;
}

.modal-backdrop.active {
  display: flex;
}

.modal-content {
  background: white;
  border-radius: var(--radius-lg);
  max-width: 440px;
  width: 100%;
  padding: 24px;
  box-shadow: var(--shadow-lg);
  animation: scaleUp 0.2s ease;
}

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

.modal-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-desc {
  font-size: 0.925rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.modal-file-box {
  background-color: var(--bg-body);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

/* ==============================================================================
   TOAST NOTIFICATIONS
   ============================================================================== */

.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-width: 280px;
  max-width: 380px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  background: white;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.9rem;
  font-weight: 500;
  animation: slideInRight 0.3s ease;
  transition: var(--transition);
  border-left: 4px solid var(--primary);
}

.toast.toast-success {
  border-left-color: var(--success);
}

.toast.toast-error {
  border-left-color: var(--danger);
}

.toast.toast-warning {
  border-left-color: var(--warning);
}

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

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ==============================================================================
   RESPONSIVE DESIGN (HP, Tablet, Desktop)
   ============================================================================== */

@media (max-width: 768px) {
  body {
    padding: 16px 12px;
  }

  .app-header h1 {
    font-size: 1.8rem;
  }

  .card {
    padding: 18px 16px;
  }

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

  .search-box {
    grid-column: 1 / -1;
  }

  .btn-refresh {
    grid-column: 1 / -1;
  }

  .file-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    padding: 16px;
  }

  .file-main {
    width: 100%;
  }

  .file-name {
    max-width: 240px;
  }

  .file-actions {
    width: 100%;
    margin-left: 0;
  }

  .file-actions .btn {
    width: 100%;
  }

  .toast-container {
    top: auto;
    bottom: 20px;
    right: 16px;
    left: 16px;
  }

  .toast {
    max-width: 100%;
  }
}

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

  .dropzone {
    padding: 24px 12px;
  }

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

  .file-selected-name {
    max-width: 180px;
  }
}
