@import url('./../../../../gbhost/public/gbstyle/gbcommonstyle.scss');

.user-management-container {
    padding: 32px;
    background-color: #f8f9fa;
    min-height: 100vh;
}

.Itemimg {
    position: relative;
    top: 70px;
    left: -90px;
    width: 110px;
    height: 110px;
}

// Header Section
.header-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.title-section {
    display: flex;
    align-items: center;
    gap: 16px;

    .user-icon {
        color: var(--action-primary-default);
        flex-shrink: 0;
    }
}

.page-title {
    font-size: 28px;
    font-weight: 600;
    color: #202124;
    margin: 0 0 4px 0;
}

.user-count {
    font-size: 16px;
    color: #202124;
    margin: 0;
}

.btn-create-user {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background-color: var(--action-primary-default);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;

    &:hover {
        background-color: var(--action-primary-default);
        box-shadow: 0 2px 8px rgba(26, 115, 232, 0.3);
    }

    &:active {
        transform: translateY(1px);
    }

    svg {
        width: 20px;
        height: 20px;
    }
}

// Filters Section
.filters-section {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    align-items: center;
}

.search-box {
    position: relative;
    flex: 1;
    max-width: 600px;

    .search-icon {
        position: absolute;
        left: 16px;
        top: 50%;
        transform: translateY(-50%);
        color: #5f6368;
        pointer-events: none;
    }

    .search-input {
        width: 100%;
        padding: 12px 16px 12px 48px;
        border: 1px solid #dadce0;
        border-radius: 8px;
        font-size: 14px;
        color: #202124;
        background-color: white;
        transition: all 0.2s ease;
        box-sizing: border-box;

        &::placeholder {
            color: #9aa0a6;
        }

        &:focus {
            outline: none;
            border-color: #1a73e8;
            box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.1);
        }
    }
}

.filter-select {
    padding: 12px 36px 12px 16px;
    border: 1px solid #dadce0;
    border-radius: 8px;
    font-size: 14px;
    color: #202124;
    background-color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 150px;
    appearance: none;
    -webkit-appearance: none;

    &:hover {
        border-color: #1a73e8;
    }

    &:focus {
        outline: none;
        border-color: #1a73e8;
        box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.1);
    }
}

// Table Section
.table-container {
    background-color: white;
    border-radius: 12px;
    overflow-x: auto;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    -webkit-overflow-scrolling: touch;
}

.user-table {
    width: 100%;
    min-width: 1000px;
    border-collapse: collapse;

    thead {
        background-color: #f8f9fa;
        border-bottom: 1px solid #e8eaed;

        th {
            padding: 16px 20px;
            font-family: Helvetica !important;
            font-weight: 700;
            font-size: 14px;
            text-align: left;
            line-height: 150%;
            color: #1A1A1ADE;
        }
    }

    tbody {
        tr {
            border-bottom: 1px solid #e8eaed;
            transition: background-color 0.2s ease;

            &:last-child {
                border-bottom: none;
            }

            &:hover {
                background-color: #f8f9fa;
            }

            td {
                padding: 16px 20px;
                font-family: Helvetica !important;
                font-weight: 400;
                font-size: 14px;
                line-height: 150%;
                color: #1A1A1ADE;
                vertical-align: middle;
            }
        }
    }
}

.formtitle {
    font-family: Helvetica !important;
    font-weight: 700;
    font-size: 16px;
    text-align: left;
    line-height: 150%;
    color: #1A1A1ADE;
}

// Badge Styles
.role-badge {
    display: inline-block;
    padding: 4px 12px;
    background-color: #f1f3f4;
    font-family: Helvetica !important;
    font-weight: 700;
    font-size: 14px;
    text-align: left;
    line-height: 150%;
    color: #1A1A1ADE;
}

.status-badge {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 500;
    text-transform: lowercase;

    &.active {
        background-color: var(--action-primary-default);
        color: white;
    }

    &.inactive {
        background-color: #e8eaed;
        color: #5f6368;
    }
}

// Action Buttons
.actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.action-btn {
    padding: 8px;
    background-color: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    color: #5f6368;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;

    &:hover {
        background-color: #f1f3f4;
        color: #202124;
    }

    &:active {
        transform: scale(0.95);
    }

    &.power {
        color: #34a853;

        &:hover {
            background-color: rgba(52, 168, 83, 0.1);
            color: #188038;
        }
    }

    svg {
        width: 18px;
        height: 18px;
    }
}

// No Data State
.no-data {
    text-align: center;
    padding: 48px 20px !important;
    color: #5f6368;
    font-size: 14px;
}

.digital-signature-container {
    padding: 24px;
    max-width: 1200px;
    display: flex;
}

.section-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 24px;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid #f5f5f5;
}

.section-icon {
    color: var(--action-primary-default);
    font-size: 24px;
    width: 24px;
    height: 24px;
}

.section-title {
    font-size: 20px;
    font-weight: 600;
    color: #212121;
    margin: 0;
}

.section-content {
    display: flex;
    gap: 24px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-label {
    font-size: 14px;
    font-weight: 500;
    color: #424242;
}

.browse-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: white;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    font-size: 14px;
    color: #424242;
    cursor: pointer;
    transition: all 0.2s;
    width: fit-content;

    &:hover {
        background: #f5f5f5;
        border-color: #1976d2;
    }

    mat-icon {
        font-size: 18px;
        width: 18px;
        height: 18px;
    }
}

.form-input {
    padding: 12px;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    font-size: 14px;
    color: #424242;
    transition: border-color 0.2s;

    &:focus {
        outline: none;
        border-color: #1976d2;
    }
}

.helper-text {
    font-size: 12px;
    color: #757575;
    margin: 4px 0 0 0;
}

.file-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #424242;
    background: #f5f5f5;
    padding: 8px 12px;
    border-radius: 4px;
    margin-top: 8px;

    mat-icon {
        font-size: 18px;
        width: 18px;
        height: 18px;
        color: #1976d2;
    }
}

.profile-photo-container {
    display: flex;
    align-items: flex-start;
    gap: 24px;
}

.photo-preview {
    width: 160px;
    height: 160px;
    border: 2px dashed #d0d0d0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fafafa;
    overflow: hidden;
}

.preview-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.default-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;

    mat-icon {
        font-size: 80px;
        width: 80px;
        height: 80px;
        color: var(--action-primary-default);
    }
}

.photo-upload {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

td.clickable-cell {
    cursor: pointer;
}

.FormModal_contentLovType {
    justify-content: center;
    background-color: var(--mat-sys-background);
    margin: auto;
    padding: 10px;
    border: 1px solid #888;
    width: 95%;
    max-width: 1350px;
    height: 90vh;
    max-height: 550px;
    border-radius: 10px;
    overflow-x: hidden;
}

.FormOverView {
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

.FormsTabGroup {
    max-width: 100%;
    width: 100%;
}

::ng-deep .mat-tab-group {
    max-width: 100%;
}


// ── Large screens (1200px) ──────────────
@media (max-width: 1200px) {
    .filters-section {
        flex-wrap: wrap;
    }

    .search-box {
        max-width: 100%;
    }
}

// ── Mobile (360px to 768px) ──────────────
@media (max-width: 768px) {

    // 1. Clip layout containers
    :host,
    .user-management-container,
    .FormOverView,
    .FormsTabGroup,
    .filters-section,
    .header-section,
    .section-card,
    .form-group,
    .digital-signature-container {
        box-sizing: border-box !important;
        max-width: 100% !important;
        overflow-x: hidden !important;
    }

    // 2. Override inline style="display: flex;" divs inside FormOverView
    .FormOverView div[style*="display: flex"],
    .FormOverView div[style*="display:flex"] {
        flex-direction: column !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        gap: 0 !important;
    }

    // 3. Override inline margin-left/right on child divs
    .FormOverView div[style*="margin-left"],
    .FormOverView div[style*="margin-right"] {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    // 4. gb-* simple elements full width
    gb-input,
    gb-date,
    gb-radiobutton,
    gb-checkbox,
    gb-textarea {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        margin-bottom: 12px !important;
        margin-left: 0 !important;
        overflow-x: hidden;
    }

    // 4b. gb-combobox & gb-time — fixed width, NOT full width
    gb-time {
        display: block !important;
        width: auto !important;
        max-width: 200px !important;
        box-sizing: border-box !important;
        margin-bottom: 12px !important;
        margin-left: 0 !important;
        overflow-x: hidden;
    }

    // 5. gb-newpicklist host — full width
    ::ng-deep gb-newpicklist {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
        overflow: visible !important;
        margin-bottom: 12px !important;
        margin-left: 0 !important;
    }

    // 5b. gb-combobox host — fixed width, NOT full width
    ::ng-deep gb-combobox {
        display: block !important;
        width: auto !important;
        max-width: 320px !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
        overflow: visible !important;
        margin-bottom: 12px !important;
        margin-left: 0 !important;
    }

    // 6. Angular Material internal wrappers — picklist, date, input & textarea full width
    ::ng-deep gb-newpicklist .mat-mdc-text-field-wrapper,
    ::ng-deep gb-newpicklist .mdc-text-field,
    ::ng-deep gb-newpicklist .mat-mdc-form-field,
    ::ng-deep gb-newpicklist .mat-mdc-form-field-flex,
    ::ng-deep gb-newpicklist .mat-mdc-form-field-infix,
    ::ng-deep gb-date .mat-mdc-text-field-wrapper,
    ::ng-deep gb-date .mdc-text-field,
    ::ng-deep gb-date .mat-mdc-form-field,
    ::ng-deep gb-date .mat-mdc-form-field-flex,
    ::ng-deep gb-date .mat-mdc-form-field-infix,
    ::ng-deep gb-input .mat-mdc-text-field-wrapper,
    ::ng-deep gb-input .mdc-text-field,
    ::ng-deep gb-input .mat-mdc-form-field,
    ::ng-deep gb-input .mat-mdc-form-field-flex,
    ::ng-deep gb-input .mat-mdc-form-field-infix,
    ::ng-deep gb-textarea .mat-mdc-text-field-wrapper,
    ::ng-deep gb-textarea .mdc-text-field,
    ::ng-deep gb-textarea .mat-mdc-form-field,
    ::ng-deep gb-textarea .mat-mdc-form-field-flex,
    ::ng-deep gb-textarea .mat-mdc-form-field-infix {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
        height: auto !important;
    }

    // 6b. Combobox & time internal wrappers — auto width (not stretched)
    ::ng-deep gb-combobox .mat-mdc-text-field-wrapper,
    ::ng-deep gb-combobox .mdc-text-field,
    ::ng-deep gb-combobox .mat-mdc-form-field,
    ::ng-deep gb-time .mat-mdc-text-field-wrapper,
    ::ng-deep gb-time .mdc-text-field,
    ::ng-deep gb-time .mat-mdc-form-field {
        width: auto !important;
        max-width: 320px !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
        overflow: visible !important;
        height: auto !important;
    }

    // 6c. Combobox flex container — arrow at the end
    ::ng-deep gb-combobox .mat-mdc-form-field-flex {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
    }

    ::ng-deep gb-combobox .mat-mdc-form-field-infix {
        flex: 1 1 auto !important;
        width: auto !important;
        min-width: 0 !important;
    }

    ::ng-deep gb-time .mat-mdc-form-field-flex,
    ::ng-deep gb-time .mat-mdc-form-field-infix {
        width: auto !important;
        min-width: 0 !important;
    }

    // 7. Input & textarea elements inside fields
    ::ng-deep gb-newpicklist input,
    ::ng-deep gb-combobox input,
    ::ng-deep gb-date input,
    ::ng-deep gb-time input,
    ::ng-deep gb-input input,
    ::ng-deep gb-textarea textarea {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        flex: 1 1 auto !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    // 8. Arrow/chevron icons — fixed size
    ::ng-deep gb-newpicklist mat-icon,
    ::ng-deep gb-combobox mat-icon,
    ::ng-deep gb-date mat-icon,
    ::ng-deep gb-time mat-icon {
        width: 24px !important;
        min-width: 24px !important;
        max-width: 24px !important;
        flex-shrink: 0 !important;
        flex-grow: 0 !important;
        box-sizing: content-box !important;
        overflow: visible !important;
    }

    // 9. Suffix container — arrow at the END of the field
    ::ng-deep gb-newpicklist .mat-mdc-form-field-icon-suffix,
    ::ng-deep gb-date .mat-mdc-form-field-icon-suffix,
    ::ng-deep gb-time .mat-mdc-form-field-icon-suffix,
    ::ng-deep gb-newpicklist [matsuffix],
    ::ng-deep gb-date [matsuffix],
    ::ng-deep gb-time [matsuffix] {
        flex-shrink: 0 !important;
        width: auto !important;
        padding-right: 8px !important;
        overflow: visible !important;
    }

    // 9b. Combobox arrow — positioned at the END, inside the field
    ::ng-deep gb-combobox .mat-mdc-form-field-icon-suffix,
    ::ng-deep gb-combobox [matsuffix] {
        display: flex !important;
        align-items: center !important;
        justify-content: flex-end !important;
        flex-shrink: 0 !important;
        width: auto !important;
        margin-left: auto !important;
        padding-right: 8px !important;
        overflow: visible !important;
    }

    // 9c. Combobox select trigger — keep arrow at end
    ::ng-deep gb-combobox .mat-mdc-select-trigger {
        display: flex !important;
        align-items: center !important;
        width: 100% !important;
    }

    ::ng-deep gb-combobox .mat-mdc-select-arrow-wrapper {
        display: flex !important;
        align-items: center !important;
        justify-content: flex-end !important;
        margin-left: auto !important;
        flex-shrink: 0 !important;
    }

    // 10. Subscript/hint area — collapse phantom height
    ::ng-deep gb-newpicklist .mat-mdc-form-field-subscript-wrapper,
    ::ng-deep gb-combobox .mat-mdc-form-field-subscript-wrapper,
    ::ng-deep gb-date .mat-mdc-form-field-subscript-wrapper,
    ::ng-deep gb-time .mat-mdc-form-field-subscript-wrapper {
        height: 0 !important;
        min-height: 0 !important;
        overflow: hidden !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    // 11. gb-formaction toolbar
    ::ng-deep gb-formaction {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        box-sizing: border-box !important;
    }

    // 12. Table scrolls horizontally
    .table-container {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    // 13. Header & button
    .user-management-container {
        padding: 16px !important;
    }

    .header-section {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 16px !important;
    }

    .btn-create-user {
        width: 100% !important;
        justify-content: center !important;
    }

    // 14. Filters
    .filters-section {
        flex-direction: column !important;
        gap: 8px !important;
    }

    .search-box {
        max-width: 100% !important;
        width: 100% !important;
    }

    .filter-select {
        width: 100% !important;
        min-width: unset !important;
        box-sizing: border-box !important;
    }

    // 15. Image & digital signature
    .Itemimg {
        position: static !important;
        margin: 20px auto !important;
        left: auto !important;
        top: auto !important;
    }

    .digital-signature-container {
        flex-direction: column !important;
        padding: 16px !important;
    }

    .section-card {
        margin-left: 0 !important;
        padding: 16px !important;
    }

    .section-content {
        flex-direction: column !important;
    }

    .profile-photo-container {
        flex-direction: column !important;
    }

    .photo-preview {
        width: 120px !important;
        height: 120px !important;
    }
}

// ── Small mobile (360–400px) ─────────────
@media (max-width: 400px) {

    .user-management-container {
        padding: 8px !important;
    }

    .FormOverView {
        padding: 8px !important;
    }

    .user-management-container>*,
    .FormOverView>*,
    .filters-section>*,
    .header-section>* {
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
}