@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

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

/* ===== LIGHT MODE (DEFAULT) ===== */
:root {
  --bg-base: linear-gradient(135deg, #f0f4f8 0%, #e2e8f0 100%);
  --wave1: rgba(154, 198, 229, 0.4);
  --wave2: rgba(154, 198, 229, 0.25);
  --wave3: rgba(154, 198, 229, 0.1);
  
  --surface: rgba(255, 255, 255, 0.7);
  --surface-hover: rgba(255, 255, 255, 0.9);
  --border: rgba(200, 214, 229, 0.5);
  
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #475569;
  
  --input-bg: #ffffff;
  --input-border: #cbd5e1;
  
  --shadow-glow: 0 8px 32px rgba(30, 41, 59, 0.08);
  --shadow-card: 0 4px 16px rgba(30, 41, 59, 0.04);
  --btn-secondary-bg: rgba(255, 255, 255, 0.5);
  
  --link-color: #4f46e5;
  --link-hover: #4338ca;
}

/* ===== DARK MODE ===== */
[data-theme="dark"] {
  --bg-base: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  --wave1: rgba(56, 189, 248, 0.15);
  --wave2: rgba(56, 189, 248, 0.08);
  --wave3: rgba(56, 189, 248, 0.03);
  
  --surface: rgba(30, 41, 59, 0.7);
  --surface-hover: rgba(51, 65, 85, 0.8);
  --border: rgba(71, 85, 105, 0.6);
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #cbd5e1;
  
  --input-bg: rgba(15, 23, 42, 0.6);
  --input-border: rgba(71, 85, 105, 0.6);
  
  --shadow-glow: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-card: 0 4px 16px rgba(0, 0, 0, 0.2);
  --btn-secondary-bg: rgba(30, 41, 59, 0.6);
  
  /* Bright purple/blue for high contrast in dark mode */
  --link-color: #a78bfa; 
  --link-hover: #c4b5fd;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg-base);
  background-attachment: fixed;
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  padding: 32px 20px;
  -webkit-font-smoothing: antialiased;
  position: relative;
  overflow-x: hidden;
  transition: background 0.3s ease, color 0.3s ease;
}

/* ===== THEME TOGGLE ===== */
.theme-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-card);
  transition: all 0.2s ease;
  z-index: 10;
}
.theme-btn:hover {
  transform: scale(1.05);
  background: var(--surface-hover);
}

/* ===== WAVE BACKGROUND ===== */
.wave-container {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.waves {
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 40vh;
  min-height: 250px;
}

.wave1 { fill: var(--wave1); }
.wave2 { fill: var(--wave2); }
.wave3 { fill: var(--wave3); }

.parallax > use {
  animation: move-forever 25s cubic-bezier(.55, .5, .45, .5) infinite;
}
.parallax > use:nth-child(1) { animation-delay: -2s; animation-duration: 7s; }
.parallax > use:nth-child(2) { animation-delay: -3s; animation-duration: 10s; }
.parallax > use:nth-child(3) { animation-delay: -4s; animation-duration: 13s; }

@keyframes move-forever {
  0% { transform: translate3d(-90px, 0, 0); }
  100% { transform: translate3d(85px, 0, 0); }
}

/* ===== LAYOUT ===== */
.app { max-width: 1100px; margin: 0 auto; position: relative; }
.app-header { text-align: center; margin-bottom: 40px; padding-top: 10px; }
.app-header h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
}
.app-header p { color: var(--text-secondary); font-size: 1.05rem; margin-bottom: 14px; }

/* ===== TABS ===== */
.tabs {
  display: flex; gap: 8px; justify-content: center; flex-wrap: wrap;
  margin-bottom: 32px; padding: 6px;
  background: var(--surface);
  border-radius: 14px;
  border: 1px solid var(--border);
  backdrop-filter: blur(12px);
  width: fit-content; margin-left: auto; margin-right: auto;
  box-shadow: var(--shadow-card);
}
.tab {
  background: transparent; border: none; color: var(--text-secondary);
  padding: 10px 24px; border-radius: 8px;
  font-weight: 600; font-size: 0.95rem; cursor: pointer;
  transition: all 0.25s ease; font-family: inherit;
}
.tab:hover { color: var(--text-primary); background: var(--surface-hover); }
.tab.active { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: #fff; box-shadow: 0 4px 15px rgba(102,126,234,0.3); }

/* ===== DASHBOARD CARDS ===== */
.dashboard-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 24px;
  align-items: start;
}

.profile-sidebar {
  position: sticky;
  top: 32px;
  padding: 32px 24px;
  text-align: center;
  background: var(--surface);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow-glow);
}

.profile-avatar { display: flex; justify-content: center; margin-bottom: 20px; }
.avatar-circle {
  width: 100px; height: 100px; border-radius: 50%;
  border: 4px solid var(--surface); box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.avatar-img {
  width: 100px; height: 100px; border-radius: 50%;
  object-fit: cover; border: 4px solid var(--surface);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.profile-name { font-size: 1.5rem; font-weight: 700; margin-bottom: 4px; color: var(--text-primary); }
.profile-role { color: #667eea; font-weight: 600; font-size: 0.95rem; margin-bottom: 8px; }
.profile-nim {
  font-size: 0.85rem; color: var(--text-secondary);
  background: rgba(0,0,0,0.05); display: inline-block;
  padding: 4px 12px; border-radius: 999px;
}
[data-theme="dark"] .profile-nim { background: rgba(255,255,255,0.1); }

.profile-section {
  margin-top: 28px; text-align: left;
  border-top: 1px solid var(--border); padding-top: 20px;
}
.profile-section h3 {
  font-size: 0.75rem; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--text-secondary);
  margin-bottom: 12px; font-weight: 700;
}
.contact-item {
  display: block; font-size: 0.9rem; color: var(--text-secondary);
  text-decoration: none; margin-bottom: 8px; word-break: break-all;
  transition: color 0.2s ease;
}
.contact-item:hover { color: var(--link-hover); }

.main-content { display: flex; flex-direction: column; gap: 20px; }
.info-card {
  background: var(--surface);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px 28px;
  box-shadow: var(--shadow-glow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.info-card:hover { transform: translateY(-2px); box-shadow: 0 12px 32px rgba(0,0,0,0.12); }
.info-card h3 {
  font-size: 0.75rem; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--text-secondary);
  margin-bottom: 16px; font-weight: 700;
}

/* ===== CONTENT TYPOGRAPHY & LINKS ===== */
.profile-text { font-size: 0.95rem; color: var(--text-muted); line-height: 1.75; }
.timeline { display: grid; gap: 16px; border-left: 2px solid rgba(102,126,234,0.3); padding-left: 20px; }
.timeline-item { position: relative; }
.timeline-item::before {
  content: ''; position: absolute; left: -27px; top: 6px;
  width: 10px; height: 10px; border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.timeline-title { font-weight: 700; font-size: 1rem; color: var(--text-primary); }
.timeline-sub { color: var(--text-secondary); font-size: 0.9rem; margin-top: 2px; }
.timeline-desc { color: var(--text-muted); font-size: 0.9rem; margin-top: 6px; }

/* Project Link Fix */
.project-link {
  display: inline-block; 
  color: var(--link-color); 
  text-decoration: none;
  word-break: break-all; 
  font-weight: 600; 
  padding: 8px 0;
  border-bottom: 1px dashed var(--link-color);
  transition: color 0.2s ease, border-color 0.2s ease;
}
.project-link:hover { 
  color: var(--link-hover); 
  border-bottom-color: var(--link-hover); 
}

.abilities { display: flex; flex-wrap: wrap; gap: 8px; }
.ability-tag {
  padding: 6px 14px; border-radius: 999px;
  font-size: 0.85rem; font-weight: 600;
  border: 1px solid var(--border);
  color: var(--text-primary);
}

.project-list { list-style: none; display: grid; gap: 10px; }
.project-list li {
  background: var(--btn-secondary-bg); border: 1px solid var(--border);
  padding: 14px 18px; border-radius: 10px;
  font-size: 0.92rem; color: var(--text-muted);
}
.project-list li::before { content: "▹"; color: #667eea; margin-right: 10px; font-weight: 700; }

/* ===== BUTTONS & FORMS ===== */
.download-group { display: flex; gap: 12px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px; border-radius: 10px;
  font-weight: 600; font-size: 0.9rem; text-decoration: none;
  cursor: pointer; transition: all 0.2s ease;
  border: none; font-family: inherit;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: #fff; }
.btn-primary:hover { box-shadow: 0 4px 15px rgba(102,126,234,0.4); transform: translateY(-1px); }
.btn-secondary { background: var(--surface); border: 1px solid var(--border); color: var(--text-primary); }
.btn-secondary:hover { background: var(--surface-hover); border-color: #667eea; }
.btn-danger { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); color: #ef4444; }
[data-theme="dark"] .btn-danger { color: #fca5a5; }
.btn-danger:hover { background: rgba(239,68,68,0.2); }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; }

/* Admin specific */
.admin-toolbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 20px; margin-bottom: 16px;
  background: var(--surface); border-radius: 14px;
  border: 1px solid var(--border);
}
.master-selector {
  display: flex; gap: 12px; align-items: center;
  padding: 14px 20px; margin-bottom: 16px;
  background: var(--surface); border-radius: 14px;
  border: 1px solid var(--border);
}
.login-card { max-width: 420px; margin: 0 auto; }
.login-tabs { display: flex; border-bottom: 1px solid var(--border); }
.login-tab {
  flex: 1; padding: 16px; background: transparent; border: none;
  color: var(--text-secondary); font-family: inherit;
  font-weight: 600; cursor: pointer; font-size: 0.95rem;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.login-tab.active { color: #667eea; border-bottom-color: #667eea; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.form-group { display: flex; flex-direction: column; margin-bottom: 14px; }
.form-group label {
  font-size: 0.8rem; font-weight: 600; color: var(--text-secondary);
  margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.05em;
}
.admin input, .admin textarea, .admin select, #login-form input, #login-form select {
  width: 100%; padding: 12px 16px;
  border: 1px solid var(--input-border); border-radius: 10px;
  font-family: inherit; font-size: 0.92rem;
  background: var(--input-bg); color: var(--text-primary);
  transition: border-color 0.2s;
}
.admin input:focus, .admin textarea:focus, .admin select:focus,
#login-form input:focus, #login-form select:focus {
  outline: none; border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102,126,234,0.15);
}
.admin textarea { min-height: 80px; resize: vertical; }
.form-actions { display: flex; gap: 16px; align-items: center; margin-top: 24px; }
.form-section-title { font-size: 0.85rem; margin-top: 28px; color: #667eea; }

.dynamic-item {
  display: grid; gap: 8px; padding: 12px;
  background: rgba(0,0,0,0.02); border-radius: 10px;
  border: 1px solid var(--border); margin-bottom: 10px;
}
[data-theme="dark"] .dynamic-item { background: rgba(0,0,0,0.2); }
.education-row { grid-template-columns: 1fr 1fr 1fr auto; align-items: center; }
.experience-row { grid-template-columns: 1fr 1fr 1fr auto; align-items: center; }
.experience-row .exp-description { grid-column: 1 / -1; }
.remove-btn {
  width: 36px; height: 36px; border-radius: 8px;
  background: rgba(239,68,68,0.1); color: #ef4444;
  border: 1px solid rgba(239,68,68,0.2);
  cursor: pointer; font-size: 1.2rem; line-height: 1;
}
.btn-add {
  background: transparent; border: 1px dashed var(--input-border);
  color: #667eea; padding: 10px 20px;
  border-radius: 10px; cursor: pointer;
  font-family: inherit; font-weight: 600; font-size: 0.9rem; margin-top: 4px;
}

/* File Manager */
.upload-area { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.upload-area input[type="file"] {
  flex: 1; min-width: 200px; padding: 10px;
  background: var(--input-bg); border: 1px solid var(--input-border);
  border-radius: 10px; color: var(--text-primary);
}
.file-list { display: grid; gap: 10px; margin-top: 16px; }
.file-item {
  display: flex; gap: 12px; align-items: center;
  padding: 12px 16px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px;
}
.file-icon { font-size: 1.4rem; }
.file-name { flex: 1; font-weight: 500; word-break: break-all; color: var(--text-primary); }
.file-meta { color: var(--text-secondary); font-size: 0.85rem; }

.hint { color: var(--text-secondary); font-size: 0.9rem; }
.error-msg { color: #ef4444; font-size: 0.9rem; margin-top: 8px; min-height: 1.2em; }
[data-theme="dark"] .error-msg { color: #fca5a5; }

@media (max-width: 900px) {
  .dashboard-layout { grid-template-columns: 1fr; }
  .profile-sidebar { position: static; }
}
@media (max-width: 640px) {
  body { padding: 16px 12px; }
  .education-row, .experience-row { grid-template-columns: 1fr; }
  .download-group { flex-direction: column; }
  .file-item { flex-wrap: wrap; }
}