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

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --success: #16a34a;
  --success-light: #dcfce7;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  --warning: #d97706;
  --warning-light: #fef3c7;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --sidebar-w: 240px;
  --radius: 10px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
  --shadow: 0 4px 16px rgba(0,0,0,.10);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.14);
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

body {
  font-family: var(--font);
  background: var(--gray-100);
  color: var(--gray-800);
  min-height: 100vh;
}

/* ========== SCREENS ========== */
.screen { display: none; }
.screen.active { display: flex; }

/* ========== LOGIN ========== */
#login-screen {
  min-height: 100vh;
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 50%, #0ea5e9 100%);
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
  overflow: hidden;
}

#login-screen::before {
  content: '';
  position: absolute;
  width: 500px; height: 500px;
  background: rgba(255,255,255,.05);
  border-radius: 50%;
  top: -150px; right: -100px;
}

#login-screen::after {
  content: '';
  position: absolute;
  width: 350px; height: 350px;
  background: rgba(255,255,255,.05);
  border-radius: 50%;
  bottom: -100px; left: -80px;
}

.login-card {
  background: white;
  border-radius: 20px;
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  position: relative;
  z-index: 1;
}

.login-logo {
  text-align: center;
  margin-bottom: 36px;
}

.logo-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.login-logo h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 4px;
}

.login-logo p {
  font-size: 13px;
  color: var(--gray-500);
}

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

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

.input-wrapper {
  position: relative;
}

.input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  pointer-events: none;
}

.input-wrapper input {
  width: 100%;
  padding: 11px 14px 11px 40px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: var(--font);
  color: var(--gray-800);
  transition: border-color .2s, box-shadow .2s;
  outline: none;
}

.input-wrapper input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* ========== BUTTONS ========== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all .2s;
  border: none;
  outline: none;
}

.btn-primary {
  background: var(--primary);
  color: white;
}
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(37,99,235,.35); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }

.btn-outline {
  background: white;
  color: var(--primary);
  border: 1.5px solid var(--primary);
}
.btn-outline:hover { background: var(--primary-light); }

.btn-ghost {
  background: transparent;
  color: var(--gray-500);
  border: 1.5px solid var(--gray-200);
}
.btn-ghost:hover { background: var(--gray-100); color: var(--gray-700); }

.btn-full { width: 100%; justify-content: center; }

.btn-encrypt {
  padding: 13px 28px;
  font-size: 15px;
}

/* ========== ALERTS ========== */
.alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 16px;
}
.alert-error { background: var(--danger-light); color: var(--danger); }
.alert-success { background: var(--success-light); color: var(--success); }
.alert-warning { background: var(--warning-light); color: var(--warning); }
.hidden { display: none !important; }

/* ========== DASHBOARD LAYOUT ========== */
#dashboard-screen {
  min-height: 100vh;
  flex-direction: row;
}

/* ========== SIDEBAR ========== */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--gray-900);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 100;
  transition: transform .3s;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.sidebar-logo { font-size: 28px; }

.sidebar-title {
  font-size: 14px;
  font-weight: 700;
  color: white;
  line-height: 1.2;
}

.sidebar-subtitle {
  font-size: 11px;
  color: var(--gray-500);
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--gray-500);
  letter-spacing: .08em;
  padding: 8px 8px 6px;
  margin-bottom: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--gray-400);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all .15s;
  margin-bottom: 2px;
  cursor: pointer;
}

.nav-item:hover { background: rgba(255,255,255,.06); color: white; }
.nav-item.active { background: var(--primary); color: white; }

.nav-icon { font-size: 16px; }

.nav-badge {
  margin-left: auto;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 20px;
  font-weight: 600;
}
.nav-badge.soon { background: rgba(255,255,255,.1); color: var(--gray-400); }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  gap: 10px;
}

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

.user-name { font-size: 13px; font-weight: 600; color: white; }
.user-role { font-size: 11px; color: var(--gray-500); }

.btn-logout {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--gray-500);
  font-size: 18px;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  transition: all .15s;
}
.btn-logout:hover { color: var(--danger); background: rgba(220,38,38,.1); }

/* ========== MAIN CONTENT ========== */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  background: white;
  border-bottom: 1px solid var(--gray-200);
  padding: 0 28px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.topbar-left { display: flex; align-items: center; gap: 16px; }

.menu-toggle {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--gray-500);
  display: none;
  padding: 4px;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
}
.breadcrumb-home { color: var(--primary); font-weight: 500; }
.breadcrumb-sep { color: var(--gray-300); }
.breadcrumb-current { color: var(--gray-600); font-weight: 600; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--gray-500);
}

.status-dot {
  width: 8px; height: 8px;
  background: var(--success);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .4; }
}

/* ========== PAGE CONTENT ========== */
.page-content { padding: 28px; flex: 1; }

.page-title { margin-bottom: 24px; }
.page-title h2 { font-size: 22px; font-weight: 700; color: var(--gray-900); margin-bottom: 4px; }
.page-title p { font-size: 13.5px; color: var(--gray-500); }

/* ========== STATS ========== */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: white;
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-100);
}

.stat-icon { font-size: 32px; }
.stat-value { font-size: 24px; font-weight: 700; color: var(--gray-900); }
.stat-label { font-size: 12px; color: var(--gray-500); margin-top: 2px; }

/* ========== PANEL ========== */
.panel {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-100);
  overflow: hidden;
}

.panel-header {
  background: var(--primary);
  color: white;
  padding: 16px 24px;
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

.panel-header-icon { font-size: 18px; }

.panel-body { padding: 28px 24px; }

/* ========== STEPS ========== */
.step-section { margin-bottom: 28px; }

.step-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 14px;
}

.step-number {
  width: 26px; height: 26px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

/* ========== EPS SELECTOR ========== */
.eps-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.eps-option {
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  text-align: center;
  transition: all .2s;
  background: var(--gray-50);
}

.eps-option:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.eps-option.active {
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}

.eps-icon { font-size: 28px; margin-bottom: 6px; }
.eps-name { font-size: 14px; font-weight: 600; color: var(--gray-800); margin-bottom: 4px; }
.eps-status { font-size: 11px; font-weight: 600; }
.eps-status.ready { color: var(--success); }
.eps-status.pending { color: var(--warning); }

/* ========== DROPZONE ========== */
.dropzone {
  border: 2px dashed var(--gray-300);
  border-radius: var(--radius);
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  background: var(--gray-50);
}

.dropzone:hover, .dropzone.drag-over {
  border-color: var(--primary);
  background: var(--primary-light);
}

.dropzone-icon { font-size: 40px; margin-bottom: 10px; }
.dropzone-text { font-size: 15px; font-weight: 600; color: var(--gray-700); margin-bottom: 4px; }
.dropzone-sub { font-size: 12.5px; color: var(--gray-400); margin-bottom: 16px; }

/* ========== FILE LIST ========== */
.file-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  transition: all .15s;
}

.file-item:hover { border-color: var(--primary); background: var(--primary-light); }

.file-icon { font-size: 22px; flex-shrink: 0; }
.file-name { font-size: 13.5px; font-weight: 600; color: var(--gray-800); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-size { font-size: 12px; color: var(--gray-400); flex-shrink: 0; }

.file-remove {
  background: none;
  border: none;
  color: var(--gray-400);
  cursor: pointer;
  font-size: 16px;
  padding: 2px;
  border-radius: 4px;
  transition: all .15s;
  flex-shrink: 0;
}
.file-remove:hover { color: var(--danger); background: var(--danger-light); }

/* ========== ACTION ROW ========== */
.action-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

/* ========== PROGRESS ========== */
.progress-section {
  margin-top: 20px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 16px;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 10px;
}

.progress-bar {
  height: 8px;
  background: var(--gray-200);
  border-radius: 20px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #60a5fa);
  border-radius: 20px;
  width: 0%;
  transition: width .3s;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-content {
    margin-left: 0;
  }
  .menu-toggle { display: block; }
  .stats-row { grid-template-columns: 1fr; }
  .eps-selector { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .login-card { padding: 32px 24px; }
  .page-content { padding: 16px; }
  .panel-body { padding: 20px 16px; }
  .topbar { padding: 0 16px; }
}

/* ========== OVERLAY ========== */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 90;
}
.sidebar-overlay.show { display: block; }

/* ========== ANIMATIONS ========== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn .3s ease; }

/* ========== LOADING SPINNER ========== */
.btn-loading {
  pointer-events: none;
}
.btn-loading span {
  display: inline-block;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.login-logo-img {
  max-width: 180px;
  width: 100%;
  height: auto;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}
