/* CoproSphere custom styles */
:root { color-scheme: light dark; }

/***** Utilities *****/
.container { max-width: 80rem; margin-inline: auto; }

/***** Components *****/
.card { background: #ffffff; border: 1px solid #e2e8f0; border-radius: 0.5rem; box-shadow: 0 1px 2px rgba(0,0,0,0.04); }
.dark .card { background: #0f172a; border-color: #1f2937; }
.card-header { padding: 0.75rem 1rem; border-bottom: 1px solid #e2e8f0; font-weight: 500; }
.dark .card-header { border-color: #1f2937; }
.card-body { padding: 1rem; }

.table { width: 100%; font-size: 0.875rem; border-collapse: collapse; }
.table th { text-align: left; color: #64748b; font-weight: 500; border-bottom: 1px solid #e2e8f0; padding: 0 0 0.5rem 0; }
.dark .table th { border-color: #1f2937; }
.table td { padding: 0.5rem 0; border-bottom: 1px solid #f1f5f9; }
.dark .table td { border-color: #1f2937; }

.input { width: 100%; padding: 0.5rem 0.75rem; border-radius: 0.375rem; border: 1px solid #cbd5e1; background: #ffffff; color: inherit; }
.dark .input { border-color: #334155; background: #0b1220; }
.select { width: 100%; padding: 0.5rem 0.75rem; border-radius: 0.375rem; border: 1px solid #cbd5e1; background: #ffffff; color: inherit; }
.dark .select { border-color: #334155; background: #0b1220; }
.button { display: inline-flex; align-items: center; justify-content: center; height: 36px; padding: 0 14px; border-radius: 0.55rem; font-size: 0.875rem; font-weight: 600; background: #10b981; color: #ffffff; box-shadow: 0 1px 0 rgba(0,0,0,0.05) inset, 0 1px 1px rgba(0,0,0,0.06); transition: filter .15s ease, transform .06s ease; }
.button:hover { filter: brightness(0.96); }
.button:active { transform: translateY(1px); }
.button-secondary { display: inline-flex; align-items: center; justify-content: center; height: 36px; padding: 0 14px; border-radius: 0.55rem; font-size: 0.875rem; font-weight: 600; border: 1px solid #1C6A6A; background: transparent; color: #155353; transition: background-color .15s ease, border-color .15s ease, color .15s ease; }
.button-secondary:hover { background: rgba(28,106,106,0.08); border-color: #155353; color: #0f3440; }
.button-secondary:focus, .button-secondary:focus-visible { outline: none; box-shadow: 0 0 0 2px rgba(28,106,106,0.25); }
.button-secondary:active { transform: none; filter: none; background: rgba(28,106,106,0.12); }
.dark .button-secondary { border-color: #1C6A6A; background: transparent; color: #7dd3fc; }
.dark .button-secondary:hover { background: rgba(12,28,36,0.35); border-color: #1C6A6A; color: #a5f3fc; }
.dark .button-secondary:focus, .dark .button-secondary:focus-visible { outline: none; box-shadow: 0 0 0 2px rgba(28,106,106,0.35); }
.dark .button-secondary:active { background: rgba(12,28,36,0.5); }

/* Ghost (neutre) for Mode */
.button-ghost { display: inline-flex; align-items: center; justify-content: center; height: 36px; padding: 0 14px; border-radius: 0.55rem; font-size: 0.875rem; font-weight: 600; border: 1px solid #94a3b8; background: rgba(248,250,252,0.35); color: #0f172a; transition: background-color .15s ease, border-color .15s ease, color .15s ease; }
.button-ghost:hover { background: #e2e8f0; }
.dark .button-ghost { border-color: #475569; background: rgba(15,23,42,0.35); color: #e2e8f0; }
.dark .button-ghost:hover { background: #334155; }

/* Subtle icon-sized button */
.button-icon { display: inline-flex; align-items: center; justify-content: center; height: 28px; min-width: 28px; padding: 0 8px; border-radius: 0.5rem; font-size: 0.8rem; border: 1px solid #1C6A6A; background: transparent; color: #155353; }
.button-icon:hover { background: rgba(28,106,106,0.08); border-color: #155353; }
.dark .button-icon { border-color: #1C6A6A; color: #7dd3fc; }
.dark .button-icon:hover { background: rgba(12,28,36,0.35); }

.button-danger { display: inline-flex; align-items: center; justify-content: center; height: 36px; padding: 0 14px; border-radius: 0.5rem; font-size: 0.875rem; font-weight: 600; border: 1px solid #dc2626; color: #dc2626; background: transparent; transition: background-color .15s ease, color .15s ease; }
.button-danger:hover { background: rgba(220,38,38,0.08); }
.dark .button-danger { border-color: #f87171; color: #fecaca; }
.dark .button-danger:hover { background: rgba(248,113,113,0.12); }

.button-danger-solid { display: inline-flex; align-items: center; justify-content: center; height: 36px; padding: 0 14px; border-radius: 0.55rem; font-size: 0.875rem; font-weight: 600; background: #ef4444; color: #fff; border: 1px solid #ef4444; box-shadow: 0 1px 0 rgba(0,0,0,0.05) inset; transition: filter .15s ease, background-color .15s ease, transform .06s ease; }
.button-danger-solid:hover { filter: brightness(0.95); }
.dark .button-danger-solid { background: #dc2626; border-color: #dc2626; color: #fff; }

/* Icon spacing helper */
.btn-icon { margin-right: 0.5rem; display: inline-block; }

/* Uniform width helper for footer actions */
.btn { width: 132px; text-align: center; justify-content: center; }

.badge { display: inline-flex; align-items: center; padding: 0.125rem 0.5rem; border-radius: 0.375rem; font-size: 0.75rem; background: #f1f5f9; border: 1px solid #e2e8f0; }
.dark .badge { background: #1f2937; border-color: #334155; }
/* Badge variants */
.badge-blue { background: #e0f2fe; border-color: #bae6fd; color: #075985; }
.dark .badge-blue { background: #0b1220; border-color: #1e293b; color: #7dd3fc; }
.badge-orange { background: #fff7ed; border-color: #ffedd5; color: #9a3412; }
.dark .badge-orange { background: #1f1307; border-color: #7c2d12; color: #fdba74; }
.badge-green { background: #ecfdf5; border-color: #d1fae5; color: #065f46; }
.dark .badge-green { background: #0a1f1a; border-color: #064e3b; color: #6ee7b7; }
.badge-gray { background: #f3f4f6; border-color: #e5e7eb; color: #374151; }
.dark .badge-gray { background: #111827; border-color: #374151; color: #9ca3af; }

/* Placeholder for logo alignment if missing */
.logo-fallback { width: 40px; height: 40px; border-radius: 9999px; background: #1C6A6A; display: inline-block; }

/* Progress bars */
.progress { width: 100%; height: 10px; border-radius: 6px; background: #e2e8f0; overflow: hidden; }
.dark .progress { background: #1f2937; }
.progress-bar { height: 100%; border-radius: 6px; transition: width .3s ease; background: #1C6A6A; }

/* Table totals (tfoot) */
.table tfoot tr { background: #f8fafc; border-top: 1px solid #e2e8f0; }
.dark .table tfoot tr { background: #0b1220; border-top-color: #1f2937; }

/* Analytics section: prevent infinite page growth */
.card-body.analytics { max-height: 85vh; overflow-y: auto; }
.dark .card-body.analytics { scrollbar-color: #475569 transparent; }

/* Mode toggle switch */
.toggle { position: relative; display: inline-flex; align-items: center; height: 36px; width: 132px; border-radius: 9999px; border: 1px solid #94a3b8; background: linear-gradient(90deg, #e2e8f0, #cbd5e1); box-shadow: inset 0 1px 0 rgba(255,255,255,0.35), inset 0 -1px 0 rgba(0,0,0,0.06); transition: background-color .2s ease, border-color .2s ease; overflow: hidden; }
.toggle:hover { filter: brightness(0.98); }
.dark .toggle { border-color: #475569; background: linear-gradient(90deg, #111827, #1f2937); }
.toggle-thumb { position: absolute; top: 3px; left: 3px; right: auto; height: 30px; width: 30px; border-radius: 9999px; background: #ffffff; color: #111827; display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 2px 6px rgba(0,0,0,0.2); transition: left .2s ease, right .2s ease, background-color .2s ease, color .2s ease; }
.dark .toggle-thumb { background: #f9fafb; color: #111827; left: auto; right: 3px; }
.toggle-icon { height: 18px; width: 18px; display: block; }
.toggle .icon-moon { display: none; }
.toggle .icon-sun { display: block; }
.dark .toggle .icon-sun { display: none; }
.dark .toggle .icon-moon { display: block; }
