/* ═══════════════════════════════════════════════════════════════
   AML Platform — Stylesheet
   Atlantic Maritime Line · Plateforme Documentaire
   ═══════════════════════════════════════════════════════════════ */

:root {
  --navy: #0B1D3A; --navy-light: #132B52; --navy-mid: #1A3A6B;
  --ocean: #1B6B93; --teal: #2AA5A0; --teal-light: #3CCBC5;
  --gold: #D4A853; --gold-light: #E8C77B;
  --sand: #F5F0E8; --sand-light: #FAF7F2; --white: #FFFFFF;
  --gray-100: #F7F8FA; --gray-200: #E8ECF1; --gray-300: #CBD2DC;
  --gray-400: #8E99A8; --gray-500: #5A6577; --gray-600: #3D4654;
  --red: #C94444; --green: #2E8B57; --orange: #D48C2E;
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'DM Sans', -apple-system, sans-serif;
  --shadow-sm: 0 1px 3px rgba(11,29,58,0.08);
  --shadow-md: 0 4px 16px rgba(11,29,58,0.1);
  --shadow-lg: 0 8px 32px rgba(11,29,58,0.14);
  --radius: 10px; --radius-lg: 16px;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: var(--font-body); background: var(--sand-light); color: var(--navy); min-height: 100vh; -webkit-font-smoothing: antialiased; display: flex; flex-direction: column; }
a { color: var(--ocean); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Topbar ── */
.topbar { background: linear-gradient(135deg, var(--navy), var(--navy-light)); padding: 0 32px; height: 64px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 100; box-shadow: 0 2px 12px rgba(0,0,0,0.2); }
.topbar-brand { display: flex; align-items: center; gap: 14px; text-decoration: none; }
.topbar-logo { width: 36px; height: 36px; background: linear-gradient(135deg, var(--teal), var(--ocean)); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-family: var(--font-display); color: white; font-size: 16px; font-weight: 700; text-decoration: none; }
.topbar-title { font-family: var(--font-display); font-size: 18px; font-weight: 600; color: white; }
.topbar-sub { font-size: 11px; color: var(--gray-300); margin-top: 1px; letter-spacing: 0.5px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.topbar-btn { background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.12); color: var(--gray-200); padding: 7px 14px; border-radius: 8px; font-size: 13px; cursor: pointer; font-family: var(--font-body); transition: all 0.2s; display: flex; align-items: center; gap: 6px; text-decoration: none; }
.topbar-btn:hover { background: rgba(255,255,255,0.15); color: white; text-decoration: none; }
.topbar-btn.gold { background: rgba(212,168,83,0.15); border-color: var(--gold); color: var(--gold-light); }
.lang-switch { display: flex; background: rgba(255,255,255,0.06); border-radius: 6px; overflow: hidden; border: 1px solid rgba(255,255,255,0.1); }
.lang-btn { padding: 6px 12px; font-size: 12px; font-weight: 600; text-decoration: none; transition: all 0.2s; color: var(--gray-400); }
.lang-btn.active { background: var(--ocean); color: white; }
.lang-btn:hover { text-decoration: none; }

/* ── Badges ── */
.level-badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; letter-spacing: 0.3px; white-space: nowrap; }
.badge-n1 { background: var(--gray-200); color: var(--gray-600); }
.badge-n2 { background: #D6EAF8; color: #1A5276; }
.badge-n3 { background: #D5F5E3; color: #1E6E3E; }
.badge-n4 { background: #FDEBD0; color: #9A5E0B; }
.badge-n5 { background: rgba(212,168,83,0.2); color: #8B6914; }
.badge-active { background: rgba(46,139,87,0.1); color: var(--green); }
.badge-pending { background: rgba(212,140,46,0.1); color: var(--orange); }
.badge-suspended { background: rgba(201,68,68,0.1); color: var(--red); }
.status-badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.status-dot.active { background: var(--green); }
.status-dot.pending { background: var(--orange); }
.status-dot.suspended { background: var(--red); }

/* ── Layout ── */
.app-layout { display: flex; flex: 1; }
.sidebar { width: 240px; background: var(--white); border-right: 1px solid var(--gray-200); padding: 20px 0; flex-shrink: 0; display: flex; flex-direction: column; min-height: calc(100vh - 64px - 49px); }
.sidebar-section { padding: 0 16px; margin-bottom: 24px; }
.sidebar-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.2px; color: var(--gray-400); padding: 0 12px; margin-bottom: 8px; }
.sidebar-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; font-size: 14px; color: var(--gray-500); transition: all 0.15s; font-weight: 500; text-decoration: none; }
.sidebar-item:hover { background: var(--gray-100); color: var(--navy); text-decoration: none; }
.sidebar-item.active { background: rgba(27,107,147,0.08); color: var(--ocean); font-weight: 600; }
.sidebar-item svg { flex-shrink: 0; }
.sidebar-user { margin-top: auto; padding: 16px; border-top: 1px solid var(--gray-200); }
.sidebar-user-info { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; background: var(--gray-100); }
.sidebar-avatar { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, var(--ocean), var(--teal)); display: flex; align-items: center; justify-content: center; color: white; font-size: 13px; font-weight: 700; flex-shrink: 0; }
.sidebar-user-name { font-size: 13px; font-weight: 600; }
.sidebar-user-level { font-size: 11px; color: var(--gray-400); }
.main-content { flex: 1; padding: 32px; max-width: 1100px; overflow-y: auto; }

/* ── Page Header ── */
.page-header { margin-bottom: 28px; }
.page-title { font-family: var(--font-display); font-size: 26px; font-weight: 600; color: var(--navy); margin-bottom: 6px; }
.page-subtitle { font-size: 14px; color: var(--gray-400); }

/* ── Cards ── */
.card { background: var(--white); border-radius: var(--radius-lg); border: 1px solid var(--gray-200); box-shadow: var(--shadow-sm); overflow: hidden; }
.card + .card { margin-top: 20px; }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--gray-200); display: flex; align-items: center; justify-content: space-between; }
.card-title { font-size: 15px; font-weight: 600; color: var(--navy); }
.card-body { padding: 20px; }

/* ── Stats Grid ── */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--white); border-radius: var(--radius); border: 1px solid var(--gray-200); padding: 20px; box-shadow: var(--shadow-sm); }
.stat-icon { width: 36px; height: 36px; border-radius: 8px; display: flex; align-items: center; justify-content: center; margin-bottom: 12px; font-size: 18px; }
.stat-icon.blue { background: rgba(27,107,147,0.1); }
.stat-icon.green { background: rgba(46,139,87,0.1); }
.stat-icon.gold { background: rgba(212,168,83,0.1); }
.stat-icon.teal { background: rgba(42,165,160,0.1); }
.stat-value { font-family: var(--font-display); font-size: 28px; font-weight: 700; color: var(--navy); }
.stat-label { font-size: 12px; color: var(--gray-400); margin-top: 4px; font-weight: 500; }

/* ── Tables ── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { text-align: left; padding: 12px 16px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; color: var(--gray-400); background: var(--gray-100); border-bottom: 1px solid var(--gray-200); }
.data-table td { padding: 12px 16px; font-size: 13px; border-bottom: 1px solid var(--gray-200); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(27,107,147,0.02); }
.doc-title-cell { display: flex; align-items: center; gap: 10px; }
.doc-icon { width: 32px; height: 32px; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; }
.doc-icon.accessible { background: rgba(27,107,147,0.08); color: var(--ocean); }
.doc-icon.locked { background: var(--gray-100); color: var(--gray-300); }
.doc-name { font-weight: 500; }
.doc-cat { font-size: 11px; color: var(--gray-400); margin-top: 2px; }

/* ── Buttons ── */
.btn { padding: 6px 14px; border-radius: 6px; font-size: 12px; font-weight: 600; border: none; cursor: pointer; font-family: var(--font-body); transition: all 0.15s; display: inline-flex; align-items: center; gap: 5px; text-decoration: none; }
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--ocean); color: white; }
.btn-primary:hover { background: var(--navy-mid); }
.btn-outline { background: transparent; border: 1px solid var(--gray-300); color: var(--gray-500); }
.btn-outline:hover { border-color: var(--ocean); color: var(--ocean); }
.btn-sm { padding: 4px 10px; font-size: 11px; }
.btn-danger { background: rgba(201,68,68,0.1); color: var(--red); }
.btn-danger:hover { background: rgba(201,68,68,0.2); }
.btn-success { background: rgba(46,139,87,0.1); color: var(--green); }
.btn-success:hover { background: rgba(46,139,87,0.2); }
.btn-gold { background: rgba(212,168,83,0.12); color: #8B6914; }
.btn-lg { padding: 12px 28px; font-size: 15px; }
.btn-locked { color: var(--gray-400); cursor: default; pointer-events: none; }

/* ── Alerts ── */
.alert { padding: 14px 18px; border-radius: 8px; font-size: 14px; margin-bottom: 20px; font-weight: 500; }
.alert-success { background: rgba(46,139,87,0.08); border: 1px solid rgba(46,139,87,0.2); color: var(--green); }
.alert-error { background: rgba(201,68,68,0.08); border: 1px solid rgba(201,68,68,0.2); color: var(--red); }
.alert-warning { background: rgba(212,168,83,0.08); border: 1px solid rgba(212,168,83,0.2); color: #8B6914; }
.alert-info { background: rgba(27,107,147,0.04); border: 1px solid rgba(27,107,147,0.1); color: var(--gray-500); }

/* ── Forms ── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: var(--gray-500); margin-bottom: 6px; }
.form-input, .form-select { width: 100%; padding: 10px 14px; border: 1px solid var(--gray-200); border-radius: 8px; font-size: 14px; font-family: var(--font-body); color: var(--navy); transition: border-color 0.2s; background: var(--gray-100); }
.form-input:focus, .form-select:focus { outline: none; border-color: var(--ocean); background: white; box-shadow: 0 0 0 3px rgba(27,107,147,0.08); }
.form-input::placeholder { color: var(--gray-300); }
textarea.form-input { resize: vertical; min-height: 80px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.form-hint { font-size: 11px; color: var(--gray-400); margin-top: 4px; }

/* ── Toolbar / Search ── */
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.search-input { flex: 1; min-width: 200px; padding: 9px 14px 9px 36px; border: 1px solid var(--gray-200); border-radius: 8px; font-size: 13px; font-family: var(--font-body); background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238E99A8' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E") 12px center no-repeat; color: var(--navy); }
.search-input:focus { outline: none; border-color: var(--ocean); box-shadow: 0 0 0 3px rgba(27,107,147,0.08); }
.filter-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-pill { padding: 6px 12px; border-radius: 20px; font-size: 12px; font-weight: 500; border: 1px solid var(--gray-200); background: white; color: var(--gray-500); cursor: pointer; transition: all 0.15s; font-family: var(--font-body); text-decoration: none; }
.filter-pill:hover { border-color: var(--ocean); color: var(--ocean); text-decoration: none; }
.filter-pill.active { background: var(--ocean); color: white; border-color: var(--ocean); }

/* ── Audit type badges ── */
.audit-type { padding: 3px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.audit-login { background: rgba(27,107,147,0.1); color: var(--ocean); }
.audit-view { background: rgba(42,165,160,0.1); color: var(--teal); }
.audit-download { background: rgba(212,168,83,0.1); color: #8B6914; }
.audit-admin { background: rgba(201,68,68,0.1); color: var(--red); }

/* ── Elevate tip ── */
.elevate-tip { margin-top: 20px; padding: 16px 20px; background: rgba(27,107,147,0.04); border-radius: 10px; border: 1px solid rgba(27,107,147,0.1); font-size: 13px; color: var(--gray-500); }

/* ── Login Page ── */
.login-screen { min-height: 100vh; display: flex; background: linear-gradient(135deg, var(--navy) 0%, #0E244A 40%, var(--navy-mid) 100%); position: relative; overflow: hidden; }
.login-screen::before { content: ''; position: absolute; inset: -50%; width: 200%; height: 200%; background: radial-gradient(ellipse at 30% 50%, rgba(27,107,147,0.15), transparent 50%), radial-gradient(ellipse at 70% 80%, rgba(42,165,160,0.08), transparent 40%); }
.login-left { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 60px 80px; position: relative; z-index: 1; }
.login-brand { margin-bottom: 48px; }
.login-logo { width: 56px; height: 56px; background: linear-gradient(135deg, var(--teal), var(--ocean)); border-radius: 14px; display: flex; align-items: center; justify-content: center; font-family: var(--font-display); color: white; font-size: 24px; font-weight: 700; margin-bottom: 20px; box-shadow: 0 8px 24px rgba(42,165,160,0.3); }
.login-brand h1 { font-family: var(--font-display); font-size: 32px; font-weight: 600; color: white; margin-bottom: 8px; }
.login-brand p { color: var(--gray-300); font-size: 14px; letter-spacing: 1px; }
.login-route { display: flex; align-items: center; gap: 16px; margin-top: 40px; padding: 20px 24px; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08); border-radius: 12px; }
.route-port { text-align: center; color: var(--gray-300); font-size: 12px; }
.route-port strong { display: block; color: white; font-size: 14px; font-family: var(--font-display); margin-bottom: 2px; }
.route-line { flex: 1; height: 2px; background: linear-gradient(90deg, var(--teal), var(--ocean), var(--teal)); border-radius: 1px; }
.login-right { width: 440px; display: flex; align-items: center; justify-content: center; padding: 40px; position: relative; z-index: 1; }
.login-card { width: 100%; background: var(--white); border-radius: var(--radius-lg); box-shadow: 0 16px 48px rgba(11,29,58,0.18); padding: 36px; }
.login-card h2 { font-family: var(--font-display); font-size: 22px; font-weight: 600; margin-bottom: 24px; color: var(--navy); }
.btn-login { width: 100%; padding: 12px; background: linear-gradient(135deg, var(--ocean), var(--navy-mid)); color: white; border: none; border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer; font-family: var(--font-body); transition: all 0.2s; }
.btn-login:hover { box-shadow: 0 4px 12px rgba(27,107,147,0.3); transform: translateY(-1px); }
.login-footer { text-align: center; margin-top: 20px; font-size: 11px; color: var(--gray-400); }
.login-lang { position: absolute; top: 24px; right: 24px; z-index: 10; }
.login-links { text-align: center; margin-top: 16px; font-size: 13px; }
.login-links a { color: var(--ocean); }

/* ── Public Hero ── */
.public-hero { background: linear-gradient(135deg, var(--navy), var(--navy-mid)); padding: 60px 40px; color: white; border-radius: var(--radius-lg); margin-bottom: 24px; position: relative; overflow: hidden; }
.public-hero::before { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse at 80% 20%, rgba(42,165,160,0.2), transparent 60%); }
.public-hero h1 { font-family: var(--font-display); font-size: 30px; font-weight: 600; margin-bottom: 16px; position: relative; }
.public-hero p { font-size: 15px; line-height: 1.7; color: var(--gray-300); max-width: 640px; position: relative; }
.public-route-bar { display: flex; align-items: center; gap: 20px; margin-top: 28px; padding: 16px 20px; background: rgba(255,255,255,0.06); border-radius: 10px; border: 1px solid rgba(255,255,255,0.1); position: relative; flex-wrap: wrap; }
.port-name { font-weight: 600; font-size: 14px; color: white; }
.port-country { font-size: 11px; color: var(--gray-400); }
.route-arrow { color: var(--teal); font-size: 20px; }

/* ── Welcome Box ── */
.welcome-box { margin-top: 20px; padding: 24px; background: rgba(27,107,147,0.04); border-radius: 12px; border: 1px dashed var(--ocean); }
.welcome-box h3 { font-family: var(--font-display); font-size: 18px; margin-bottom: 8px; }
.welcome-box p { font-size: 14px; color: var(--gray-500); line-height: 1.6; }

/* ── Register Card ── */
.register-card { background: var(--white); border-radius: var(--radius-lg); border: 1px solid var(--gray-200); padding: 32px; box-shadow: var(--shadow-md); }
.register-card h2 { font-family: var(--font-display); font-size: 20px; margin-bottom: 6px; }
.register-card .sub { font-size: 13px; color: var(--gray-400); margin-bottom: 24px; }

/* ── Footer ── */
.app-footer { padding: 16px 32px; border-top: 1px solid var(--gray-200); display: flex; justify-content: space-between; font-size: 11px; color: var(--gray-400); background: white; }

/* ── Pagination ── */
.pagination { display: flex; gap: 4px; justify-content: center; margin-top: 20px; }
.pagination a, .pagination span { padding: 6px 12px; border-radius: 6px; font-size: 13px; border: 1px solid var(--gray-200); color: var(--gray-500); text-decoration: none; }
.pagination a:hover { border-color: var(--ocean); color: var(--ocean); }
.pagination .active { background: var(--ocean); color: white; border-color: var(--ocean); }

/* ── Viewer ── */
.viewer-toolbar { background: var(--navy); padding: 12px 20px; display: flex; align-items: center; justify-content: space-between; color: white; position: sticky; top: 64px; z-index: 50; }
.viewer-toolbar a { color: var(--gray-300); text-decoration: none; font-size: 13px; }
.viewer-toolbar a:hover { color: white; }
.viewer-info { font-size: 13px; color: var(--gray-300); }
.viewer-container { background: var(--gray-600); padding: 20px; min-height: 60vh; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.viewer-page { background: white; box-shadow: var(--shadow-lg); max-width: 800px; width: 100%; }
.viewer-page canvas { width: 100%; display: block; }
.viewer-readonly-notice { background: rgba(212,168,83,0.15); padding: 10px 20px; text-align: center; font-size: 13px; color: #8B6914; font-weight: 500; }

/* ── Action buttons in table ── */
.action-btns { display: flex; gap: 4px; flex-wrap: wrap; }

/* ── Empty state ── */
.empty-state { text-align: center; padding: 60px 20px; color: var(--gray-400); }
.empty-state .icon { font-size: 48px; opacity: 0.4; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* ── Document protection indicators ── */
.doc-protection { display: flex; gap: 6px; margin-top: 4px; }
.doc-protection span { font-size: 10px; padding: 2px 6px; border-radius: 3px; font-weight: 600; }
.prot-watermark { background: rgba(27,107,147,0.1); color: var(--ocean); }
.prot-readonly { background: rgba(212,168,83,0.1); color: #8B6914; }
.prot-locked { background: rgba(201,68,68,0.1); color: var(--red); }

/* ── Responsive ── */
@media (max-width: 900px) {
  .login-screen { flex-direction: column; }
  .login-left { padding: 40px 24px; }
  .login-right { width: 100%; padding: 0 24px 40px; }
  .login-route { display: none; }
  .sidebar { display: none; }
  .main-content { padding: 20px 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .app-footer { flex-direction: column; gap: 4px; text-align: center; }
  .topbar { padding: 0 16px; }
  .topbar-sub { display: none; }
}

@media (max-width: 600px) {
  .stats-grid { grid-template-columns: 1fr; }
  .data-table { font-size: 12px; }
  .data-table th, .data-table td { padding: 8px 10px; }
  .toolbar { flex-direction: column; align-items: stretch; }
}
