body { padding-top: 0; }
.name-result, .team-result, .word-result {
    font-size: 1.2rem;
    margin-top: 20px;
    white-space: pre-line;
}
.copy-button { margin-left: 10px; }
.field.is-grouped .control { margin-bottom: 0; }

.h-100 {
    height: 100%;
} 

/* Switch styles */
.switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .2s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .2s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #00d1b2;
}

input:checked + .slider:before {
    transform: translateX(24px);
}

/* ============================================
   MOBIILISÕBRALIK KUJUNDUS
   ============================================ */

/* Lisaandmete paneeli mobiilivaade */
@media (max-width: 992px) {
    /* Flex konteiner mobiilil vertikaalseks */
    .custom-flex {
        flex-direction: column;
    }
    
    .left-side, .right-side {
        width: 100%;
        min-width: unset !important;
    }
}

/* Mobiili spetsiifiline klass */
.mobile-only {
    display: none;
}

@media (max-width: 992px) {
    /* Mobiilil kuvatakse lisaandmed vormis */
    .mobile-only {
        display: block;
    }
    
    /* Peida desktop lisaandmete paneel */
    .right-side #nameSettingsList {
        display: none !important;
    }
}

/* Nupuriba mähkub alati, kui ruumi napib (nt sisse-zoomimisel) */
.field.has-addons .control.is-flex {
    flex-wrap: wrap;
    gap: 0.5rem;
}

@media (max-width: 768px) {
    /* Radio nupud üksteise all mobiilil */
    #groupOptionsField .control label.radio {
        display: block;
        margin-left: 0 !important;
        margin-bottom: 0.5rem;
    }

    .switch-label {
        width: 100%;
        justify-content: flex-start !important;
    }
}

/* ============================================
   LISAANDMETE TABEL
   ============================================ */
.settings-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 0.5rem;
}

.settings-table thead th {
    padding: 0.5rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.85rem;
    color: #4a4a4a;
}

.settings-table th.col-gender,
.settings-table th.col-skill,
.settings-table th.col-active {
    text-align: center;
}

.settings-table tbody tr {
    background: white;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
    border-radius: 6px;
}

.settings-table td {
    padding: 0.6rem 0.75rem;
    vertical-align: middle;
}

.settings-table td:first-child {
    border-radius: 6px 0 0 6px;
}

.settings-table td:last-child {
    border-radius: 0 6px 6px 0;
}

.settings-table td.col-name {
    font-size: 0.9rem;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.settings-table td.col-gender,
.settings-table td.col-skill {
    text-align: center;
}

.settings-table td.col-active {
    text-align: center;
    width: 80px;
}

.settings-table tr.is-inactive {
    opacity: 0.5;
}

.settings-table tr.is-inactive td {
    background: #f5f5f5;
}

/* Nupud tabelis */
.settings-table .buttons.has-addons {
    flex-wrap: nowrap !important;
    margin-bottom: 0 !important;
    justify-content: center;
}

.settings-table .buttons.has-addons .button {
    padding: 0.25em 0.5em;
    font-size: 0.8rem;
    min-width: 1.6rem;
    height: 1.8rem;
}

/* Dark mode */
[data-theme="dark"] .settings-table thead th {
    color: #b5b5b5;
}

[data-theme="dark"] .settings-table tbody tr {
    background: #1f2940;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .settings-table tr.is-inactive td {
    background: #1a1a2e;
}

/* Mobiilivaade - lisaandmed */
@media (max-width: 768px) {
    .settings-table {
        border-spacing: 0 0.4rem;
    }
    
    .settings-table thead {
        display: none;
    }
    
    .settings-table tbody tr {
        display: flex;
        flex-wrap: wrap;
        padding: 0.5rem 0.75rem;
        align-items: center;
        gap: 0.5rem;
    }
    
    .settings-table td {
        padding: 0.25rem;
    }
    
    .settings-table td.col-name {
        width: 100%;
        order: 1;
        margin-bottom: 0.25rem;
        border-radius: 0 !important;
    }
    
    .settings-table td.col-gender {
        order: 2;
        border-radius: 0 !important;
    }
    
    .settings-table td.col-skill {
        order: 3;
        border-radius: 0 !important;
    }
    
    .settings-table td.col-active {
        order: 4;
        width: auto;
        margin-left: auto;
        border-radius: 0 !important;
    }
    
    .settings-table td:first-child,
    .settings-table td:last-child {
        border-radius: 0 !important;
    }
    
    .settings-table .buttons.has-addons .button {
        padding: 0.3em 0.55em;
    }
}


/* Gruppide kuvamine */
#generatedGroups .column,
#groupsContainer .column {
    flex: none !important;
    width: 250px !important;
}

/* Mobiilil gruppide täislaius */
@media (max-width: 768px) {
    #generatedGroups .column,
    #groupsContainer .column {
        width: 100% !important;
    }
}

@media (min-width: 769px) and (max-width: 1023px) {
    #generatedGroups .column,
    #groupsContainer .column {
        width: calc(50% - 0.75rem) !important;
    }
}

/* Väga väikesed ekraanid */
@media (max-width: 480px) {
    /* Väiksem textarea */
    #namesInput {
        font-size: 14px;
    }
    
    /* Kompaktsem päis */
    #nameSettingsList .title.is-5 {
        font-size: 1rem;
    }
}

/* Update the team-result styles */
.team-result .box {
    transition: all 0.2s ease;
    border: 1px solid #dbdbdb;
    box-shadow: 0 2px 3px rgba(10, 10, 10, 0.05);
    background: white;
}

.team-result .box:hover {
    box-shadow: 0 3px 5px rgba(10, 10, 10, 0.1);
    transform: translateY(-1px);
}

.team-result .rounded-bottom {
    border-radius: 0 0 6px 6px;
}

.team-result .content {
    line-height: 1.3;
}

.team-result .title {
    font-weight: 600;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #dbdbdb;
}

.team-result .has-background-white {
    border-top: none;
}

.team-result .names-list {
    font-size: 0.95rem;
    line-height: 1.4;
}

/* Optional: Add this if you want to make the copy button more subtle */
.copy-button {
    transition: all 0.2s ease;
    opacity: 0.9;
}

.copy-button:hover {
    opacity: 1;
}

/* ============================================
   GRUPIPÄISTE PARANDATUD KUJUNDUS
   ============================================ */
.group-box {
    border-radius: 8px;
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 0 !important; /* Eemalda padding, et päis ulatuks servani */
    border: 1px solid #dbdbdb;
}

.group-box.box {
    padding: 0 !important;
}

.group-box .title.is-5 {
    font-weight: 700;
    font-size: 1rem;
    margin: 0 !important;
    padding: 0.6rem 0.75rem !important;
    background: linear-gradient(135deg, #00d1b2 0%, #00b89c 100%);
    color: white !important;
    border-radius: 0; /* Eemalda ümarad nurgad, kuna parent'il on overflow:hidden */
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.group-box .title.is-5 .group-title-text {
    font-weight: 700;
    cursor: pointer;
}

.group-box .title.is-5 .group-title-text:hover {
    text-decoration: underline;
    text-decoration-style: dashed;
}

/* Grupi nime muutmise stiil - kasutab contenteditable */
.group-box .title.is-5 .group-title-text {
    cursor: pointer;
}

.group-box .title.is-5 .group-title-text[contenteditable="true"] {
    outline: none;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    padding: 0 2px;
    min-width: 50px;
    display: inline-block;
}

/* Grupeerimise pealkirja muutmine (view_groups.php) */
#groupTitle {
    cursor: pointer;
    transition: background 0.15s;
    padding: 0 4px;
    margin: 0 -4px;
    border-radius: 4px;
}

#groupTitle:hover {
    background: rgba(0, 0, 0, 0.05);
}

#groupTitle[contenteditable="true"] {
    outline: none;
    background: rgba(0, 209, 178, 0.1);
    border-bottom: 2px solid #00d1b2;
    border-radius: 0;
}

[data-theme="dark"] #groupTitle:hover {
    background: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] #groupTitle[contenteditable="true"] {
    background: rgba(0, 209, 178, 0.2);
}

.group-box .title.is-5 small,
.group-box .title.is-5 .member-count {
    font-weight: 400;
    opacity: 1;
    font-size: 0.8rem;
    white-space: nowrap;
    color: rgba(255, 255, 255, 0.9);
}

.group-box .names-list {
    padding: 0.4rem 0.75rem !important;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.15s ease;
    margin: 0;
    font-size: 0.95rem;
}

.group-box .names-list:last-child {
    border-bottom: none;
    padding-bottom: 0.6rem !important;
}

.group-box .names-list:hover {
    background-color: #f9f9f9;
}

.group-box .extra-info {
    color: #888;
    font-size: 0.85em;
}

/* ============================================
   DRAG AND DROP STIILID
   ============================================ */
.group-box .names-list.draggable {
    cursor: grab;
    user-select: none;
}

.group-box .names-list.draggable:active {
    cursor: grabbing;
}

.group-box .names-list.dragging {
    opacity: 0.5;
    background-color: #e8f5f3 !important;
}

.group-box.drag-over {
    outline: 2px dashed #00d1b2;
    outline-offset: -2px;
    background-color: #f0fffd;
}

.group-box .names-list.drag-placeholder {
    background-color: #00d1b2;
    opacity: 0.3;
    min-height: 2.5rem;
    border: 2px dashed #00b89c;
}

/* Drag handle ikoon */
.group-box .names-list.draggable::before {
    content: "⋮⋮";
    margin-right: 0.5rem;
    color: #ccc;
    font-size: 0.8rem;
    letter-spacing: 2px;
}

.group-box .names-list.draggable:hover::before {
    color: #00d1b2;
}

/* Touch seadmetel näita drag handle alati */
@media (hover: none) and (pointer: coarse) {
    .group-box .names-list.draggable::before {
        color: #aaa;
    }
}

/* ============================================
   SALVESTAMISE NUPP JA STAATUS
   ============================================ */
.save-groups-section {
    margin-top: 1rem;
    padding: 1rem;
    background: #f9f9f9;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

/* Genereeritud gruppide all olevad nupud — wrap mobiilis korralikult */
.generated-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

/* Hoiab save-status ja kustuta-nupu koos (et X jääks pillile kinni) */
.save-status-group {
    display: inline-flex;
    align-items: center;
}

.save-status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: #666;
    background: #f5f5f5;
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
}

.save-status.saved {
    color: #00d1b2;
    border-color: #00d1b2;
    background: #f0fffd;
}

.save-status .icon {
    font-size: 0.9rem;
}

/* Tühjenda nupp - kuulub koos staatusega */
#clearLocalStorageBtn {
    border-radius: 0 4px 4px 0 !important;
    margin-left: -1px !important;
    border-left: none !important;
    padding: 0.25rem 0.5rem !important;
    height: auto !important;
}

.save-status + #clearLocalStorageBtn {
    vertical-align: middle;
}

[data-theme="dark"] .save-status {
    background: #2a2a3e;
    border-color: #3f3f46;
    color: #a0a0a0;
}

[data-theme="dark"] .save-status.saved {
    background: rgba(0, 209, 178, 0.1);
    border-color: #00a896;
    color: #00d1b2;
}

/* ============================================
   TOAST TEATED
   ============================================ */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    padding: 0.75rem 1.25rem;
    border-radius: 6px;
    background: #363636;
    color: white;
    font-size: 0.9rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: toastIn 0.3s ease-out;
    max-width: 350px;
}

.toast.is-success {
    background: #48c774;
}

.toast.is-info {
    background: #3298dc;
}

.toast.is-warning {
    background: #ffdd57;
    color: #363636;
}

.toast.is-danger {
    background: #f14668;
}

.toast.fade-out {
    animation: toastOut 0.3s ease-in forwards;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* Dark mode stiilid */
[data-theme="dark"] .team-result .box,
[data-theme="dark"] .group-box {
    background: var(--bg-card, #1f2940);
    border-color: var(--border-color, #3f3f46);
}

[data-theme="dark"] .group-box .title.is-5 {
    background: linear-gradient(135deg, #00a896 0%, #008f7a 100%);
}

[data-theme="dark"] .group-box .names-list {
    border-bottom-color: var(--border-color, #3f3f46);
}

[data-theme="dark"] .group-box .names-list:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .group-box.drag-over {
    background-color: rgba(0, 209, 178, 0.1);
}

[data-theme="dark"] .team-result .title {
    border-bottom-color: var(--border-color, #3f3f46);
}

[data-theme="dark"] .names-list {
    color: var(--text-primary, #e4e4e7);
}

[data-theme="dark"] .slider {
    background-color: #4a4a4a;
}

[data-theme="dark"] .save-groups-section {
    background: var(--bg-card, #1f2940);
    border-color: var(--border-color, #3f3f46);
}

#customGroupNamesInputs .field {
    margin-bottom: 0.35rem;
}

#customGroupNamesInputs .field:last-child {
    margin-bottom: 0;
}