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

:root {
  --bg: #0d0f14;
  --bg2: #13161e;
  --bg3: #1a1d27;
  --border: #252836;
  --accent: #7c3aed;
  --accent2: #a855f7;
  --accent-glow: rgba(124, 58, 237, 0.35);
  --text: #e2e8f0;
  --text2: #94a3b8;
  --text3: #64748b;
  --red: #ef4444;
  --green: #22c55e;
  --yellow: #eab308;
  --radius: 12px;
  --radius-sm: 8px;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
textarea, input, select { font-family: inherit; }

/* =========================================
   SCROLLBAR
   ========================================= */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 3px; }

/* =========================================
   NAVBAR
   ========================================= */
.navbar {
  position: fixed; top: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 2rem;
  background: rgba(13, 15, 20, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
}

.nav-logo {
  font-size: 1.4rem; font-weight: 700;
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}

.dot { color: var(--accent2); -webkit-text-fill-color: var(--accent2); }

.nav-links {
  display: flex; align-items: center; gap: 2rem; list-style: none;
}

.nav-links a {
  color: var(--text2); font-size: 0.95rem; transition: color 0.2s;
}
.nav-links a:hover { color: var(--text); }

.btn-admin {
  background: var(--accent); color: #fff !important;
  padding: 0.4rem 1rem; border-radius: 20px; font-size: 0.85rem !important;
}
.btn-logout { color: var(--text3) !important; font-size: 0.85rem !important; }

.burger {
  display: none; background: none; border: none;
  color: var(--text); font-size: 1.5rem; cursor: pointer;
}

/* =========================================
   BUTTONS
   ========================================= */
.btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.65rem 1.5rem; border-radius: var(--radius-sm);
  font-size: 0.95rem; font-weight: 500; cursor: pointer;
  border: none; transition: all 0.2s; text-decoration: none;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff; box-shadow: 0 4px 15px var(--accent-glow);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 20px var(--accent-glow); }

.btn-outline {
  background: transparent; color: var(--text);
  border: 1px solid var(--border);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #dc2626; }

.btn-success { background: var(--green); color: #fff; }
.btn-sm { padding: 0.35rem 0.85rem; font-size: 0.82rem; }
.w-full { width: 100%; justify-content: center; }

/* =========================================
   MESSAGES
   ========================================= */
.messages-container {
  position: fixed; top: 5rem; right: 1.5rem; z-index: 200;
  display: flex; flex-direction: column; gap: 0.5rem;
}
.message {
  padding: 0.75rem 1.25rem; border-radius: var(--radius-sm);
  background: var(--bg3); border: 1px solid var(--border);
  font-size: 0.9rem; animation: slideIn 0.3s ease;
}
.message-success { border-color: var(--green); color: var(--green); }
.message-error { border-color: var(--red); color: var(--red); }

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

/* =========================================
   HERO
   ========================================= */
.hero {
  min-height: 100vh; padding: 8rem 2rem 4rem;
  display: flex; align-items: center; justify-content: space-between;
  gap: 3rem; max-width: 1200px; margin: 0 auto;
}

.hero-badge {
  display: inline-block; padding: 0.35rem 1rem;
  background: rgba(124,58,237,0.15); border: 1px solid rgba(124,58,237,0.4);
  border-radius: 20px; font-size: 0.85rem; color: var(--accent2);
  margin-bottom: 1.2rem;
}

.hero-title {
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 800; line-height: 1.1;
  margin-bottom: 0.75rem;
}

.accent {
  background: linear-gradient(135deg, #7c3aed, #a855f7, #ec4899);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: clamp(1.1rem, 2.5vw, 1.4rem);
  color: var(--text2); margin-bottom: 1rem;
}

.hero-desc {
  color: var(--text3); max-width: 450px; margin-bottom: 2rem;
}

.hero-buttons { display: flex; gap: 1rem; flex-wrap: wrap; }

/* Code card */
.hero-visual { flex-shrink: 0; }
.code-card {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  min-width: 320px; box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
.code-header {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.75rem 1rem; background: var(--bg2); border-bottom: 1px solid var(--border);
}
.code-header .dot { width: 12px; height: 12px; border-radius: 50%; display: block; }
.code-header .dot.red { background: #ef4444; -webkit-text-fill-color: unset; }
.code-header .dot.yellow { background: #eab308; -webkit-text-fill-color: unset; }
.code-header .dot.green { background: #22c55e; -webkit-text-fill-color: unset; }
.code-filename { font-size: 0.8rem; color: var(--text3); margin-left: 0.5rem; }

.code-body {
  padding: 1.25rem; font-family: 'Consolas', 'Fira Code', monospace;
  font-size: 0.88rem; line-height: 1.7;
}
.code-body .kw { color: #c084fc; }
.code-body .cls { color: #67e8f9; }
.code-body .str { color: #86efac; }

/* Typing cursor */
.typing::after { content: '|'; animation: blink 1s infinite; color: var(--accent2); }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0} }

/* =========================================
   CONTAINER
   ========================================= */
.container { max-width: 1200px; margin: 0 auto; padding: 0 2rem; }
.container-narrow { max-width: 800px; }

/* =========================================
   SECTIONS
   ========================================= */
section { padding: 5rem 0; }

.section-title {
  font-size: clamp(1.8rem, 3vw, 2.5rem);
  font-weight: 700; margin-bottom: 2.5rem;
  position: relative; display: inline-block;
}
.section-title::after {
  content: ''; position: absolute; bottom: -8px; left: 0;
  width: 50px; height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 2px;
}

.section-header {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  gap: 1rem; margin-bottom: 2.5rem;
}
.section-header .section-title { margin-bottom: 0; }
.see-all { color: var(--accent2); font-size: 0.95rem; }
.see-all:hover { text-decoration: underline; }

/* =========================================
   ABOUT
   ========================================= */
.about { background: var(--bg2); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }

.about-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 3rem; align-items: start;
}

.about-text p { color: var(--text2); margin-bottom: 1rem; }

.about-stats {
  display: flex; gap: 2rem; margin-top: 2rem;
}
.stat { text-align: center; }
.stat-num {
  display: block; font-size: 2rem; font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.stat-label { font-size: 0.8rem; color: var(--text3); }

.skills-list h3 { font-size: 1.1rem; margin-bottom: 1rem; color: var(--text2); }
.skill-tags { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tag {
  padding: 0.35rem 0.85rem; border-radius: 20px;
  background: rgba(124,58,237,0.15); border: 1px solid rgba(124,58,237,0.3);
  font-size: 0.85rem; color: var(--accent2);
}
.tag.small { font-size: 0.75rem; padding: 0.2rem 0.6rem; }

/* =========================================
   PROJECTS
   ========================================= */
.projects-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

.project-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  transition: transform 0.2s, border-color 0.2s;
}
.project-card:hover { transform: translateY(-4px); border-color: var(--accent); }

.project-img { height: 200px; overflow: hidden; }
.project-img img { width: 100%; height: 100%; object-fit: cover; }
.project-img-placeholder {
  height: 200px; background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex; align-items: center; justify-content: center;
  font-size: 4rem; font-weight: 700; color: rgba(255,255,255,0.3);
}

.project-body { padding: 1.25rem; }
.project-title { font-size: 1.1rem; font-weight: 600; margin-bottom: 0.5rem; }
.project-desc { color: var(--text2); font-size: 0.9rem; margin-bottom: 1rem; line-height: 1.6; }
.project-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1rem; }
.project-links { display: flex; gap: 0.75rem; align-items: center; }
.project-link {
  display: inline-flex; align-items: center; gap: 0.3rem;
  font-size: 0.85rem; color: var(--text2);
  padding: 0.3rem 0.75rem; border-radius: 20px;
  border: 1px solid var(--border); transition: all 0.2s;
}
.project-link:hover { border-color: var(--accent2); color: var(--accent2); }
.accent-link { color: var(--accent2) !important; border-color: rgba(168,85,247,0.3) !important; }

/* =========================================
   NEWS PREVIEW
   ========================================= */
.latest-news { background: var(--bg2); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }

.news-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.5rem; }

.news-card {
  display: block; background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem;
  transition: transform 0.2s, border-color 0.2s;
}
.news-card:hover { transform: translateY(-4px); border-color: var(--accent); }
.news-date { font-size: 0.8rem; color: var(--text3); margin-bottom: 0.5rem; }
.news-title { font-size: 1.05rem; font-weight: 600; margin-bottom: 0.5rem; }
.news-preview { color: var(--text2); font-size: 0.88rem; line-height: 1.6; margin-bottom: 1rem; }
.news-read { font-size: 0.85rem; color: var(--accent2); }

/* =========================================
   CONTACT
   ========================================= */
.contact { text-align: center; }
.contact-sub { color: var(--text2); margin-bottom: 2.5rem; }
.contact-links { display: flex; justify-content: center; gap: 1rem; flex-wrap: wrap; }
.contact-card {
  display: flex; flex-direction: column; align-items: center; gap: 0.5rem;
  padding: 1.5rem 2rem; background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); min-width: 140px; transition: all 0.2s;
}
.contact-card:hover { border-color: var(--accent); transform: translateY(-3px); }
.contact-icon { font-size: 1.8rem; }

/* =========================================
   FOOTER
   ========================================= */
.footer {
  padding: 2rem; text-align: center;
  border-top: 1px solid var(--border); color: var(--text3); font-size: 0.9rem;
}
.footer-links { display: flex; justify-content: center; gap: 1.5rem; margin-top: 0.5rem; }
.footer-links a { color: var(--text3); transition: color 0.2s; }
.footer-links a:hover { color: var(--accent2); }

/* =========================================
   NEWS PAGE
   ========================================= */
.page-hero {
  padding: 8rem 2rem 3rem; background: var(--bg2);
  border-bottom: 1px solid var(--border);
}
.page-title { font-size: clamp(2rem, 4vw, 3rem); font-weight: 700; margin-bottom: 0.5rem; }
.page-sub { color: var(--text2); }

.news-page { padding: 3rem 0 5rem; }
.news-list { display: flex; flex-direction: column; gap: 1.5rem; }

.news-item {
  display: flex; gap: 2rem; background: var(--bg2);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.75rem; transition: border-color 0.2s;
}
.news-item:hover { border-color: var(--accent); }
.news-item-date { font-size: 0.8rem; color: var(--text3); min-width: 90px; padding-top: 0.3rem; }
.news-item-title { font-size: 1.2rem; font-weight: 600; margin-bottom: 0.5rem; }
.news-item-preview { color: var(--text2); font-size: 0.9rem; margin-bottom: 1rem; }
.news-item-read { color: var(--accent2); font-size: 0.85rem; }

/* =========================================
   POST DETAIL
   ========================================= */
.post-page { padding: 7rem 2rem 5rem; }
.back-link { display: inline-block; color: var(--text3); font-size: 0.9rem; margin-bottom: 2rem; }
.back-link:hover { color: var(--accent2); }
.post-meta { font-size: 0.85rem; color: var(--text3); margin-bottom: 0.75rem; }
.post-title { font-size: clamp(1.8rem, 4vw, 2.8rem); font-weight: 700; margin-bottom: 1rem; }
.post-lead { font-size: 1.15rem; color: var(--text2); margin-bottom: 2rem; padding-bottom: 2rem; border-bottom: 1px solid var(--border); }
.post-content { color: var(--text); line-height: 1.8; }
.post-content p { margin-bottom: 1rem; }
.post-admin-bar { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }

/* =========================================
   AUTH
   ========================================= */
.auth-page {
  min-height: 100vh; display: flex; align-items: center;
  justify-content: center; padding: 2rem;
}
.auth-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 2.5rem; width: 100%; max-width: 400px;
}
.auth-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 1.5rem; }
.auth-form { display: flex; flex-direction: column; gap: 1rem; }

/* =========================================
   FORMS
   ========================================= */
.form-page { padding: 7rem 2rem 5rem; }
.admin-form { display: flex; flex-direction: column; gap: 1.25rem; margin-top: 2rem; }
.form-group { display: flex; flex-direction: column; gap: 0.4rem; }
.form-label { font-size: 0.9rem; color: var(--text2); font-weight: 500; }

.admin-form input[type="text"],
.admin-form input[type="url"],
.admin-form input[type="number"],
.admin-form input[type="password"],
.admin-form textarea,
.admin-form select,
.auth-form input {
  background: var(--bg3); border: 1px solid var(--border);
  color: var(--text); border-radius: var(--radius-sm);
  padding: 0.65rem 0.9rem; font-size: 0.95rem;
  transition: border-color 0.2s; width: 100%;
}
.admin-form input:focus,
.admin-form textarea:focus,
.auth-form input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.15);
}

.admin-form textarea { min-height: 120px; resize: vertical; }
.form-group-full textarea { min-height: 300px; }

.admin-form input[type="checkbox"] { width: auto; }

.form-error { font-size: 0.82rem; color: var(--red); }
.form-hint { font-size: 0.8rem; color: var(--text3); }
.form-actions { display: flex; gap: 1rem; margin-top: 0.5rem; }

/* =========================================
   DASHBOARD
   ========================================= */
.dashboard { padding: 7rem 2rem 5rem; }
.dashboard-header { display: flex; align-items: center; gap: 1rem; margin-bottom: 3rem; }
.badge-online { font-size: 0.85rem; color: var(--green); }

.dash-section {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.75rem; margin-bottom: 2rem;
}
.dash-section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.5rem; flex-wrap: wrap; gap: 1rem;
}
.dash-section-header h2 { font-size: 1.2rem; font-weight: 600; }

.dash-table { display: flex; flex-direction: column; gap: 0.75rem; }
.dash-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.9rem 1rem; background: var(--bg3);
  border-radius: var(--radius-sm); border: 1px solid var(--border);
  gap: 1rem; flex-wrap: wrap;
}
.dash-row-info { display: flex; align-items: center; gap: 0.9rem; }
.dash-thumb { width: 48px; height: 48px; object-fit: cover; border-radius: 8px; }
.dash-thumb-placeholder {
  width: 48px; height: 48px; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1.1rem;
}
.dash-row-title { font-size: 0.95rem; font-weight: 500; }
.dash-row-sub { font-size: 0.8rem; color: var(--text3); margin-top: 0.15rem; }
.dash-row-actions { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.action-link { font-size: 0.82rem; color: var(--accent2); }

/* =========================================
   CONFIRM DELETE
   ========================================= */
.confirm-card {
  text-align: center; background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 3rem; margin-top: 5rem;
}
.confirm-icon { font-size: 3rem; margin-bottom: 1rem; }
.confirm-text { color: var(--text2); margin: 1rem 0 2rem; }
.confirm-actions { display: flex; gap: 1rem; justify-content: center; }

/* =========================================
   EMPTY STATE
   ========================================= */
.empty-state {
  text-align: center; padding: 3rem; color: var(--text3);
  border: 1px dashed var(--border); border-radius: var(--radius);
  display: flex; flex-direction: column; align-items: center; gap: 1rem;
}
.empty-state.small { padding: 1.5rem; }

/* =========================================
   RESPONSIVE
   ========================================= */
@media (max-width: 900px) {
  .hero { flex-direction: column; text-align: center; padding-top: 6rem; }
  .hero-desc { margin: 0 auto 2rem; }
  .hero-buttons { justify-content: center; }
  .about-grid { grid-template-columns: 1fr; }
}

@media (max-width: 650px) {
  .navbar { padding: 1rem; }
  .nav-links { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(13,15,20,0.97); flex-direction: column; justify-content: center; align-items: center; gap: 2rem; font-size: 1.2rem; }
  .nav-links.open { display: flex; }
  .burger { display: block; }
  .hero { padding: 5rem 1.5rem 3rem; }
  .code-card { min-width: auto; width: 100%; }
  .news-item { flex-direction: column; gap: 0.5rem; }
  .dashboard { padding: 6rem 1rem 3rem; }
  .dash-row { flex-direction: column; align-items: flex-start; }
}
