/* =========================
   GLOBAL
========================= */

body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 8px;
    text-align: center;
    background: #f2f2f2;
    box-sizing: border-box;
}

/* =========================
   LOGIN
========================= */

.login-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.login-box {
    background: white;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
}

.login-box input {
    margin: 10px 0;
    padding: 5px;
}

/* =========================
   CANVAS
========================= */

.canvas-container {
    overflow-x: auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

#groupCanvas {
    display: block;
    max-width: 100%;
    width: 100%;
    height: auto;
}

/* =========================
   CARDS
========================= */

.card {
    border: 1px solid #ddd;
    border-radius: 6px;
    margin-bottom: 6px;
    background: #fff;
    overflow: hidden;
    display: block;
	width: 100%;
    max-width: 100%;
}

.card-header {
    padding: 8px 10px;
    background: #f6f6f6;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;      /* or 700 */
    font-size: 17px;        /* optional */
}

.card-content {
    padding: 8px;
    text-align: left;
}

.collapsed .card-content {
    display: none;
}

/* arrow animation */
.arrow {
    transition: transform 0.2s ease;
    font-size: 12px;
}

.collapsed .arrow {
    transform: rotate(-90deg);
}

/* =========================
   TOOLBAR / BUTTONS
========================= */

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.toolbar .btn {
    padding: 10px 12px;
    font-size: 12px;
    min-height: 32px;
}


.btn:hover {
    background: #eaeaea;
}

.control-btn {
    background: linear-gradient(135deg, #0066cc, #00aaff);
    color: white;
    font-weight: bold;

    border: none;
    border-radius: 8px;

    padding: 2px 8px;
    line-height: 1;
    height: 26px;
    min-height: 26px;

    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.tab-btn {
    background: linear-gradient(135deg, #8c8c8c, #b5b5b5);
    color: white;
    font-weight: bold;

    border: none;
    border-radius: 8px;

    padding: 2px 8px;
    line-height: 1;
    height: 26px;
    min-height: 26px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.tab-btn:hover {
    background: linear-gradient(135deg, #757575, #9e9e9e);
}

.tab-btn:active {
    transform: scale(0.97);
}

/* =========================
   INFO GRID
========================= */

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 8px;
}

.info-cell {
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 10px;
    min-height: 16px;
    background: #fafafa;
    text-align: center;
}

.info-title {
    font-size: 12px;
    font-weight: bold;
    color: #666;
    margin-bottom: 5px;
}

/* values */
#carrefourName,
#time,
#lastCycle,
#lastPlan,
#ledState,
#selectionPlan,
#priorityLevel,
#situationNumber,
#operationMode {
    font-size: 12px;
    font-weight: bold;
    color: blue;
}

/* =========================
   MESSAGES
========================= */

.alarm-text,
.errorMessages-text {
    font-size: 16px;
    font-weight: bold;
    text-align: left;
    padding: 12px;
    color: red;
}

#alarmsText {
    text-align: left;
}

/* =========================
   HIDE UTILITY
========================= */

.hidden {
    display: none !important;
}

.hidden2 {
    display: none !important;
}

/* =========================
   LEGACY / EXTRA UI
========================= */

.cycle-container,
.time-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
}

/* =========================
   TABLE (legacy support)
========================= */

table {
    margin: auto;
    border-collapse: collapse;
}

th, td {
    border: 1px solid black;
    padding: 1px 5px;
    font-size: 20px;
}

/* =========================
   DETECTOR UI (optional legacy)
========================= */

.cell {
    width: 15px;
    height: 15px;
    position: relative;
}

.cell div {
    height: 33%;
}

.cell .l3,
.cell .l4,
.cell .l5,
.cell .l6,
.cell .l7,
.cell .l8 {
    position: absolute;
    width: 100%;
    height: 2px;
}

.detector-btn {
    width: 40px;
    height: 12px;
    font-size: 10px;
    border: 1px solid #666;
    cursor: pointer;
}

.back-btn {
	background: linear-gradient(135deg, #0066cc, #00aaff);
    color: white;
    font-weight: bold;
    border: 1px solid #0055aa;
    border-radius: 8px;

    padding: 6px 12px;
}

.back-btn span {
    color: white;
}

.back-btn:hover {
    background: linear-gradient(135deg, #0055aa, #0099dd);
}

.back-btn::before {
    content: "←";
    margin-right: 6px;
    font-weight: bold;
}

.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 10px;
}

.button-row .btn {
    flex: 1 1 150px;
    min-width: 120px;
    box-sizing: border-box;
}

.danger-btn {
    background: linear-gradient(135deg, #d32f2f, #f44336);
    color: white;
    font-weight: bold;
    border: none;
    border-radius: 10px;
    padding: 8px 10px;
    min-height: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.danger-btn:hover {
    background: linear-gradient(135deg, #b71c1c, #d32f2f);
    transform: scale(1.05);
}

.danger-btn:active {
    transform: scale(0.90);
}

.data-btn {
    background: linear-gradient(135deg, #2e7d32, #4caf50);
    color: white;
    font-weight: bold;
    border: none;
    border-radius: 10px;
    padding: 8px 12px;
    min-height: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.data-btn:hover {
    background: linear-gradient(135deg, #1b5e20, #388e3c);
    transform: scale(1.05);
}

.data-btn:active {
    transform: scale(0.90);
}

.traffic-detector {
    position: absolute;
    width: 80px;
    height: 40px;

    border: 2px solid black;
    box-sizing: border-box;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 12px;
    font-weight: bold;

    color: black;
    background-color: white;

    pointer-events: none;
}

.traffic-detector.active {
    background-color: yellow;
}

.traffic-map {
    position: relative;
    width: 100%;
    height: 70vh;
    overflow: hidden;

    touch-action: none;
    background: #ddd;
}

.traffic-map-content {
    position: absolute;

    left: 0;
    top: 0;

    /*
     * The actual map always has the reference size.
     */
    width: 1048px;
    height: 500px;

    transform-origin: 0 0;

    will-change: transform;
}

.background-image {
    position: absolute;

    left: 0;
    top: 0;

    width: 1048px;
    height: 500px;

    object-fit: fill;

    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
}

#trafficCanvas {
    position: absolute;

    left: 0;
    top: 0;

    width: 1048px;
    height: 500px;

    pointer-events: none;
}

/* =========================
   LANGUAGE
========================= */

#topBar {
    width: 100%;
    height: 45px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    box-sizing: border-box;

    padding: 5px 10px;
    margin-bottom: 5px;
}

#logoutButton {
    padding: 6px 12px;
    cursor: pointer;
}

#languageButtons {
    display: flex;
    align-items: center;
    gap: 6px;
}

#languageButtons img {
    display: block;
    width: 32px;
    height: auto;
    cursor: pointer;
}

/* =====================================================
   Session timeout warning
   ===================================================== */

#sessionTimeoutWarning {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;

    background: rgba(0, 0, 0, 0.55);

    align-items: center;
    justify-content: center;

    z-index: 9999;
}

#sessionTimeoutWarning > div {
    width: min(420px, 90%);

    padding: 30px;

    background: white;

    border-radius: 12px;

    box-shadow:
        0 8px 30px rgba(0, 0, 0, 0.3);

    text-align: center;
}

#sessionTimeoutWarning h2 {
    margin-top: 0;
    margin-bottom: 15px;
}

#sessionTimeoutWarning p {
    margin: 10px 0;
}

#sessionTimeoutCountdown {
    font-weight: bold;
}

#sessionTimeoutWarning button {
    margin-top: 20px;

    padding: 10px 22px;

    border: none;
    border-radius: 6px;

    cursor: pointer;

    font-size: 16px;
}
