﻿/* ================= ROOT ================= */
.userdesk {
    padding: 20px;
    background: #f6f7f9;
    max-width: 100%;
    overflow-x: hidden;
    min-height: 100vh;
}

/* ================= HEADER ================= */
.userdesk-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

    .userdesk-header h2 {
        margin: 0;
        font-size: 22px;
    }

.userdesk-subtitle {
    font-size: 13px;
    color: #777;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.btn-add-user {
    background: #000;
    color: #fff;
    padding: 8px 14px;
    border: none;
    border-radius: 5px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s ease;
}

    .btn-add-user:hover {
        background: #222;
    }

/* ================= BODY ================= */
.userdesk-body {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* ================= COMMON ================= */
.section-header {
    border-bottom: 1px solid #ddd;
    margin-bottom: 12px;
}

    .section-header h3 {
        margin: 0 0 6px 0;
        font-size: 16px;
    }

/* ================= USERS TABLE ================= */
.user-list-section {
    width: 100%;
    overflow-x: auto;
}

.users-table {
    background: #fff;
    border-radius: 6px;
    overflow: hidden;
    min-width: 580px;
}

.users-header,
.users-row {
    display: grid;
    grid-template-columns: 2fr 1.5fr 2fr 1.5fr;
    padding: 10px 14px;
    gap: 10px;
    align-items: center;
}

.users-header {
    background: #efefef;
    font-weight: 600;
    font-size: 13px;
    color: #444;
}

.users-row {
    border-top: 1px solid #eee;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

    .users-row:hover {
        background-color: #f0f6ff;
        box-shadow: inset 4px 0 0 #007bff;
    }

    .users-row.active-row {
        background-color: #eaf2ff;
        box-shadow: inset 4px 0 0 #007bff;
    }

.table-loading,
.table-empty {
    padding: 30px;
    text-align: center;
    color: #999;
    font-size: 14px;
}

/* ================= USER FORM ================= */
.user-form-section {
    background: #fff;
    border-radius: 6px;
    padding: 20px;
    animation: fadeSlideDown 0.22s ease-out;
}

@keyframes fadeSlideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

    .form-group label {
        font-size: 13px;
        font-weight: 600;
        color: #444;
    }

    .form-group input,
    .form-group select {
        padding: 9px 11px;
        border: 1px solid #ccc;
        border-radius: 5px;
        font-size: 14px;
        outline: none;
        transition: border-color 0.18s ease, box-shadow 0.18s ease;
        box-sizing: border-box;
        width: 100%;
        background: #fff;
    }

        .form-group input:focus,
        .form-group select:focus {
            border-color: #007bff;
            box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
        }

.required {
    color: #e53935;
}

/* ================= USERNAME FIELD ================= */
.username-field-wrap {
    display: flex;
    gap: 8px;
}

    .username-field-wrap input {
        flex: 1;
    }

.btn-verify {
    padding: 9px 14px;
    background: #007bff;
    color: #fff;
    border: none;
    border-radius: 5px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.18s ease;
    flex-shrink: 0;
}

    .btn-verify:hover {
        background: #0062cc;
    }

    .btn-verify:disabled {
        background: #a0c4f5;
        cursor: not-allowed;
    }

.username-status {
    font-size: 12px;
    font-weight: 600;
    margin-top: 2px;
    min-height: 16px;
}

    .username-status.available {
        color: #28a745;
    }

    .username-status.taken {
        color: #e53935;
    }

    .username-status.checking {
        color: #888;
    }

/* ================= FORM ACTIONS ================= */
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 6px;
    border-top: 1px solid #f0f0f0;
}

.btn-cancel-form {
    padding: 9px 20px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.18s ease;
}

    .btn-cancel-form:hover {
        background: #e8e8e8;
    }

.btn-save-user {
    padding: 9px 24px;
    background: #111;
    color: #fff;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.18s ease, opacity 0.18s ease;
}

    .btn-save-user:hover:not(:disabled) {
        background: #333;
    }

    .btn-save-user:disabled {
        background: #aaa;
        cursor: not-allowed;
        opacity: 0.7;
    }

/* ================= ROW ACTION MENU ================= */
.user-action-menu {
    position: absolute;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
    padding: 8px;
    width: fit-content;
    white-space: nowrap;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    animation: fadeSlideDown 0.15s ease-out;
}

    .user-action-menu .action-btn {
        width: 100%;
        background: transparent;
        border: none;
        padding: 10px 14px;
        text-align: left;
        font-size: 14px;
        border-radius: 6px;
        cursor: pointer;
        transition: background 0.15s ease;
    }

        .user-action-menu .action-btn:hover {
            background: #f2f6ff;
        }

        .user-action-menu .action-btn.edit-user {
            color: #333;
        }

        .user-action-menu .action-btn.delete-user {
            color: #e53935;
        }

/* ================= TOAST ================= */
.ud-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: #111;
    color: #fff;
    padding: 11px 22px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    z-index: 9999;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
    transition: opacity 0.3s ease;
}

    .ud-toast.success {
        background: #1a6f32;
    }

    .ud-toast.error {
        background: #c0392b;
    }

/* ================= UTIL ================= */
.hidden {
    display: none !important;
}

.d-none {
    display: none !important;
}

/* ================= RESPONSIVE ================= */
@media (max-width: 992px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .userdesk {
        padding: 10px;
    }

    .userdesk-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .users-header,
    .users-row {
        grid-template-columns: 2fr 1.5fr 2fr 1.5fr;
        font-size: 13px;
        padding: 8px;
    }

    .users-table {
        min-width: 500px;
    }

    .form-actions {
        flex-direction: column-reverse;
    }

        .form-actions button {
            width: 100%;
        }
}

@media (max-width: 576px) {
    .userdesk-header h2 {
        font-size: 18px;
    }

    .users-header,
    .users-row {
        grid-template-columns: 1.5fr 1fr 1.5fr 1fr;
        font-size: 12px;
        padding: 6px;
    }

    .users-table {
        min-width: 400px;
    }
}
