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

:root {
  --blue: #185FA5;
  --blue-light: #E6F1FB;
  --blue-dark: #0C447C;
  --red: #E24B4A;
  --green: #1D9E75;
  --amber: #EF9F27;
  --purple: #7F77DD;
  --border: #e5e5e5;
  --border-hover: #d0d0d0;
  --text: #1a1a1a;
  --text-muted: #666;
  --bg: #ffffff;
  --bg-sec: #f8f8f8;
  --bg-ter: #f0f0f0;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-lg: 0 4px 20px rgba(0,0,0,0.12);
}

body { 
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text); 
  background: var(--bg-sec); 
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* === NAV === */
.topnav {
  height: 60px; 
  background: var(--bg); 
  border-bottom: 1px solid var(--border);
  display: flex; 
  align-items: center; 
  gap: 20px; 
  padding: 0 24px;
  position: sticky; 
  top: 0; 
  z-index: 100;
  box-shadow: 0 1px 0 rgba(0,0,0,0.03);
}

.nav-logo {
  display: flex; 
  align-items: center; 
  gap: 10px; 
  font-weight: 600; 
  font-size: 16px;
  color: var(--text); 
  text-decoration: none;
}

.nav-logo svg {
  width: 32px;
  height: 32px;
}

.nav-spacer { flex: 1; }

.nav-link { 
  font-size: 14px; 
  color: var(--text-muted); 
  text-decoration: none; 
  padding: 6px 12px; 
  border-radius: var(--radius-sm);
  font-weight: 500;
  transition: all 0.15s ease;
}

.nav-link:hover { 
  background: var(--bg-sec); 
  color: var(--text); 
}

.nav-link.active { 
  background: var(--blue-light); 
  color: var(--blue); 
}

.nav-user { 
  display: flex; 
  align-items: center; 
  gap: 10px; 
  font-size: 14px; 
  color: var(--text-muted); 
}

.nav-logout { 
  font-size: 13px; 
  color: var(--text-muted); 
  text-decoration: none; 
  padding: 6px 14px; 
  border: 1px solid var(--border); 
  border-radius: var(--radius-sm);
  font-weight: 500;
  transition: all 0.15s ease;
}

.nav-logout:hover { 
  background: var(--bg-sec);
  border-color: var(--border-hover);
}

.user-avatar {
  width: 36px; 
  height: 36px; 
  border-radius: 50%;
  background: var(--blue-light); 
  color: var(--blue);
  display: flex; 
  align-items: center; 
  justify-content: center;
  font-size: 13px; 
  font-weight: 600; 
  flex-shrink: 0;
}

/* === LAYOUT === */
.app-layout { 
  display: flex; 
  flex-direction: column; 
  min-height: 100vh; 
}

.main-content { 
  flex: 1; 
  padding: 32px; 
  max-width: 1400px; 
  width: 100%; 
  margin: 0 auto;
}

/* === PAGE HEADER === */
.page-header {
  display: flex; 
  align-items: center; 
  justify-content: space-between;
  margin-bottom: 28px; 
  gap: 16px; 
  flex-wrap: wrap;
}

.page-header h1 { 
  font-size: 28px; 
  font-weight: 600;
  letter-spacing: -0.5px;
}

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

.breadcrumb { 
  display: flex; 
  align-items: center; 
  gap: 8px; 
  font-size: 14px; 
}

.breadcrumb a { 
  color: var(--text-muted); 
  text-decoration: none;
  transition: color 0.15s ease;
}

.breadcrumb a:hover { 
  color: var(--text); 
}

.breadcrumb span { 
  color: var(--text-muted); 
}

.breadcrumb span:last-child { 
  color: var(--text); 
  font-weight: 500; 
}

/* === BUTTONS === */
.btn-primary {
  background: var(--blue); 
  color: white; 
  border: none;
  border-radius: var(--radius-sm); 
  padding: 10px 18px;
  font-size: 14px; 
  font-weight: 500; 
  cursor: pointer; 
  font-family: inherit;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-primary:hover { 
  background: var(--blue-dark);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(24,95,165,0.3);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--bg); 
  color: var(--text); 
  border: 1px solid var(--border);
  border-radius: var(--radius-sm); 
  padding: 10px 18px;
  font-size: 14px; 
  cursor: pointer; 
  font-family: inherit;
  font-weight: 500;
  transition: all 0.15s ease;
}

.btn-secondary:hover { 
  background: var(--bg-sec);
  border-color: var(--border-hover);
}

.btn-danger-sm {
  background: none; 
  color: var(--red); 
  border: 1px solid var(--red);
  border-radius: var(--radius-sm); 
  padding: 8px 14px;
  font-size: 13px; 
  cursor: pointer; 
  font-family: inherit;
  font-weight: 500;
  transition: all 0.15s ease;
}

.btn-danger-sm:hover { 
  background: #FCEBEB; 
}

.btn-sm { 
  padding: 7px 14px; 
  font-size: 13px; 
}

.btn-full {
  width: 100%; 
  background: var(--blue); 
  color: white; 
  border: none;
  border-radius: var(--radius-sm); 
  padding: 12px; 
  font-size: 14px;
  font-weight: 500; 
  cursor: pointer; 
  font-family: inherit; 
  margin-top: 8px;
  transition: all 0.15s ease;
}

.btn-full:hover { 
  background: var(--blue-dark);
}

/* === ICON ACTIONS === */
.icon-action {
  width: 32px; 
  height: 32px; 
  border: 1px solid var(--border);
  border-radius: var(--radius-sm); 
  background: var(--bg);
  display: inline-flex; 
  align-items: center; 
  justify-content: center;
  cursor: pointer; 
  color: var(--text-muted); 
  text-decoration: none;
  transition: all 0.15s ease;
}

.icon-action:hover { 
  border-color: var(--border-hover); 
  color: var(--text);
  background: var(--bg-sec);
}

.icon-action.danger:hover { 
  border-color: var(--red); 
  color: var(--red); 
  background: #FCEBEB; 
}

/* === BADGES === */
.badge { 
  display: inline-block; 
  font-size: 11px; 
  padding: 3px 10px; 
  border-radius: 99px; 
  font-weight: 600;
  letter-spacing: 0.3px;
}

.badge-edit { 
  background: var(--blue-light); 
  color: var(--blue); 
}

.badge-view { 
  background: var(--bg-ter); 
  color: var(--text-muted); 
}

/* === ALERTS === */
.alert { 
  padding: 12px 16px; 
  border-radius: var(--radius-sm); 
  margin-bottom: 16px; 
  font-size: 13px;
  border: 1px solid;
}

.alert-error { 
  background: #FEF2F2; 
  color: #991B1B; 
  border-color: #FCA5A5; 
}

/* === FORMS === */
.form-group { 
  margin-bottom: 16px; 
}

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

.form-group input, 
.form-group select, 
.form-group textarea {
  width: 100%; 
  border: 1px solid var(--border); 
  border-radius: var(--radius-sm);
  padding: 10px 12px; 
  font-size: 14px; 
  font-family: inherit; 
  background: var(--bg);
  color: var(--text);
  transition: all 0.15s ease;
}

.form-group input:focus, 
.form-group select:focus,
.form-group textarea:focus { 
  outline: none; 
  border-color: var(--blue); 
  box-shadow: 0 0 0 3px rgba(24,95,165,0.1); 
}

/* === LOGIN === */
.login-wrap { 
  min-height: 100vh; 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  padding: 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-card { 
  background: var(--bg); 
  border: 1px solid var(--border); 
  border-radius: var(--radius); 
  padding: 40px; 
  width: 100%; 
  max-width: 420px; 
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-logo { 
  display: flex; 
  align-items: center; 
  gap: 12px; 
  font-size: 20px; 
  font-weight: 600; 
  margin-bottom: 32px;
  justify-content: center;
}

.login-form input { 
  width: 100%; 
}

/* === PROJECTS === */
.project-grid { 
  display: grid; 
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); 
  gap: 20px; 
}

.project-card {
  background: var(--bg); 
  border: 1px solid var(--border); 
  border-radius: var(--radius);
  padding: 24px; 
  cursor: pointer; 
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.project-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--blue);
  transform: scaleX(0);
  transition: transform 0.2s ease;
}

.project-card:hover {
  border-color: var(--blue);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.project-card:hover::before {
  transform: scaleX(1);
}

.project-icon { 
  width: 48px; 
  height: 48px; 
  border-radius: var(--radius-sm); 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  margin-bottom: 16px;
  font-size: 20px;
}

.project-name { 
  font-weight: 600; 
  font-size: 16px; 
  margin-bottom: 6px;
  color: var(--text);
}

.project-desc { 
  font-size: 13px; 
  color: var(--text-muted); 
  margin-bottom: 12px;
  line-height: 1.5;
}

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

.project-count { 
  font-size: 13px; 
  color: var(--text-muted);
  font-weight: 500;
}

/* === PDF GRID === */
.pdf-grid { 
  display: grid; 
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); 
  gap: 16px; 
}

.pdf-thumb-card {
  background: var(--bg); 
  border: 1px solid var(--border); 
  border-radius: var(--radius);
  overflow: hidden; 
  cursor: pointer; 
  position: relative; 
  transition: all 0.2s ease;
}

.pdf-thumb-card:hover { 
  border-color: var(--blue);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.pdf-thumb {
  background: var(--bg-sec); 
  height: 140px;
  display: flex; 
  flex-direction: column; 
  align-items: center; 
  justify-content: center; 
  gap: 8px;
}

.pdf-ext { 
  font-size: 11px; 
  font-weight: 600; 
  color: var(--red); 
  letter-spacing: 1px; 
  font-family: monospace;
  background: rgba(226,75,74,0.1);
  padding: 4px 8px;
  border-radius: 4px;
}

.pdf-thumb-info { 
  padding: 12px; 
}

.pdf-thumb-name { 
  font-size: 13px; 
  font-weight: 500; 
  white-space: nowrap; 
  overflow: hidden; 
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.pdf-thumb-meta { 
  font-size: 12px; 
  color: var(--text-muted); 
}

.pdf-delete-btn {
  position: absolute; 
  top: 8px; 
  right: 8px; 
  width: 28px; 
  height: 28px;
  background: rgba(255,255,255,0.95); 
  border: 1px solid var(--border); 
  border-radius: 50%;
  display: flex; 
  align-items: center; 
  justify-content: center; 
  cursor: pointer; 
  font-size: 16px;
  color: var(--red); 
  line-height: 1; 
  opacity: 0;
  transition: all 0.15s ease;
}

.pdf-thumb-card:hover .pdf-delete-btn { 
  opacity: 1; 
}

.pdf-delete-btn:hover {
  background: var(--red);
  color: white;
  border-color: var(--red);
}

/* === EMPTY STATE === */
.empty-state { 
  text-align: center; 
  padding: 80px 20px; 
  color: var(--text-muted); 
}

.empty-state svg { 
  margin-bottom: 20px; 
  color: var(--border); 
}

.empty-state p { 
  font-size: 15px;
  margin-bottom: 8px;
}

.empty-state p:first-of-type {
  font-weight: 500;
  color: var(--text);
}

/* === MODAL === */
.modal-overlay {
  position: fixed; 
  inset: 0; 
  background: rgba(0,0,0,0.4);
  display: flex; 
  align-items: center; 
  justify-content: center; 
  z-index: 1000;
  backdrop-filter: blur(2px);
}

.modal { 
  background: var(--bg); 
  border-radius: var(--radius); 
  padding: 28px; 
  width: 90%; 
  max-width: 500px; 
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  animation: modalIn 0.2s ease;
}

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

.modal-wide { 
  max-width: 800px; 
}

.modal-header { 
  display: flex; 
  align-items: center; 
  justify-content: space-between; 
  margin-bottom: 24px; 
  font-weight: 600; 
  font-size: 18px; 
}

.modal-close { 
  background: none; 
  border: none; 
  font-size: 24px; 
  cursor: pointer; 
  color: var(--text-muted); 
  width: 32px; 
  height: 32px; 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  border-radius: 50%;
  transition: all 0.15s ease;
}

.modal-close:hover { 
  background: var(--bg-sec); 
}

/* === ADMIN === */
.admin-grid { 
  display: grid; 
  grid-template-columns: 1fr; 
  gap: 24px; 
}

@media (min-width: 900px) { 
  .admin-grid { 
    grid-template-columns: 1fr 1fr; 
  } 
}

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

.admin-card-header { 
  display: flex; 
  align-items: center; 
  justify-content: space-between; 
  margin-bottom: 20px; 
  font-weight: 600;
  font-size: 16px;
}

.admin-table { 
  width: 100%; 
  border-collapse: collapse; 
}

.admin-table th { 
  font-size: 12px; 
  color: var(--text-muted); 
  font-weight: 600; 
  text-align: left; 
  padding: 10px 12px; 
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.admin-table td { 
  padding: 12px; 
  border-bottom: 1px solid var(--border); 
  font-size: 13px; 
}

.admin-table tr:hover {
  background: var(--bg-sec);
}

.admin-table a { 
  color: var(--blue); 
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s ease;
}

.admin-table a:hover {
  color: var(--blue-dark);
  text-decoration: underline;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
  .topnav {
    height: 56px;
    padding: 0 16px;
    gap: 12px;
  }
  
  .main-content {
    padding: 20px 16px;
  }
  
  .page-header h1 {
    font-size: 24px;
  }
  
  .project-grid {
    grid-template-columns: 1fr;
  }
  
  .pdf-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
  }
  
  .admin-grid {
    grid-template-columns: 1fr;
  }
}

/* === UTILITY === */
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
