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

:root {
  /* Dark Premium Admin Palette */
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: rgba(255, 255, 255, 0.03);
  --bg-card-hover: rgba(255, 255, 255, 0.06);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --border: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(99, 102, 241, 0.4);
  
  --accent-primary: #6366f1;
  --accent-primary-hover: #4f46e5;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --success-bg: rgba(16, 185, 129, 0.1);
  --success-text: #10b981;
  --error-bg: rgba(239, 68, 68, 0.1);
  --error-text: #ef4444;

  --radius-sm: 0.5rem;
  --radius-md: 0.8rem;
  --radius-lg: 1.2rem;
  --shadow-lg: 0 15px 35px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.15);
  
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text-primary);
  background: var(--bg-primary);
  line-height: 1.6;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea {
  font: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

.container {
  width: 92%;
  max-width: 1200px;
  margin: 0 auto;
}

/* Header */
.admin-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(10, 10, 15, 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 0;
}

.eyebrow {
  margin: 0 0 0.2rem;
  color: var(--accent-primary);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 800;
}

h2 {
  margin: 0 0 1rem;
  font-size: 1.25rem;
  font-weight: 700;
}

.header-actions {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.admin-main {
  padding: 2.5rem 0 4rem;
}

/* Messages */
.message, .alert {
  margin-bottom: 1.5rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid transparent;
}

.message.success {
  color: var(--success-text);
  background: var(--success-bg);
  border-color: rgba(16, 185, 129, 0.2);
}

.message.error, .alert {
  color: var(--error-text);
  background: var(--error-bg);
  border-color: rgba(239, 68, 68, 0.2);
}

/* Stats */
.stats-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.mini-card,
.admin-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.mini-card {
  padding: 1.25rem;
  transition: all var(--transition);
}

.mini-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-focus);
}

.mini-card span {
  display: block;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.mini-card strong {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-primary);
}

/* Main Grid */
.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 1.5rem;
  align-items: start;
}

.admin-card {
  padding: 1.5rem;
}

.card-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1rem;
}

.card-title h2 {
  margin: 0;
}

/* Forms */
label {
  display: grid;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 600;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.8rem 1rem;
  color: var(--text-primary);
  background: rgba(0, 0, 0, 0.2);
  transition: all var(--transition);
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: var(--accent-primary);
  outline: none;
  background: rgba(0, 0, 0, 0.4);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

input[type="file"] {
  padding: 0.6rem;
  background: rgba(0, 0, 0, 0.1);
}

/* Buttons */
.btn-primary,
.btn-secondary,
.btn-logout,
.btn-edit,
.btn-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 0.75rem 1.25rem;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-primary {
  background: var(--accent-primary);
  color: #fff;
  width: 100%;
  font-size: 1rem;
  padding: 1rem;
  margin-top: 0.5rem;
}

.btn-primary:hover {
  background: var(--accent-primary-hover);
  box-shadow: var(--shadow-glow);
}

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

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--text-primary);
}

.btn-logout {
  background: rgba(239, 68, 68, 0.1);
  color: var(--error-text);
}

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

.text-link {
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.9rem;
}

.text-link:hover {
  color: var(--text-primary);
}

.pill {
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent-primary);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
}

/* Project List */
.projects-list {
  display: grid;
  gap: 1.25rem;
}

.project-card {
  display: grid;
  grid-template-columns: 8rem 1fr auto;
  gap: 1.25rem;
  align-items: start;
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  transition: all var(--transition);
}

.project-card:hover {
  border-color: var(--border-focus);
  background: var(--bg-card-hover);
}

.project-card img {
  width: 100%;
  aspect-ratio: 4/3;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--bg-secondary);
}

.project-body h3 {
  margin: 0 0 0.4rem;
  font-size: 1.1rem;
  color: var(--text-primary);
}

.project-body p {
  margin: 0 0 0.8rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.tech-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}

.tech-badge {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid var(--border);
}

.date-badge {
  font-size: 0.75rem;
  color: var(--accent-primary);
  font-weight: 600;
}

.project-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.delete-form {
  margin: 0;
}

.btn-edit {
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent-primary);
  width: 100%;
}

.btn-edit:hover {
  background: var(--accent-primary);
  color: #fff;
}

.btn-delete {
  background: rgba(239, 68, 68, 0.1);
  color: var(--error-text);
  width: 100%;
}

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

/* Auth Box (Login) */
.auth-box {
  width: 100%;
  max-width: 420px;
  margin: 10vh auto;
  padding: 2rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.auth-box h1 {
  margin-bottom: 0.5rem;
}

.auth-box p {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.empty-state {
  color: var(--text-secondary);
  text-align: center;
  padding: 2rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
}

/* Responsive */
@media (max-width: 1024px) {
  .admin-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .project-card {
    grid-template-columns: 1fr;
  }
  
  .project-card img {
    aspect-ratio: 16/9;
  }
  
  .project-actions {
    flex-direction: row;
    margin-top: 0.5rem;
  }
  
  .header-top {
    flex-direction: column;
    align-items: flex-start;
  }
}
