:root{
    --bg: #f8f8f8;
    --surface: #ffffff;
    --surface-2: #eef2f8;
    --text: #18202b;
    --muted: #687385;
    --line: #dde4ee;
    --primary: #111827;
    --primary-soft: #e7ecf5;
    --shadow: 0 10px 30px rgba(16, 24, 40, 0.08);

    --blue: #3b82f6;
    --orange: #f97316;
    --yellow: #f7f700;
    --black: #000;
    --danger-bg: #fee2e2;
    --danger-text: #b91c1c;

    --header-h: 75px;
    --cats-h: 70px;
    --footer-h: 60px;
    --radius: 22px;
    --radius-sm: 14px;
    --gap: 5px;
}

*{
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body{
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
}

body{
    overflow: hidden;
}

button{
    font: inherit;
    border: 0;
    background: none;
    padding: 0;
    cursor: pointer;
    color: inherit;
}

.app{
    height: 100svh;
    display: grid;
    grid-template-rows: var(--header-h) var(--cats-h) 1fr var(--footer-h);
}

/* HEADER */
.app-header{
    background: #F8F8F8;
    margin: 0;
    box-shadow: 0 4px 2px -2px rgba(0, 0, 0, 0.2);   
}
.app-header IMG {
    width: 100%;  
    height: 75px;
}

/* CATEGORIES */
.categories{
    align-items: center;
    gap: 10px;
    padding: 10px 10px 5px 10px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    /*backdrop-filter: blur(10px);*/
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
}

.categories::-webkit-scrollbar{
    display: none;
}

.category-chip{
    box-shadow: 0 0 5px 5px #dedede; 
    border-radius: 4px;
    padding: 10px;
    background: #fff;
    color: #005ca0;
    font-size: 0.9rem;
    font-weight: 700;
    height: 40px;
}

.category-chip.active{
    background: #005ca0;
    color: #fff;
}



/* CONTENT */
.content{
    min-height: 0;
    overflow: hidden;
}

.pages{
	height: 100%;
	display: flex;
	overflow-x: auto;
	overflow-y: hidden;
	scroll-snap-type: x mandatory;
	scroll-snap-stop: always;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
	overscroll-behavior-x: contain;
	overscroll-behavior-y: none;
	touch-action: pan-x;
}

.pages::-webkit-scrollbar{
	display: none;
}

.page{
	flex: 0 0 100%;
	width: 100%;
	min-width: 100%;
	max-width: 100%;
	height: 100%;
	scroll-snap-align: start;
	scroll-snap-stop: always;
	padding: 10px;
	overflow-y: auto;
}

.page-grid{
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    align-content: start;
}

/* PRODUCT CARD */
.item-card{
    min-height: 182px;
    padding: 7px;
    border-radius: 6px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    box-shadow: 0 0 5px 5px #dedede;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease;
    isolation: isolate;
    position: relative;
}
.item-card.is-active{
    border-color: rgba(17,24,39,0.18);
    box-shadow: 0 14px 34px rgba(16, 24, 40, 0.14);
}

.item-card:active{
    transform: scale(0.985);
}

.item-blob{    
    width: 100%;
    height: 170px;
}

.item-visual{
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
    border-radius: 6px 6px 0 0;
}
.item-content {
    position: absolute;
    top: 107px;
    left: 8px;
    background: #000000;
    width: calc(100% - 16px);
    height: 40px;
    opacity: 0.6;
}
.item-name{
    font-size: 0.8rem;
    font-weight: 700;
    text-align: center;        
    height: 40px;
    display: grid;
    align-content: center;
    position: absolute;
    top: 107px;
    left: 7px;
    color: #fff;
    width: calc(100% - 14px);
}

.item-card .ticket-badge{
    display: grid;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    border-radius: 6px;
    font-size: 0.76rem;
    font-weight: 800;
    color: #fff;
    box-shadow: inset 0 -1px 0 rgba(255,255,255,0.15);
    width: 28px;
    height: 28px;
    margin: 0 auto;
    position: absolute;
    top: -5px;
    right: -5px;
    z-index: 2;
}

.ticket-jaune, .ticket-yellow, .jaune{ background: var(--yellow); color: #000}
.ticket-black, .ticket-noir, .noir{ background: var(--black); }
.item-card .ticket-badge.ticket-yellow {
    color: #000;
}

.item-actions{
    margin-top: 5px;
}

.add-btn{
    height: 44px;
    padding: 0 12px;
    border-radius: 0 0 6px 6px;
    align-items: center;
    justify-content: center;
    background: #005ca0;
    color: #fff;
    font-size: 0.82rem;
    font-weight: 800;
    width: 100%;
}

.qty-box{
    display: none;
    align-items: center;
    gap: 6px;
    width: 100%;
}

.item-card.is-active .add-btn{
    display: none;
}

.item-card.is-active .qty-box{
    display: flex;
}

.control-btn{
    width: 33%;
    height: 44px;
    border-radius: 6px;
    display: grid;
    text-align: center;
    align-content: center;
    font-weight: 800;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--text);
    flex: 0 0 auto;
}
.control-btn i {
    font-size: 16px;
}
.control-btn.plus{
    background: #005ca0;
    color: #fff;
}

.control-btn.delete{
    background: var(--danger-bg);
    color: var(--danger-text);
    font-size: 0.95rem;
}

.qty-display{
    width: 33%;
    text-align: center;
    font-size: 0.95rem;
    font-weight: 900;
}

/* FOOTER */
.app-footer{
    display: grid;
    /*grid-template-columns: 1fr auto;*/
    align-items: center;
   /* gap: 12px;
    /*padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0));*/
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(14px);
    border-top: 1px solid rgba(221,228,238,0.85);    
    /*text-align: center;
    margin: auto;*/
    width: 100%;
    position: relative;
}

.footer-cta {    
    background: #d63434;
    height: 60px;
    width: 60px;
    border-radius: 6px 0 0 6px;
    display: grid;
    text-align: center;
    align-content: center;
    position: absolute;
    right: 0;
    top: 0;
}
.footer-cta i {
    font-size: 20px;
    display: block;
    color: #fff;
}
.footer-cta em {
    background: #ad0e0e;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    display: grid;
    text-align: center;
    align-content: center;
    position: absolute;
    top: -9px;
    left: -9px;
    font-style: normal;
    color: #fff;
    font-size: 12px;
    box-shadow: 0 0 2px 2px #ffb7b7;
    font-weight: 600;
}

.footer-last-order{
	position: absolute;
	left: 50%;
	bottom: 15px;
	transform: translateX(-50%);
	background: #005ca0;
	color: #fff;
	border-radius: 999px;
	padding: 6px 12px;
	font-size: 0.78rem;
	font-weight: 900;
	white-space: nowrap;
	box-shadow: 0 8px 18px rgba(0,0,0,.18);
}

.footer-reset{  
	position: absolute;
	left: 0;
	top: 0;  
	display: flex;
	align-items: center;
}

.reset-btn{
	width: 60px;
	height: 60px;
	border: 0;
	display: grid;
	place-items: center;
    align-content: center;
}

.reset-trash{
	border-radius: 0 6px 6px 0;
	background: #fee2e2;
	color: #c64a4a;
}

.reset-trash i{
	font-size: 16px;
	display: block;
}

.reset-trash span{
	font-size: 11px;
	font-variant: small-caps;
	display: block;
}

.reset-confirm,
.reset-cancel{
	display: none;
}

.footer-reset.is-confirm .reset-trash{
	display: none;
}

.footer-reset.is-confirm .reset-confirm,
.footer-reset.is-confirm .reset-cancel{
	display: grid;
}

.reset-confirm{
	background: #dcfce7;
	color: #15803d;
	border-radius: 0;
}

.reset-cancel{
	background: #fee2e2;
	color: #b91c1c;
	border-radius: 0 6px 6px 0;
}

.recap-overlay{
	position: fixed;
	inset: 0;
	background: rgba(15, 23, 42, 0.38);
	backdrop-filter: blur(2px);
	z-index: 80;
	opacity: 0;
	pointer-events: none;
	transition: opacity .22s ease;
}

.recap-overlay.is-open{
	opacity: 1;
	pointer-events: auto;
}

.recap-drawer{
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	height: min(82svh, 760px);
	background: #fff;
	border-radius: 26px 26px 0 0;
	box-shadow: 0 -14px 40px rgba(15, 23, 42, 0.18);
	z-index: 90;
	display: grid;
	grid-template-rows: auto 1fr auto;
	transform: translateY(100%);
	transition: transform .26s ease;
}


.recap-drawer.is-open{
	transform: translateY(0);
}

.recap-header{
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 16px 16px 12px;
	border-bottom: 1px solid var(--line);
    position: relative;
}
.recap-header .ligne {
    position: absolute;
	left: calc(50% - 50px);
    top: 4px;
    width: 100px;
    height: 4px;
    border-radius: 999px;
    background: var(--muted);
}

.recap-title{
	font-size: 1.05rem;
	font-weight: 900;
	letter-spacing: -0.02em;
}

.recap-subtitle{
	margin-top: 3px;
	font-size: 0.82rem;
	color: var(--muted);
}

.recap-close{
	width: 40px;
	height: 40px;
	border-radius: 12px;
	background: var(--surface-2);
	border: 1px solid var(--line);
	font-size: 1rem;
	font-weight: 800;
}

.recap-body{
	min-height: 0;
	/*overflow-y: auto;*/
	padding: 14px 0 10px;
	display: grid;
	gap: 18px;
	align-content: start;
}

.recap-list{
	display: grid;
	gap: 10px;
    overflow-y: auto;
    padding-bottom: 80px;
    padding: 0 10px;
}

.recap-item{
	display: grid;
	grid-template-columns: 52px minmax(0, 1fr) auto;
	gap: 12px;
	padding: 0;
	border-radius: 6px;
	background: #fff;
	border: 1px solid var(--line);
	align-items: stretch;
}

.recap-item-thumb{
	width: 52px;
	height: 52px;
	border-radius: 6px;
	background: var(--surface-2);
	overflow: hidden;
	display: grid;
	place-items: center;
	align-self: center;    
}
.recap-item-thumb img{
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.recap-item-center{
	min-width: 0;
	height: 100%;
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 4px;
}

.recap-item-name{
	font-size: 0.96rem;
	font-weight: 800;
	line-height: 1.15;
	margin: 0;
}

.recap-item-meta{
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin: 0;
    color: #000;
}

.recap-item-qty{
	min-width: 54px;
	height: 100%;
	padding: 0 10px;
	border-radius: 0 6px 6px 0;
	background: var(--primary);
	color: #fff;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 0.86rem;
	font-weight: 900;
	align-self: center;
}
.recap-item-qty.jaune{ background: var(--yellow); color: #000}
.recap-item-qty.noir{ background: var(--black); }

.recap-empty{
	padding: 24px 16px;
	border: 1px dashed var(--line);
	border-radius: 18px;
	text-align: center;
	color: var(--muted);
	background: #fff;
}

.recap-totals{
	padding: 5px 10px 10px 10px;
	background: var(--surface-2);
	border-top: 1px solid var(--line);
    position: fixed;
    bottom: 70px;
    width: 100%;
    display: flex;
    gap: 20px;
}

.recap-totals-title{
	font-size: 0.88rem;
	font-weight: 800;
    margin-top: 10px;
}

.recap-totals-grid{
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 5px;
    width: 100%;
}

.recap-total-pill {
	display: grid;
	align-items: center;
	gap: 8px;
	min-height: 40px;
	padding: 0 12px;
	border-radius: 6px;
	background: #fff;
	font-size: 0.84rem;
	font-weight: 800;
    color: #fff;
    text-align: center;
    width: 100%;
}
.recap-total-pill.jaune{ background: var(--yellow); color: #000}
.recap-total-pill.noir{ background: var(--black); }


.recap-footer{
	padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0));
	border-top: 1px solid var(--line);
	background: rgba(255,255,255,0.96);
	backdrop-filter: blur(10px);
}

.recap-send{
	width: 100%;
	height: 50px;
	border-radius: 6px;
	background: var(--primary);
	color: #fff;
	font-size: 0.95rem;
	font-weight: 900;
	box-shadow: 0 14px 30px rgba(17,24,39,0.22);
    position: relative;    
}
.recap-send i {
    position: absolute;
    top: 17px;
    right: 20px;
}
.recap-send:disabled{
	opacity: .5;
	box-shadow: none;
}


.order-success{
	min-height: 100%;
	display: grid;
	place-items: center;
	text-align: center;
	padding: 30px 20px;
}

.order-success-icon{
	width: 72px;
	height: 72px;
	border-radius: 50%;
	background: #dcfce7;
	color: #15803d;
	display: grid;
	place-items: center;
	font-size: 2rem;
	margin-bottom: 16px;
}

.order-success-title{
	font-size: 1.25rem;
	font-weight: 900;
	margin-bottom: 12px;
}

.order-success-number{
	font-size: 2rem;
	font-weight: 950;
	color: #005ca0;
	margin-bottom: 12px;
}

.order-success-text{
	font-size: 0.92rem;
	color: var(--muted);
	line-height: 1.4;
	max-width: 260px;
}

.success-drawer{
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	height: min(82svh, 760px);
	background: #fff;
	border-radius: 26px 26px 0 0;
	box-shadow: 0 -14px 40px rgba(15, 23, 42, 0.18);
	z-index: 95;
	transform: translateY(100%);
	transition: transform .26s ease;
}

.success-drawer.is-open{
	transform: translateY(0);
}