/* =====================================
   BASE
===================================== */

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    background: #f4f7fb;

    color: #172033;
}


/* =====================================
   APP
===================================== */

.app {
    min-height: 100vh;
}


/* =====================================
   TOP BAR
===================================== */

.topbar {
    height: 76px;

    display: flex;
    align-items: center;

    background: #ffffff;

    border-bottom: 1px solid #e6eaf0;

    padding: 0 32px;
}


.brand {
    display: flex;

    align-items: center;

    gap: 13px;
}


.brand-icon {
    width: 42px;
    height: 42px;

    display: flex;

    align-items: center;
    justify-content: center;

    border-radius: 10px;

    background: #2563eb;

    color: #ffffff;

    font-size: 13px;

    font-weight: 700;
}


.brand h1 {
    margin: 0 0 3px;

    font-size: 18px;

    font-weight: 650;
}


.brand p {
    margin: 0;

    color: #7b8494;

    font-size: 12px;
}


/* =====================================
   MAIN
===================================== */

.main-container {
    max-width: 1600px;

    margin: auto;

    padding: 24px 30px 30px;
}


/* =====================================
   UPLOAD CARD
===================================== */

.upload-card {
    display: flex;

    justify-content: space-between;

    align-items: center;

    gap: 30px;

    padding: 18px 20px;

    margin-bottom: 18px;

    background: #ffffff;

    border: 1px solid #e4e9f0;

    border-radius: 12px;

    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.03);
}


.upload-info {
    display: flex;

    align-items: center;

    gap: 13px;
}


.upload-icon {
    width: 42px;
    height: 42px;

    display: flex;

    align-items: center;
    justify-content: center;

    flex-shrink: 0;

    border-radius: 9px;

    background: #eff6ff;

    color: #2563eb;

    font-size: 22px;

    font-weight: 600;
}


.upload-info h3 {
    margin: 0 0 4px;

    font-size: 14px;
}


.upload-info p {
    margin: 0;

    color: #8992a2;

    font-size: 12px;
}


/* =====================================
   UPLOAD ACTIONS
===================================== */

.upload-actions {
    display: flex;

    align-items: center;

    gap: 10px;
}


.file-button {
    display: inline-flex;

    align-items: center;

    justify-content: center;

    height: 38px;

    padding: 0 15px;

    border: 1px solid #d8dee8;

    border-radius: 7px;

    background: #ffffff;

    font-size: 12px;

    font-weight: 500;

    cursor: pointer;

    transition: 0.15s;
}


.file-button:hover {
    background: #f7f9fc;

    border-color: #bec7d5;
}


.file-name {
    max-width: 180px;

    color: #7c8696;

    font-size: 12px;

    white-space: nowrap;

    overflow: hidden;

    text-overflow: ellipsis;
}


.detect-button {
    height: 38px;

    padding: 0 18px;

    border: 0;

    border-radius: 7px;

    background: #2563eb;

    color: white;

    font-size: 12px;

    font-weight: 600;

    cursor: pointer;

    transition: 0.15s;
}


.detect-button:hover {
    background: #1d4ed8;
}


.detect-button:disabled {
    opacity: 0.55;

    cursor: not-allowed;
}


/* =====================================
   WORKSPACE
===================================== */

.workspace {
    display: grid;

    grid-template-columns:
        minmax(0, 1.55fr)
        minmax(340px, 0.65fr);

    gap: 18px;

    align-items: stretch;
}


.workspace-card {
    min-width: 0;

    height: calc(100vh - 205px);

    min-height: 560px;

    display: flex;

    flex-direction: column;

    background: #ffffff;

    border: 1px solid #e4e9f0;

    border-radius: 12px;

    overflow: hidden;

    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.03);
}


/* =====================================
   CARD HEADER
===================================== */

.card-header {
    min-height: 68px;

    display: flex;

    align-items: center;

    justify-content: space-between;

    flex-shrink: 0;

    padding: 14px 17px;

    border-bottom: 1px solid #edf0f4;
}


.card-header h2 {
    margin: 0 0 4px;

    font-size: 14px;

    font-weight: 650;
}


.card-header p {
    margin: 0;

    color: #9199a6;

    font-size: 11px;
}


.results-header {
    gap: 15px;
}


.total-badge {
    min-width: 32px;
    height: 28px;

    display: flex;

    align-items: center;
    justify-content: center;

    padding: 0 9px;

    border-radius: 20px;

    background: #eef4ff;

    color: #2563eb;

    font-size: 12px;

    font-weight: 700;
}


/* =====================================
   FLOOR PLAN EMPTY
===================================== */

.floor-empty {
    flex: 1;

    display: flex;

    flex-direction: column;

    align-items: center;
    justify-content: center;

    padding: 30px;

    text-align: center;
}


.empty-image-icon,
.empty-results-icon {
    width: 52px;
    height: 52px;

    display: flex;

    align-items: center;
    justify-content: center;

    margin-bottom: 12px;

    border-radius: 12px;

    background: #f2f5f9;

    color: #9aa4b2;

    font-size: 25px;
}


.floor-empty h3,
.results-empty h3 {
    margin: 0 0 5px;

    font-size: 13px;
}


.floor-empty p,
.results-empty p {
    max-width: 230px;

    margin: 0;

    color: #98a1ae;

    font-size: 11px;

    line-height: 1.5;
}


/* =====================================
   CANVAS
===================================== */

.canvas-container {
    flex: 1;

    min-height: 0;

    overflow: auto;

    display: flex;

    align-items: flex-start;
    justify-content: center;

    padding: 18px;

    background:
        linear-gradient(
            45deg,
            #fafbfc 25%,
            transparent 25%
        ),
        linear-gradient(
            -45deg,
            #fafbfc 25%,
            transparent 25%
        ),
        linear-gradient(
            45deg,
            transparent 75%,
            #fafbfc 75%
        ),
        linear-gradient(
            -45deg,
            transparent 75%,
            #fafbfc 75%
        );

    background-size: 20px 20px;
}


#floorPlanCanvas {
    display: block;

    max-width: 100%;

    height: auto;

    background: white;

    border: 1px solid #e6e9ee;

    box-shadow:
        0 4px 16px rgba(0, 0, 0, 0.06);
}


.hidden {
    display: none !important;
}


/* =====================================
   RESULTS
===================================== */

.stall-list {
    flex: 1;

    min-height: 0;

    overflow-y: auto;

    padding: 10px;
}


.results-empty {
    height: 100%;

    display: flex;

    flex-direction: column;

    align-items: center;
    justify-content: center;

    text-align: center;
}


/* =====================================
   STALL ROW
===================================== */

.stall-card {
    display: grid;

    grid-template-columns:
        100px
        minmax(0, 1fr);

    align-items: center;

    gap: 10px;

    min-height: 50px;

    padding: 8px 10px;

    margin-bottom: 6px;

    border: 1px solid #e9edf2;

    border-radius: 8px;

    background: #ffffff;

    cursor: pointer;

    transition:
        border-color 0.15s,
        box-shadow 0.15s,
        transform 0.15s;
}


.stall-card:hover {
    border-color: #cbd3df;

    box-shadow:
        0 3px 10px rgba(0, 0, 0, 0.05);

    transform: translateY(-1px);
}


.stall-number-wrapper {
    display: flex;

    align-items: center;

    gap: 8px;
}


.stall-color {
    width: 10px;
    height: 28px;

    flex-shrink: 0;

    border-radius: 4px;
}


.stall-number {
    font-size: 12px;

    font-weight: 700;

    color: #202938;
}


.stall-name {
    min-width: 0;

    color: #606a79;

    font-size: 11px;

    line-height: 1.35;

    overflow: hidden;

    text-overflow: ellipsis;

    white-space: nowrap;
}


/* =====================================
   SCROLLBAR
===================================== */

.stall-list::-webkit-scrollbar,
.canvas-container::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}


.stall-list::-webkit-scrollbar-thumb,
.canvas-container::-webkit-scrollbar-thumb {
    background: #d2d7df;

    border-radius: 10px;
}


/* =====================================
   RESPONSIVE
===================================== */

@media (max-width: 950px) {

    .main-container {
        padding: 18px;
    }


    .upload-card {
        align-items: flex-start;

        flex-direction: column;
    }


    .upload-actions {
        width: 100%;

        flex-wrap: wrap;
    }


    .workspace {
        grid-template-columns: 1fr;
    }


    .workspace-card {
        height: auto;

        min-height: 500px;
    }


    .results-card {
        min-height: 400px;
    }

}