/* ===============================
   TOOL SCOPE START
   (from body inward only)
================================ */

body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    background: #fff;
    font-family: inherit;

    /* ===============================
       TOOL VARIABLES
       (local to this tool)
    ================================ */

    --bg-control: #f4f4f4;
    --border: #ccc;

    --radius-lg: 16px;
    --radius-md: 10px;
    --radius-sm: 8px;

    --panel-width: 520px;
    --button-max: 360px;

    --gap-sm: 8px;
    --gap-md: 10px;
    --gap-lg: 16px;
}

/* ===============================
   BASE (tool-local)
================================ */

*,
*::before,
*::after {
    box-sizing: border-box;
}

input,
textarea,
select,
button {
    font-family: inherit;
}

/* ===============================
   PAGE LAYOUT
================================ */

.page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===============================
   TEAMS AREA
================================ */

.teams {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    padding: 16px;
    justify-content: center;
}

.card {
    flex: 0 1 320px;
    padding: 16px;
    border-radius: 22px;
    animation: pop 0.5s ease;

    border: 1px solid rgba(0,0,0,0.12);
    background-clip: padding-box;
    box-shadow:
        0 1px 2px rgba(0,0,0,0.06),
        0 6px 14px rgba(0,0,0,0.08);
}

.card h3 {
    margin: 0 0 var(--gap-sm);
    text-align: center;
    font-size: 18px;
}

.card.drag-over {
    outline: 3px dashed rgba(0,0,0,0.4);
}

.member {
    background: rgba(255,255,255,0.75);
    padding: 8px 10px;
    border-radius: 8px;
    margin: 6px 4px;

    cursor: grab;
    user-select: none;

    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ===============================
   CONTROL PANEL
================================ */

.control {
    background: var(--bg-control);
    padding: 20px;
    transition: all 0.4s ease;
}

/* Centered before generation */
.control.centered {
    margin: auto;
    width: 100%;
    display: flex;
    justify-content: center;
}

/* Bottom after generation */
.control.bottom {
    width: 100%;
}

/* Inner container */
.control-inner {
    width: 100%;
    max-width: var(--panel-width);
    margin: 0 auto;
}

.control h2 {
    margin-top: 0;
    text-align: center;
}

/* ===============================
   INPUTS & TEXTAREA
================================ */

#textArea,
input[type="number"],
.participant-row input,
.participant-row select {
    width: 100%;
    font-size: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

/* Text area */
#textArea {
    min-height: 140px;
    padding: 12px;
    line-height: 1.4;
    resize: vertical;
    margin-bottom: var(--gap-md);
    text-align: left;
}

/* Number input */
input[type="number"] {
    height: 42px;
    margin-top: 6px;
    padding: 0 10px;
    font-size: 15px;
}

/* Labels */
label {
    display: block;
    margin-top: 14px;
    font-size: 14px;
}

/* ===============================
   BUTTONS
================================ */

button {
    display: block;
    width: 100%;
    max-width: var(--button-max);

    margin: 8px auto 0;
    padding: 12px 14px;

    font-size: 15px;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;

    transition: transform 0.05s ease, filter 0.15s ease;
}

button:hover { filter: brightness(1.05); }
button:active { transform: translateY(1px); }

#convertBtn { background: #e0e0e0; }
#addParticipant { background: #d9eaff; }

button[name="generate"] {
    background: #4caf50;
    color: #fff;
    font-weight: 600;
}

button[name="export"] {
    background: #2196f3;
    color: #fff;
    font-weight: 600;
}

/* ===============================
   PARTICIPANT EDITOR
================================ */

#participantEditor {
    margin-top: 14px;
    display: flex;
    flex-direction: column;
    gap: var(--gap-md);
    align-items: center;
}

.participant-row {
    width: 100%;
    max-width: var(--panel-width);

    display: grid;
    grid-template-columns: 1.8fr 1fr 1fr 0.8fr;
    gap: var(--gap-sm);
}

.participant-row input,
.participant-row select {
    padding: 8px 10px;
    border-radius: var(--radius-sm);
}

.participant-row input::placeholder {
    color: #999;
}

/* ===============================
   FEEDBACK
================================ */

.error {
    color: #c62828;
    margin-top: 12px;
    font-weight: 500;
    text-align: center;
}

/* ===============================
   ANIMATIONS
================================ */

@keyframes pop {
    from {
        transform: scale(0.92);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}
