/* ExpertCompta - EBP Style Professional Theme */

:root {
  --ebp-blue: #004b9b;
  --ebp-light-blue: #1c88e5;
  --ebp-text-blue: #1565c0;
  --bg-main: #f5f6f7;
  --border-color: #c0c0c0;
  --border: #d0d0d0;
  --surface: #ffffff;
  --text: #333333;
  --muted: #888888;
  --accent: #1565c0;
  --primary-g: linear-gradient(135deg, #1c88e5, #004b9b);
  --success: #2e7d32;
  --success-bg: #e8f5e9;
  --danger: #c62828;
  --danger-bg: #ffebee;
  --warning: #ef6c00;
  --warning-bg: #fff3e0;
  --info: #1565c0;
  --info-bg: #e3f2fd;
}

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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: var(--bg-main);
  color: var(--text);
  overflow: hidden;
  font-size: 13px;
  user-select: none;
}

.layout { display: flex; flex-direction: column; height: 100vh; }

/* ===== RIBBON ===== */
.ribbon {
  display: flex;
  background-color: var(--ebp-blue);
  color: white;
  align-items: center;
  padding: 0;
  height: 72px;
  -webkit-app-region: drag;
}
.ribbon-brand {
  font-size: 14px; font-weight: 700;
  padding: 0 20px;
  border-right: 1px solid rgba(255,255,255,0.2);
  background: #ffffff; color: var(--ebp-blue);
  height: 100%; display: flex; align-items: center;
  -webkit-app-region: no-drag;
}
.ribbon-menu {
  display: flex; flex: 1; height: 100%;
  -webkit-app-region: no-drag;
}
.ribbon-btn {
  background: transparent; border: none; color: white;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 0 16px; cursor: pointer; height: 100%;
  font-size: 11px; font-family: inherit; gap: 4px;
  border-bottom: 3px solid transparent;
  transition: background 0.15s;
}
.ribbon-btn:hover { background: rgba(255,255,255,0.12); }
.ribbon-btn.active { background: rgba(255,255,255,0.2); border-bottom-color: white; }
.ribbon-btn .icon { font-size: 22px; }
.ribbon-actions {
  display: flex; gap: 6px; padding: 0 10px;
  -webkit-app-region: no-drag;
}

/* Window Controls */
.win-controls {
  display: flex; height: 100%; align-items: stretch;
  -webkit-app-region: no-drag; margin-left: auto;
}
.win-btn {
  background: transparent; border: none; color: white;
  width: 46px; cursor: pointer; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.win-btn:hover { background: rgba(255,255,255,0.15); }
.win-btn.win-close:hover { background: #e81123; }

/* ===== TABS ===== */
.tabs-bar {
  display: flex; background-color: #e5e5e5;
  border-bottom: 1px solid var(--border-color);
  padding: 5px 5px 0;
}
.tab {
  background-color: #f5f6f7; border: 1px solid var(--border-color); border-bottom: none;
  padding: 6px 15px; margin-right: 2px; font-size: 12px; cursor: pointer; color: #555;
}
.tab.active {
  background-color: #ffffff; font-weight: 600;
  margin-bottom: -1px; padding-bottom: 7px; color: var(--ebp-text-blue);
}

/* ===== WORKSPACE ===== */
main {
  flex: 1; display: flex; flex-direction: column;
  background: #ffffff; overflow: hidden;
}
.page-content {
  flex: 1; padding: 15px 30px; overflow-y: auto;
  position: relative; overflow-x: hidden;
}
section { animation: slideIn 0.2s ease-out; }
@keyframes slideIn {
  from { transform: translateX(15px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ===== TILES DASHBOARD ===== */
.tile-grid-container { display: flex; gap: 30px; justify-content: flex-start; }
.tile-column { display: flex; flex-direction: column; gap: 8px; width: 240px; }
.tile-group-title { font-size: 14px; font-weight: 600; color: #333; margin-bottom: 10px; }
.tile {
  display: flex; flex-direction: column; padding: 12px; cursor: pointer;
  min-height: 70px; justify-content: flex-end;
  border: 1px solid transparent; transition: transform 0.1s, box-shadow 0.15s;
}
.tile:hover { transform: scale(1.02); box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.tile-solid { background-color: var(--ebp-light-blue); color: white; }
.tile-outline { background-color: white; border-color: var(--ebp-light-blue); color: var(--ebp-text-blue); }
.tile-icon { font-size: 22px; margin-bottom: auto; font-weight: lighter; }
.tile-text { font-size: 10px; font-weight: 700; text-transform: uppercase; }
.tile-small { flex: 1; min-height: 70px; padding: 10px; }
.tile-half { flex: 1; min-height: 70px; }

/* ===== KPI CARDS ===== */
.kpi-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--border-color);
  padding: 12px 16px; flex: 1; min-width: 180px;
}
.kpi-icon {
  width: 40px; height: 40px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.kpi-label { font-size: 11px; color: var(--muted); font-weight: 400; }
.kpi-value { font-size: 16px; font-weight: 700; color: var(--text); }

/* ===== CARDS ===== */
.card {
  background: var(--surface); border: 1px solid var(--border-color);
  padding: 16px; margin-bottom: 10px;
}
.card-title { font-size: 14px; font-weight: 700; margin-bottom: 10px; color: var(--ebp-blue); }

/* ===== TABLES & FORMS ===== */
table { width: 100%; border-collapse: collapse; border: 1px solid var(--border-color); }
th {
  background-color: #f0f0f0; border: 1px solid var(--border-color);
  padding: 6px 10px; font-size: 11px; text-align: left; font-weight: 600;
}
td { border: 1px solid var(--border-color); padding: 5px 10px; font-size: 12px; }
tr:nth-child(even) { background-color: #fafafa; }
tfoot td { background: #f0f0f0; font-weight: 700; border-top: 2px solid var(--ebp-blue); }

.form-panel {
  border: 1px solid var(--border-color); padding: 12px; margin-bottom: 12px; background: white;
}
.form-panel legend { padding: 0 5px; font-weight: 600; color: var(--ebp-blue); font-size: 13px; }
.form-row { display: flex; align-items: center; margin-bottom: 8px; gap: 12px; }
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group label { width: auto; font-weight: 600; }
label { font-size: 12px; width: 120px; flex-shrink: 0; }
input, select, textarea {
  padding: 5px 8px; border: 1px solid #bbb; font-size: 12px;
  font-family: inherit; background: white;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ebp-blue); box-shadow: 0 0 0 1px var(--ebp-blue); }

/* ===== BUTTONS ===== */
.btn {
  padding: 5px 14px; background-color: #e8e8e8; border: 1px solid #adadad;
  cursor: pointer; font-size: 12px; font-family: inherit;
  display: inline-flex; align-items: center; gap: 4px; transition: background 0.15s;
}
.btn:hover { background-color: #d5d5d5; }
.btn-primary { background-color: var(--ebp-blue); color: white; border-color: var(--ebp-blue); }
.btn-primary:hover { background-color: #003a7a; }
.btn-outline { background: white; border-color: var(--ebp-blue); color: var(--ebp-blue); }
.btn-outline:hover { background: var(--info-bg); }
.btn-danger { background: var(--danger); color: white; border-color: var(--danger); }
.btn-danger:hover { background: #a51d1d; }
.btn-success { background: var(--success); color: white; border-color: var(--success); }
.btn-sm { padding: 3px 8px; font-size: 11px; }

/* ===== BADGES ===== */
.badge {
  display: inline-block; padding: 2px 8px; font-size: 10px; font-weight: 600;
  border-radius: 2px; text-transform: uppercase; letter-spacing: 0.3px;
}
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }

/* ===== MATCH ROWS (Banque) ===== */
.match-row {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 12px; border-bottom: 1px solid #eee;
  transition: background 0.1s;
}
.match-row:hover { background: #f8f9fa; }
.match-row.matched { background: var(--success-bg); opacity: 0.7; }

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center; padding: 30px; color: var(--muted);
  font-size: 13px; font-style: italic;
}

/* ===== TOAST ===== */
.toast {
  position: fixed; bottom: 20px; right: 20px;
  background: var(--ebp-blue); color: white;
  padding: 10px 20px; font-size: 12px; font-weight: 600;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25); z-index: 9999;
  animation: toastIn 0.3s ease-out;
  max-width: 350px;
}
@keyframes toastIn {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ===== GRID ===== */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 15px; }

/* ===== AVATAR ===== */
.avatar {
  display: flex; align-items: center; justify-content: center;
  border-radius: 4px; font-size: 18px; flex-shrink: 0;
}

/* ===== PAGE TITLE ===== */
.page-title { font-size: 16px; font-weight: 700; color: var(--ebp-blue); margin-bottom: 15px; }

/* ===== MODALS ===== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45);
  display: none; align-items: center; justify-content: center; z-index: 1000;
}
.modal-overlay.active { display: flex; }
.modal-content {
  background: #f5f6f7; border: 1px solid var(--ebp-blue);
  width: 640px; max-height: 85vh; display: flex; flex-direction: column;
  box-shadow: 0 8px 30px rgba(0,0,0,0.3);
}
.modal-title {
  background-color: var(--ebp-blue); color: white;
  padding: 8px 15px; font-size: 13px; font-weight: 600;
  display: flex; justify-content: space-between; align-items: center;
}
.modal-body { padding: 15px; overflow-y: auto; }

/* ===== FOOTER ===== */
.app-footer {
  display: flex; justify-content: space-between; align-items: center;
  padding: 3px 15px; border-top: 1px solid #ccc;
  font-size: 11px; background: #f5f6f7; color: var(--muted);
}

/* ===== HIDDEN ===== */
.hidden { display: none !important; }

/* ===== PRINT ===== */
@media print {
  .ribbon, .tabs-bar, .app-footer, .win-controls, .btn, .modal-overlay { display: none !important; }
  body { overflow: visible; font-size: 11px; }
  .layout { height: auto; }
  main { overflow: visible; }
  .page-content { padding: 0; overflow: visible; }
  section { animation: none; }
  .hidden { display: none !important; }
  table { page-break-inside: auto; }
  tr { page-break-inside: avoid; }
}

/* ===== PLAN COMPTABLE TABLE ===== */
.pcm-table tr.pcm-class td { background: var(--ebp-blue); color: white; font-weight: 700; }
.pcm-table tr.pcm-sub td { padding-left: 25px; }

/* ===== TVA SECTION ===== */
.tva-result {
  display: flex; gap: 20px; margin-top: 15px; padding: 15px;
  border: 2px solid var(--ebp-blue); background: var(--info-bg);
}
.tva-result .tva-box {
  flex: 1; text-align: center; padding: 10px;
}
.tva-result .tva-box .tva-amount {
  font-size: 22px; font-weight: 800; color: var(--ebp-blue);
}
.tva-result .tva-box .tva-label {
  font-size: 11px; color: var(--muted); margin-top: 4px;
}
