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

:root {
  --bg-primary: #07080e;
  --bg-secondary: #0d0f17;
  --bg-surface: rgba(17, 20, 32, 0.7);
  --bg-card: rgba(22, 26, 42, 0.55);
  --border-glow: rgba(99, 102, 241, 0.15);
  --border-light: rgba(255, 255, 255, 0.06);
  
  --primary: #6366f1;
  --primary-glow: rgba(99, 102, 241, 0.4);
  --secondary: #a855f7;
  --secondary-glow: rgba(168, 85, 247, 0.4);
  
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  
  --gradient-main: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  --gradient-dark: linear-gradient(135deg, #0e111d 0%, #07080e 100%);
  --gradient-glow: linear-gradient(135deg, rgba(99, 102, 241, 0.12) 0%, rgba(168, 85, 247, 0.12) 100%);
  
  --success: #10b981;
  --error: #ef4444;
  --warning: #f59e0b;
  --info: #3b82f6;
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-primary);
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(168, 85, 247, 0.06) 0%, transparent 45%);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

a {
  color: inherit;
  text-decoration: none;
  transition: var(--transition-fast);
}

/* Glassmorphism utility */
.glass {
  background: var(--bg-surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-light);
}

/* Main Container */
.container {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 0 24px;
}

/* Header & Navigation */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(7, 8, 14, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
  padding: 16px 0;
}

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

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 22px;
  font-weight: 800;
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.5px;
}

.logo-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gradient-main);
  display: inline-block;
  box-shadow: 0 0 10px var(--primary-glow);
}

nav {
  display: flex;
  align-items: center;
  gap: 20px;
}

.nav-link {
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
}

.nav-link:hover, .nav-link.active {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition-normal);
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--gradient-main);
  color: #fff;
  box-shadow: 0 4px 15px var(--primary-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.55);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--error);
}

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

/* Hero Section */
.hero {
  padding: 60px 0 40px;
  text-align: center;
  position: relative;
}

.hero h1 {
  font-size: 48px;
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 16px;
  letter-spacing: -1px;
}

.hero h1 span {
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero p {
  color: var(--text-secondary);
  font-size: 18px;
  max-width: 600px;
  margin: 0 auto 32px;
  font-weight: 400;
}

/* Search and Filters */
.search-filter-wrapper {
  margin-bottom: 40px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.search-box {
  position: relative;
  width: 100%;
}

.search-box input {
  width: 100%;
  padding: 16px 20px 16px 52px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 16px;
  outline: none;
  transition: var(--transition-normal);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.search-box input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.2), inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.search-icon {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.filter-tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-tab {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.filter-tab:hover, .filter-tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 4px 12px var(--primary-glow);
}

/* Resources Grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 24px;
  margin-bottom: 60px;
}

.card {
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  height: 100%;
  transition: all var(--transition-normal);
  background: var(--bg-card);
  overflow: hidden;
}

.card:hover {
  transform: translateY(-6px);
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: 0 12px 30px rgba(99, 102, 241, 0.15);
  background: rgba(22, 26, 42, 0.85);
}

/* Card Image Thumbnail */
.card-image-wrapper {
  width: calc(100% + 48px);
  margin-left: -24px;
  margin-right: -24px;
  margin-top: -24px;
  height: 185px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 20px;
  overflow: hidden;
  position: relative;
}

.card-image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-normal);
}

.card:hover .card-image-wrapper img {
  transform: scale(1.05);
}

.card-image-placeholder {
  width: 100%;
  height: 100%;
  background: var(--gradient-glow);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 36px;
  position: relative;
}

.card-image-placeholder::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 60%, rgba(7, 8, 14, 0.4));
}

.card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.badge {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-category {
  background: rgba(168, 85, 247, 0.12);
  color: var(--secondary);
  border: 1px solid rgba(168, 85, 247, 0.25);
}

.badge-type {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
}

.badge-prompt {
  background: rgba(59, 130, 246, 0.12);
  color: var(--info);
  border: 1px solid rgba(59, 130, 246, 0.25);
}

.badge-file {
  background: rgba(16, 185, 129, 0.12);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.badge-text {
  background: rgba(245, 158, 11, 0.12);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.card h3 {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 10px;
  color: var(--text-primary);
}

.card p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 24px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-grow: 1;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border-light);
  padding-top: 16px;
  margin-top: auto;
}

.stats-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
}

/* Detail Resource Page */
.post-detail {
  margin: 40px auto 80px;
  max-width: 850px;
}

.post-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  margin-bottom: 24px;
  font-weight: 500;
}

.post-back-btn:hover {
  color: var(--primary);
}

.post-featured-image {
  width: 100%;
  height: 340px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-light);
  margin-bottom: 30px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
}

.post-featured-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.post-header {
  margin-bottom: 30px;
}

.post-header h1 {
  font-size: 38px;
  font-weight: 800;
  line-height: 1.2;
  margin: 12px 0 16px;
  letter-spacing: -0.5px;
}

.post-tags {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* Rich Description Article Formatting */
.post-desc {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 40px;
  line-height: 1.75;
}

.post-desc p {
  margin-bottom: 16px;
}

.post-desc a {
  color: var(--primary);
  text-decoration: underline;
  font-weight: 500;
}

.post-desc a:hover {
  color: var(--secondary);
  text-shadow: 0 0 8px rgba(168, 85, 247, 0.3);
}

.post-desc h1, .post-desc h2, .post-desc h3, .post-desc h4 {
  color: var(--text-primary);
  font-weight: 700;
  margin-top: 28px;
  margin-bottom: 12px;
  line-height: 1.3;
}

.post-desc h1 { font-size: 26px; }
.post-desc h2 { font-size: 22px; }
.post-desc h3 { font-size: 18px; }

.post-desc ul, .post-desc ol {
  margin-bottom: 18px;
  padding-left: 24px;
}

.post-desc li {
  margin-bottom: 6px;
}

.post-desc blockquote {
  border-left: 4px solid var(--primary);
  background: rgba(255, 255, 255, 0.02);
  padding: 12px 20px;
  margin-bottom: 18px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-style: italic;
  color: var(--text-primary);
}

.resource-box-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.prompt-container {
  position: relative;
  background: #0b0c13;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 40px;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.5);
}

.prompt-text {
  font-family: 'Courier New', Courier, monospace;
  font-size: 15px;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 500px;
  overflow-y: auto;
}

.download-action-box {
  background: var(--gradient-glow);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: var(--radius-lg);
  padding: 32px;
  text-align: center;
  margin-bottom: 40px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.download-action-box h4 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
}

.download-action-box p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 24px;
}

.btn-glowing {
  padding: 14px 32px;
  font-size: 16px;
  border-radius: var(--radius-md);
  position: relative;
  overflow: hidden;
  background: var(--gradient-main);
  color: white;
  border: none;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 0 20px var(--primary-glow);
  transition: all var(--transition-normal);
}

.btn-glowing:hover {
  transform: translateY(-3px);
  box-shadow: 0 0 30px rgba(99, 102, 241, 0.7);
}

.btn-glowing:active {
  transform: translateY(-1px);
}

/* Login Page */
.login-wrapper {
  flex-grow: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 40px 24px;
}

.login-card {
  max-width: 420px;
  width: 100%;
  border-radius: var(--radius-lg);
  padding: 40px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.login-card h2 {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 10px;
  text-align: center;
}

.login-card p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 30px;
  text-align: center;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

.form-control {
  width: 100%;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 15px;
  outline: none;
  transition: var(--transition-normal);
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.2);
}

.error-banner {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--error);
  padding: 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  font-size: 14px;
  text-align: center;
  font-weight: 500;
}

/* Admin Panel */
.admin-layout {
  padding: 40px 0;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
}

.admin-header h2 {
  font-size: 32px;
  font-weight: 800;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.stat-card {
  padding: 24px;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
}

.stat-card-label {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: 6px;
}

.stat-card-value {
  font-size: 36px;
  font-weight: 800;
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1;
}

/* Admin Posts Table */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  background: var(--bg-card);
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

th {
  background: rgba(255, 255, 255, 0.02);
  padding: 16px 20px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-light);
}

td {
  padding: 16px 20px;
  font-size: 14px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-light);
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: rgba(255, 255, 255, 0.01);
}

.table-actions {
  display: flex;
  gap: 10px;
}

.table-actions form {
  display: inline;
}

.admin-form-container {
  max-width: 750px;
  margin: 0 auto 60px;
}

.admin-form-container h2 {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 24px;
}

textarea.form-control {
  resize: vertical;
  min-height: 120px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 15px;
  margin-top: 30px;
  border-top: 1px solid var(--border-light);
  padding-top: 20px;
}

/* Quill Editor Dark Theme Overrides */
.ql-toolbar.ql-snow {
  background: #10121d !important;
  border: 1px solid var(--border-light) !important;
  border-top-left-radius: var(--radius-md);
  border-top-right-radius: var(--radius-md);
  margin-top: 4px;
}

.ql-container.ql-snow {
  background: rgba(0, 0, 0, 0.3) !important;
  border: 1px solid var(--border-light) !important;
  border-bottom-left-radius: var(--radius-md);
  border-bottom-right-radius: var(--radius-md);
  font-family: 'Outfit', sans-serif !important;
  font-size: 15px !important;
}

.ql-snow .ql-stroke {
  stroke: var(--text-secondary) !important;
}

.ql-snow .ql-fill {
  fill: var(--text-secondary) !important;
}

.ql-snow .ql-picker {
  color: var(--text-secondary) !important;
}

.ql-snow .ql-picker-options {
  background-color: var(--bg-secondary) !important;
  border-color: var(--border-light) !important;
}

.ql-editor {
  min-height: 250px;
  color: var(--text-primary) !important;
}

.ql-editor.ql-blank::before {
  color: var(--text-muted) !important;
  font-style: normal !important;
}

/* Copy popup message */
.toast {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background: var(--gradient-main);
  color: white;
  padding: 14px 24px;
  border-radius: var(--radius-md);
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(99, 102, 241, 0.35);
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 1000;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* Empty State styling */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-secondary);
  border: 1px dashed var(--border-light);
  border-radius: var(--radius-lg);
  margin-bottom: 60px;
}

.empty-state h3 {
  color: var(--text-primary);
  font-size: 20px;
  margin-bottom: 8px;
}

/* Footer styling */
footer {
  margin-top: auto;
  border-top: 1px solid var(--border-light);
  padding: 30px 0;
  text-align: center;
  background: var(--bg-secondary);
  color: var(--text-muted);
  font-size: 14px;
}

footer a {
  color: var(--text-secondary);
}

footer a:hover {
  color: var(--primary);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .hero h1 {
    font-size: 34px;
  }
  .hero p {
    font-size: 15px;
  }
  .grid {
    grid-template-columns: 1fr;
  }
  .admin-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  .table-responsive {
    border: none;
  }
  .post-featured-image {
    height: 220px;
  }
}
