/* ==========================================================================
   Garde Léna - thème moderne (surcouche Bootstrap 3)
   ========================================================================== */

:root {
	--primary: #4f46e5;
	--primary-dark: #4338ca;
	--primary-light: #eef2ff;
	--success: #059669;
	--success-light: #ecfdf5;
	--danger: #dc2626;
	--danger-light: #fef2f2;
	--info: #0284c7;
	--info-light: #f0f9ff;
	--text: #1f2937;
	--muted: #6b7280;
	--border: #e5e7eb;
	--bg: #f5f7fb;
	--surface: #ffffff;
	--radius: 12px;
	--shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .04);
	--shadow-lg: 0 10px 25px rgba(16, 24, 40, .08);
}

html, body {
	background: var(--bg);
	color: var(--text);
	font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
	font-size: 15px;
	-webkit-font-smoothing: antialiased;
}

body {
	padding-top: 0;
	padding-bottom: 0;
	min-height: 100vh;
	display: flex;
	flex-direction: column;
}

a { color: var(--primary); }
a:hover, a:focus { color: var(--primary-dark); text-decoration: none; }

h1, h2, h3, h4 { font-weight: 600; color: var(--text); letter-spacing: -.01em; }
h2 { font-size: 26px; margin: 0 0 20px; }
h3 { font-size: 19px; margin: 30px 0 15px; }

/* --- Navbar -------------------------------------------------------------- */
.app-navbar {
	background: var(--surface);
	border: 0;
	border-bottom: 1px solid var(--border);
	border-radius: 0;
	box-shadow: var(--shadow);
	margin-bottom: 0;
	position: sticky;
	top: 0;
	z-index: 1000;
}

.app-navbar .navbar-brand {
	font-weight: 700;
	font-size: 19px;
	color: var(--primary) !important;
	display: flex;
	align-items: center;
	gap: 8px;
}

.app-navbar .brand-logo {
	width: 30px;
	height: 30px;
	border-radius: 8px;
	background: linear-gradient(135deg, var(--primary), #7c3aed);
	color: #fff;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 15px;
}

.app-navbar .navbar-nav > li > a {
	color: var(--muted);
	font-weight: 500;
	padding-top: 10px;
	padding-bottom: 10px;
	margin: 5px 2px;
	border-radius: 8px;
	transition: background .15s, color .15s;
}

.app-navbar .navbar-nav > li > a:hover,
.app-navbar .navbar-nav > li > a:focus {
	background: var(--primary-light);
	color: var(--primary);
}

.app-navbar .navbar-nav > li.active > a,
.app-navbar .navbar-nav > li.active > a:hover {
	background: var(--primary-light);
	color: var(--primary);
}

.app-navbar .navbar-toggle { border-color: var(--border); }
.app-navbar .navbar-toggle .icon-bar { background: var(--muted); }

.app-navbar .user-box {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 8px 0;
}

.app-navbar .user-avatar {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	background: var(--primary-light);
	color: var(--primary);
	font-weight: 700;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	text-transform: uppercase;
}

.app-navbar .user-name { color: var(--text); font-weight: 500; }

/* --- Contenu ------------------------------------------------------------- */
.body-content {
	flex: 1;
	padding-top: 30px;
	padding-bottom: 30px;
}

.app-footer {
	border-top: 1px solid var(--border);
	background: var(--surface);
	color: var(--muted);
	font-size: 13px;
	padding: 15px 0;
}

.app-footer p { margin: 0; }

/* Cartes : enveloppe automatiquement le contenu principal */
.page-card {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	padding: 28px;
}

/* --- Tableaux ------------------------------------------------------------ */
.table {
	background: var(--surface);
	border-radius: var(--radius);
	overflow: hidden;
	border: 1px solid var(--border);
	margin-bottom: 20px;
}

.table > thead > tr > th {
	background: #f9fafb;
	color: var(--muted);
	font-size: 12px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: .04em;
	border-bottom: 1px solid var(--border);
	padding: 12px 14px;
}

.table > tbody > tr > td,
.table > tfoot > tr > th,
.table > tfoot > tr > td {
	padding: 12px 14px;
	vertical-align: middle;
	border-top: 1px solid var(--border);
}

.table > tbody > tr:hover > td { background: #fafbff; }

.table > tfoot > tr > th { background: #f9fafb; font-weight: 600; }

.table-striped > tbody > tr:nth-of-type(odd) { background: transparent; }

/* Liens d'action dans les tableaux */
.table td a[href*="/Edit"],
.table td a[href*="/Details"],
.table td a[href*="/Delete"] {
	display: inline-block;
	padding: 3px 10px;
	border-radius: 6px;
	font-size: 13px;
	font-weight: 500;
	background: var(--primary-light);
	color: var(--primary);
	margin: 2px 0;
}

.table td a[href*="/Delete"] { background: var(--danger-light); color: var(--danger); }
.table td a[href*="/Details"] { background: #f3f4f6; color: var(--text); }

/* --- Boutons ------------------------------------------------------------- */
.btn {
	border-radius: 8px;
	font-weight: 500;
	padding: 8px 16px;
	border: 1px solid transparent;
	box-shadow: none;
	transition: background .15s, box-shadow .15s, transform .05s;
}

.btn:active { transform: translateY(1px); box-shadow: none; }
.btn:focus, .btn:active:focus { outline: none; box-shadow: 0 0 0 3px rgba(79, 70, 229, .25); }

.btn-sm { padding: 5px 11px; font-size: 13px; border-radius: 6px; }
.btn-lg { padding: 12px 22px; font-size: 16px; border-radius: 10px; }

.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover, .btn-primary:focus, .btn-primary:active { background: var(--primary-dark); border-color: var(--primary-dark); }

.btn-success { background: var(--success); border-color: var(--success); }
.btn-success:hover, .btn-success:focus { background: #047857; border-color: #047857; }

.btn-danger { background: var(--danger); border-color: var(--danger); }
.btn-danger:hover, .btn-danger:focus { background: #b91c1c; border-color: #b91c1c; }

.btn-info { background: var(--info); border-color: var(--info); }
.btn-info:hover, .btn-info:focus { background: #0369a1; border-color: #0369a1; }

.btn-default { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-default:hover, .btn-default:focus { background: #f9fafb; border-color: #d1d5db; }

/* Liens "Nouveau..." / "Retour" transformés en boutons discrets */
.body-content > p > a[href$="/Create"],
.body-content > p > a[href$="/Resume"] {
	display: inline-block;
	padding: 8px 16px;
	border-radius: 8px;
	background: var(--primary);
	color: #fff;
	font-weight: 500;
}

.body-content > p > a[href$="/Resume"] { background: var(--surface); color: var(--primary); border: 1px solid var(--border); }
.body-content > p > a:hover { opacity: .92; }

/* --- Formulaires --------------------------------------------------------- */
input, select, textarea { max-width: none; }

form .form-group { margin-bottom: 18px; max-width: 520px; }

.control-label, form label {
	font-weight: 500;
	color: var(--text);
	margin-bottom: 6px;
}

.form-control {
	height: 40px;
	border-radius: 8px;
	border: 1px solid #d1d5db;
	box-shadow: none;
	padding: 8px 12px;
	font-size: 15px;
	transition: border-color .15s, box-shadow .15s;
}

.table .form-control { height: 36px; }

.form-control:focus {
	border-color: var(--primary);
	box-shadow: 0 0 0 3px rgba(79, 70, 229, .15);
}

.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.field-validation-error { font-size: 13px; }

.validation-summary-errors ul {
	list-style: none;
	padding: 12px 16px;
	background: var(--danger-light);
	border-radius: 8px;
	color: var(--danger);
}

.alert { border-radius: 10px; border: 0; }
.alert-danger { background: var(--danger-light); color: var(--danger); }

/* --- Listes de détails --------------------------------------------------- */
dl.row {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 20px 10px;
	margin: 0 0 20px;
	box-shadow: var(--shadow);
}

dl.row dt { color: var(--muted); font-weight: 500; padding: 6px 15px; }
dl.row dd { padding: 6px 15px; margin-bottom: 0; }

/* Grille col-sm pour dl (Bootstrap 3 n'a pas .row sur dl) */
@media (min-width: 768px) {
	dl.row { display: flex; flex-wrap: wrap; }
	dl.row .col-sm-2 { width: 25%; }
	dl.row .col-sm-10 { width: 75%; }
}

/* --- Accueil (tuiles) ---------------------------------------------------- */
.home-hero { margin-bottom: 30px; }
.home-hero h2 { font-size: 30px; margin-bottom: 6px; }
.home-hero p { color: var(--muted); font-size: 16px; }

.tile-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
	gap: 18px;
}

.tile {
	display: flex;
	flex-direction: column;
	gap: 12px;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 22px;
	box-shadow: var(--shadow);
	color: var(--text);
	transition: transform .15s, box-shadow .15s, border-color .15s;
}

.tile:hover, .tile:focus {
	transform: translateY(-3px);
	box-shadow: var(--shadow-lg);
	border-color: var(--primary);
	color: var(--text);
}

.tile-icon {
	width: 46px;
	height: 46px;
	border-radius: 12px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 22px;
}

.tile-title { font-size: 17px; font-weight: 600; }
.tile-desc { color: var(--muted); font-size: 14px; }

.tile-indigo .tile-icon { background: var(--primary-light); color: var(--primary); }
.tile-violet .tile-icon { background: #f5f3ff; color: #7c3aed; }
.tile-sky .tile-icon { background: var(--info-light); color: var(--info); }
.tile-emerald .tile-icon { background: var(--success-light); color: var(--success); }
.tile-amber .tile-icon { background: #fffbeb; color: #d97706; }
.tile-pink .tile-icon { background: #fdf2f8; color: #db2777; }

/* --- Résumé des frais ---------------------------------------------------- */
.stat-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
	gap: 18px;
	margin-bottom: 10px;
}

.stat-card {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	padding: 18px 20px;
}

.stat-label { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .04em; }
.stat-value { font-size: 26px; font-weight: 700; margin-top: 4px; }

/* --- Connexion ----------------------------------------------------------- */
.login-wrapper {
	display: flex;
	justify-content: center;
	align-items: center;
	min-height: 60vh;
}

.login-card {
	width: 100%;
	max-width: 400px;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 16px;
	box-shadow: var(--shadow-lg);
	padding: 36px;
}

.login-card h2 { text-align: center; margin-bottom: 6px; }
.login-card .login-sub { text-align: center; color: var(--muted); margin-bottom: 25px; }
.login-card .form-group { max-width: none; }
.login-card .btn { width: 100%; padding: 11px; }

/* --- Justificatifs ------------------------------------------------------- */
.justif-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; margin-bottom: 18px; }
.justif-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.justif-preview { display: flex; align-items: center; justify-content: center; height: 130px; background: #f9fafb; border-radius: 8px; overflow: hidden; }
.justif-preview img { max-width: 100%; max-height: 100%; object-fit: cover; }
.justif-icon { font-size: 46px; }
.justif-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.justif-meta { color: var(--muted); font-size: 12px; }
.justif-actions { display: flex; gap: 6px; margin-top: 4px; }
.justif-upload { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; background: var(--surface); border: 1px dashed #c7d2fe; border-radius: var(--radius); padding: 14px; margin-bottom: 10px; }
.justif-upload .form-control { max-width: 360px; height: auto; padding: 6px; }

.justif-badge { display: inline-flex; align-items: center; gap: 4px; margin-left: 8px; padding: 2px 9px; border-radius: 999px; background: #dcfce7; color: #166534; border: 1px solid #86efac; font-size: 12px; font-weight: 600; white-space: nowrap; vertical-align: middle; }

/* --- Responsive ---------------------------------------------------------- */
@media (max-width: 767px) {
	.body-content { padding-top: 20px; }
	h2 { font-size: 22px; }
	.table { display: block; overflow-x: auto; white-space: nowrap; }
	.app-navbar .user-box { padding: 0 15px 10px; }
}
