/* styles.css */
:root {
    --accent:#0b61ff;
    --muted:#666;
}

/* Base */
body {
    font-family: system-ui, Segoe UI, Roboto, Helvetica, Arial;
    margin: 0;
    background: #f7f8fb;
    color: #111;
}

.container {
    max-width: 1100px;
    margin: 18px auto;
    padding: 12px;
}

/* Header */
header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Layout */
main {
    display: flex;
    gap: 20px;
    margin-top: 12px;
}

.grid-area {
    flex: 1;
}

/* Sidebar */
aside {
    width: 280px;
    background: #fff;
    padding: 12px;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,.06);
}

/* Table */
.table-wrapper {
    width: 100%;
    overflow-x: auto;    /* mobile safe */
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0,0,0,.06);
    min-width: 650px;    /* prevents broken layout on small screens */
}

th, td {
    border: 1px solid #eee;
    padding: 8px;
    text-align: center;
    vertical-align: middle;
}

th {
    background: #fafafa;
}

.role-row th {
    background: #fafafa;
    color: #333;
    font-weight: 600;
    text-align: left;
    padding-left: 12px;
}

.cell {
    min-width: 120px;
    height: 52px;
    cursor: pointer;
}

.assigned {
    background: #f0f9ff;
}

/* Sidebar items */
.sidebar-item {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px dashed #eee;
    align-items: center;
    padding: 5px;
}

.add-indiv {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
}

/* Buttons */
button {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
}

button.secondary {
    background: #888;
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,.35);
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: #fff;
    padding: 16px;
    border-radius: 8px;
    min-width: 280px;
}

.modal-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    justify-content: flex-end;
    flex-direction: column;
}

/* ----------------------------------------------------
   MOBILE RESPONSIVE (under 768px)
---------------------------------------------------- */
@media (max-width: 768px) {

    .container {
        padding: 10px;
    }

    header {
        flex-direction: column;
        align-items: stretch;
    }

    .controls {
        flex-wrap: wrap;
        justify-content: flex-start;
    }

    main {
        flex-direction: column;
    }

    aside {
        width: 100%;
        order: 2;        /* push to bottom */
    }

    .grid-area {
        order: 1;
    }

    button {
        padding: 10px;
    }

    .add-indiv {
        flex-direction: column;
    }

    #modal-select {
        font-size: 1em;
        padding: 1em;
        width: inherit;
        text-align: center;
    }

    #individual-list {
        padding: 0px;
    }
}

/* ----------------------------------------------------
   EXTRA SMALL (under 480px)
---------------------------------------------------- */
@media (max-width: 480px) {

    body {
        font-size: 0.95rem;
    }

    th, td {
        padding: 6px;
    }

    .cell {
        min-width: 100px;
    }

    .modal-content {
        width: 90%;
        min-width: unset;
    }
}

