:root {
  --primary: #10b981;
  --primary-hover: #059669;
  --primary-light: #d1fae5;
  --primary-dark: #047857;
  --secondary: #0f172a;
  --danger: #ef4444;
  --danger-light: #fee2e2;
  --danger-hover: #dc2626;
  --bg: #f8fafc;
  --surface: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --border: #e2e8f0;
  --border-focus: #10b981;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-full: 99px;
  --shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.05);
  --shadow-primary: 0 4px 14px 0 rgba(16,185,129,0.2);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text-main); line-height: 1.5; min-height: 100vh; padding-bottom: 100px; }
h1, h2, h3, h4 { font-weight: 800; letter-spacing: -0.02em; }
.text-center { text-align: center; }
.text-xxl { font-size: 2.25rem; font-weight: 900; }
.mb-8 { margin-bottom: 2rem; }
.w-full { width: 100%; }

.gradient-text {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
}

.navbar { position: sticky; top: 0; z-index: 50; background: rgba(255,255,255,0.85); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
.navbar-container { max-width: 900px; margin: 0 auto; padding: 1rem 1.5rem; display: flex; justify-content: space-between; align-items: center; }
.logo { display: flex; align-items: center; gap: 0.75rem; }
.logo-icon { width: 32px; height: 32px; background: linear-gradient(135deg, var(--primary), #0d9488); color: white; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-weight: bold; }
.logo-text { font-size: 1.25rem; color: var(--text-main); }
.step-indicator { font-size: 0.875rem; font-weight: 700; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.05em; }
.progress-bar-bg { width: 100%; height: 4px; background: #f1f5f9; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--primary), #34d399); transition: width 0.5s ease; }

.main-container { max-width: 800px; margin: 4rem auto; padding: 0 1.5rem; }
.section-header { text-align: center; margin-bottom: 2.5rem; }
.section-header h2 { font-size: 2rem; color: var(--text-main); margin-bottom: 0.5rem; }
.section-header p { font-size: 1.125rem; color: var(--text-muted); }

@keyframes slideUpFade { 0% { opacity: 0; transform: translateY(20px) scale(0.98); } 100% { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes fadeIn { 0% { opacity: 0; } 100% { opacity: 1; } }

.step-section { display: none; animation: slideUpFade 0.4s ease forwards; }
.step-section.active { display: block; }
.animated-item { animation: slideUpFade 0.3s ease-out forwards; }

.input-card { position: relative; border-radius: var(--radius-lg); background: var(--surface); transition: var(--transition); }
.large-input { width: 100%; padding: 1.5rem; font-size: 1.5rem; font-weight: 700; border: 2px solid var(--border); border-radius: var(--radius-lg); color: var(--text-main); transition: var(--transition); box-shadow: var(--shadow-sm); }
.center-text { text-align: center; }
.large-input:focus, .list-input:focus { border-color: var(--border-focus); outline: none; box-shadow: 0 0 0 4px var(--primary-light); }

.list-container { display: flex; flex-direction: column; gap: 0.75rem; margin-bottom: 1.5rem; }
.list-row { display: flex; gap: 0.5rem; }
.list-input { flex: 1; padding: 1rem; font-size: 1.125rem; font-weight: 500; border: 2px solid var(--border); border-radius: var(--radius-md); transition: var(--transition); }

button { cursor: pointer; border: none; background: none; font-family: inherit; transition: var(--transition); display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--secondary); color: white; padding: 0.875rem 1.5rem; border-radius: var(--radius-md); font-weight: 700; font-size: 1rem; }
.btn-primary:hover:not(:disabled) { background: #000; transform: translateY(-1px); }
.btn-secondary { background: transparent; color: var(--text-muted); padding: 0.875rem 1.5rem; border-radius: var(--radius-md); font-weight: 700; font-size: 1rem; }
.btn-secondary:hover:not(:disabled) { background: var(--border); color: var(--text-main); }
.btn-dashed { background: rgba(16,185,129,0.05); border: 2px dashed var(--primary); color: var(--primary); padding: 1rem; border-radius: var(--radius-md); font-weight: 700; opacity: 0.8; }
.btn-dashed:hover { opacity: 1; background: rgba(16,185,129,0.1); }
.btn-icon-danger { color: var(--text-light); padding: 0.875rem; border-radius: var(--radius-md); background: white; border: 2px solid transparent; }
.btn-icon-danger:hover { color: var(--danger); background: var(--danger-light); }
.btn-outline { border: 2px solid var(--primary); color: var(--primary-dark); padding: 0.875rem 1.5rem; border-radius: var(--radius-md); font-weight: 700; }
.btn-outline:hover { background: var(--primary-light); }
.btn-text { color: var(--text-light); text-decoration: underline; text-underline-offset: 4px; font-weight: 600; }
.btn-text:hover { color: var(--text-main); }

.btn-green-outline { border: 1px solid var(--primary); color: var(--primary); padding: 0.5rem 0.75rem; border-radius: var(--radius-md); font-size: 0.85rem; font-weight: 600; background: transparent; cursor: pointer; transition: all 0.2s; }
.btn-green-outline:hover { background: var(--primary-light); }
.btn-red-outline { border: 1px solid var(--danger); color: var(--danger); padding: 0.5rem 0.75rem; border-radius: var(--radius-md); font-size: 0.85rem; font-weight: 600; background: transparent; cursor: pointer; transition: all 0.2s; }
.btn-red-outline:hover { background: var(--danger-light); }

.card, .table-card, .chart-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.5rem; }
.shadow { box-shadow: var(--shadow-sm); }
.grid-container { display: grid; grid-template-columns: 1fr; gap: 1.5rem; }
@media(min-width: 640px) { .grid-container { grid-template-columns: repeat(2, 1fr); } }
.subcriteria-card { padding: 1.5rem; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
.subcriteria-card h3 { color: var(--primary-dark); font-size: 1.125rem; margin-bottom: 1rem; border-bottom: 1px solid var(--border); padding-bottom: 0.5rem; }

.pairwise-container { display: flex; flex-direction: column; gap: 2rem; }
.pairwise-group { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 2rem; box-shadow: var(--shadow-sm); }
.pairwise-group h3 { font-size: 1.25rem; color: var(--primary-dark); margin-bottom: 2rem; display: flex; align-items: center; gap: 0.5rem; }
.pairwise-group h3::before { content: ""; display: block; width: 6px; height: 20px; background: var(--primary); border-radius: 4px; }
.comparison-item { margin-bottom: 2.5rem; }
.comparison-item:last-child { margin-bottom: 0; }
.compare-labels { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 1rem; position: relative; }
.lbl-a, .lbl-b { font-weight: 800; font-size: 1.125rem; width: 33%; transition: color 0.3s; }
.lbl-a { text-align: left; }
.lbl-b { text-align: right; }
.active-side { color: var(--primary-dark); }
.inactive-side { color: var(--text-light); }
.saaty-indicator { position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); text-align: center; padding: 0.25rem 0.75rem; border-radius: var(--radius-full); font-size: 0.75rem; font-weight: 800; transition: var(--transition); border: 1px solid transparent; }
.ind-0 { background: var(--bg); color: var(--text-muted); border-color: var(--border); }
.ind-low { background: var(--primary-light); color: var(--primary-dark); border-color: #a7f3d0; }
.ind-mid { background: var(--primary); color: white; box-shadow: var(--shadow-primary); }
.ind-high { background: var(--primary-dark); color: white; box-shadow: var(--shadow-primary); }
.range-wrapper { position: relative; padding-top: 0.5rem; }
.range-center-mark { position: absolute; top: 4px; left: 50%; transform: translateX(-50%); width: 2px; height: 20px; background: var(--border); z-index: 0; }
input[type=range] { -webkit-appearance: none; width: 100%; background: transparent; position: relative; z-index: 1; }
input[type=range]:focus { outline: none; }
input[type=range] { width: 100%; height: 10px; background: #f1f5f9; border-radius: 5px; border: 1px solid #e2e8f0; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; height: 24px; width: 24px; border-radius: 50%; background: var(--primary); border: 2px solid white; box-shadow: 0 2px 5px rgba(0,0,0,0.2); margin-top: -6px; cursor: pointer; transition: transform 0.1s; }
input[type=range]::-webkit-slider-thumb:active { transform: scale(1.15); }
input[type=range]::-moz-range-thumb { height: 24px; width: 24px; border-radius: 50%; background: var(--primary); border: 2px solid white; cursor: pointer; }
.range-ticks { display: flex; justify-content: space-between; padding: 0 10px; margin-top: 0.25rem; font-size: 0.65rem; font-weight: 700; color: var(--text-light); }

.consistency-container { display: flex; flex-direction: column; gap: 1.5rem; }
.cons-card { padding: 1.5rem; border-radius: var(--radius-lg); border-left: 6px solid; background: var(--surface); box-shadow: var(--shadow-sm); }
.cons-card.success { border-left-color: var(--primary); }
.cons-card.error { border-left-color: var(--danger); }
.cons-header { display: flex; justify-content: space-between; align-items: center; }
.cons-header h3 { font-size: 1.25rem; color: var(--text-main); }
.cons-badge { padding: 0.35rem 0.75rem; border-radius: var(--radius-md); font-weight: 800; font-size: 0.875rem; display: flex; align-items: center; gap: 0.5rem; }
.cons-badge.success { background: var(--primary-light); color: var(--primary-dark); }
.cons-badge.error { background: var(--danger-light); color: var(--danger-hover); border: 1px solid #fecaca; }
.cons-details { margin-top: 1.5rem; padding: 1.25rem; background: #fef2f2; border-radius: var(--radius-md); border: 1px solid #fecaca; animation: fadeIn 0.4s; }
.cons-details p { font-weight: 700; color: #991b1b; margin-bottom: 0.75rem; }
.cons-details ul { padding-left: 1.5rem; color: #b91c1c; font-size: 0.9rem; line-height: 1.6; }
.cons-details li { margin-bottom: 0.5rem; }
.consistency-actions { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; margin-top: 2rem; }
.flex-spacer { flex: 1; min-width: 20px; }
.all-consistent-msg { padding: 2rem; background: var(--primary-light); color: var(--primary-dark); border-radius: var(--radius-lg); text-align: center; font-weight: 800; font-size: 1.25rem; border: 1px solid #a7f3d0; }

.scrollable-x { overflow-x: auto; }
.modern-table { width: 100%; border-collapse: collapse; min-width: 600px; }
.modern-table th { padding: 1.25rem 1rem; font-weight: 800; color: var(--primary-dark); text-align: center; border-bottom: 2px solid var(--border); }
.modern-table th:first-child { text-align: left; background: var(--bg); position: sticky; left: 0; z-index: 2; }
.modern-table td { padding: 1rem; border-bottom: 1px solid var(--border); text-align: center; }
.modern-table td:first-child { font-weight: 700; color: var(--text-main); text-align: left; background: var(--surface); position: sticky; left: 0; z-index: 1; box-shadow: 2px 0 5px -2px rgba(0,0,0,0.05); }
.modern-table tr:hover td { background: #f8fafc; }
.score-input { width: 80px; padding: 0.75rem; border: 2px solid var(--border); border-radius: var(--radius-sm); text-align: center; font-family: monospace; font-weight: 700; font-size: 1.125rem; transition: var(--transition); }
.score-input:focus { border-color: var(--primary); outline: none; }

.ranking-container { display: flex; flex-direction: column; gap: 1rem; }
.rank-card { display: flex; flex-direction: column; gap: 1rem; padding: 1.5rem; border-radius: var(--radius-lg); border: 2px solid var(--border); background: var(--surface); transition: var(--transition); }
.rank-card.rank-1 { background: linear-gradient(to right, #f0fdf4, #ffffff); border-color: #a7f3d0; transform: scale(1.02); box-shadow: var(--shadow-md); }
.rank-header { display: flex; justify-content: space-between; align-items: center; }
.rank-info { display: flex; align-items: center; gap: 1rem; }
.rank-badge { width: 48px; height: 48px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 1.25rem; font-weight: 900; background: #f1f5f9; color: var(--text-muted); }
.rank-1 .rank-badge { background: var(--primary); color: white; box-shadow: 0 4px 10px rgba(16,185,129,0.3); }
.rank-name { font-size: 1.5rem; font-weight: 800; color: var(--text-main); }
.rank-score { font-size: 2rem; font-weight: 900; color: var(--text-main); }
.rank-score span { font-size: 1rem; color: var(--text-light); }
.rank-details { display: flex; flex-wrap: wrap; gap: 0.5rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.detail-chip { padding: 0.35rem 0.75rem; background: rgba(255,255,255,0.5); border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 0.875rem; color: var(--text-muted); }
.detail-chip strong { color: var(--text-main); }
.footer-nav { position: fixed; bottom: 0; left: 0; right: 0; background: rgba(255,255,255,0.9); backdrop-filter: blur(12px); border-top: 1px solid var(--border); padding: 1rem 0; z-index: 50; }
.footer-content { max-width: 900px; margin: 0 auto; padding: 0 1.5rem; display: flex; justify-content: space-between; align-items: center; }

/* --- DARK MODE --- */
[data-theme="dark"] {
  --bg: #0f172a;
  --surface: #1e293b;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-light: #64748b;
  --border: #334155;
  --primary-light: rgba(16, 185, 129, 0.15);
  --danger-light: rgba(239, 68, 68, 0.15);
}
[data-theme="dark"] .navbar,
[data-theme="dark"] .footer-nav { background: rgba(30, 41, 59, 0.85); }
[data-theme="dark"] .large-input,
[data-theme="dark"] .list-input,
[data-theme="dark"] .score-input { background: var(--surface); color: var(--text-main); }
[data-theme="dark"] input[type=range] { background: #334155; border-color: #475569; }
[data-theme="dark"] .modern-table th { color: var(--text-main); }
[data-theme="dark"] .rank-card.rank-1 { background: linear-gradient(to right, #1e293b, #0f172a); border-color: var(--primary-dark); }
[data-theme="dark"] .cons-details { background: rgba(239, 68, 68, 0.05); border-color: var(--danger-hover); }
[data-theme="dark"] .cons-details p, [data-theme="dark"] .cons-details ul { color: #fca5a5; }

.btn-theme-toggle { background: transparent; border: 1px solid var(--border); border-radius: 50%; width: 36px; height: 36px; font-size: 1.1rem; color: var(--text-main); cursor: pointer; transition: all 0.2s; display: flex; align-items: center; justify-content: center; }
.btn-theme-toggle:hover { background: var(--surface); transform: scale(1.05); }

/* --- RESPONSIVITE --- */
@media (max-width: 768px) {
  .main-container { margin: 2.5rem auto; padding: 0 1rem; }
  .navbar-container { padding: 1rem; }
  .logo-text { font-size: 1.1rem; }
  .section-header h2 { font-size: 1.6rem; }
  .section-header p { font-size: 1rem; }
  
  .compare-labels { flex-direction: column; align-items: center; justify-content: center; margin-bottom: 2rem; gap: 0.75rem; }
  .lbl-a, .lbl-b { width: 100%; text-align: center; font-size: 1rem; }
  .saaty-indicator { bottom: -2.25rem; font-size: 0.65rem; padding: 0.2rem 0.5rem; }
  
  .consistency-actions { flex-direction: column; width: 100%; gap: 0.75rem; }
  .consistency-actions button, .consistency-actions .btn-text { width: 100%; }
  
  .modern-table td { padding: 0.75rem 0.5rem; }
  .score-input { width: 60px; font-size: 1rem; padding: 0.5rem; }
  .modern-table th { padding: 1rem 0.5rem; font-size: 0.9rem; }
  .table-card { padding: 1rem; }
  
  .rank-info { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
  .rank-card { padding: 1rem; }
  .rank-details { flex-direction: column; }
  
  .footer-content { padding: 0 1rem; }
  .btn-primary, .btn-secondary { padding: 0.75rem 1rem; font-size: 0.9rem; }
}

@media (max-width: 480px) {
  .list-row { flex-direction: column; }
  .list-row button { width: 100%; }
  .large-input { font-size: 1.25rem; padding: 1rem; }
}
