/* Agent Finder Widget Styles */

/* ==========================================
   Base Styles
   ========================================== */
.btn-default {
    border-color: transparent;
}

#i-form #content-container {
    border: 2px solid #ff9b00;
    border-radius: 16px;
    padding: 1rem 2rem;
    transition: border-color 0.35s ease;
    background-color: rgba(255, 255, 255, 0.66);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

#i-form #content-container:focus-within {
    outline: 2px solid #FEC344 !important;
    border-color: #FEC344 !important;
}

#i-form h2 {
    color: #FEC344;
    font-family: "Roboto", Sans-serif;
    font-weight: 600;
    font-size: 1.6rem;
    margin-top: 0 !important;
}

#i-form textarea {
    resize: none;
    transition: height 0.35s ease;
    min-height: 12rem;
    max-height: 16rem;
    height: auto;
    field-sizing: content;
    border: 0px transparent;
    box-shadow: none;
    font-size: 2rem;
    background-color: transparent;
}

#i-form button,
#i-form .btn {
    font-size: 3rem;
    color: #FF8727;
    background-color: transparent;
}

#i-form button:hover,
#i-form .btn:hover {
    border: 0;
}

#i-form button:disabled,
#i-form .btn:disabled {
    border: 0;
    color: lightgray;
}

#i-form #remark {
    font-size: 2rem;
    color: red;
}

/* Drop Zone */
#i-form .drop-zone {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    background-color: rgba(0, 0, 0, 0.5);
    border: 2px dashed #FF8727;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    border-radius: 8px;
    transition: background-color 0.2s ease-in-out;
}

#i-form .drop-zone.dragover {
    display: flex;
}

/* File List */
#i-form .file-list {
    list-style: none;
    padding: 0 1rem;
    margin-block-end: 0;
}

#i-form .file-list-item {
    display: inline-flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    border: 1px solid #dee2e6;
    border-radius: 5px;
    margin-bottom: 0.5rem;
    margin-right: 0.5rem;
    background-color: #f8f9fa;
    color: black;
    font-size: 1.2rem;
    gap: 1rem;
    max-width: 100%;
}

#i-form .file-list-item span {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    line-height: 1em;
}

#i-form .btn-file-remove {
    font-size: 1.2rem;
    padding: 1rem;
}

.d-none {
    display: none !important;
}

/* ==========================================
   Loading Animation
   ========================================== */
.loading-anim-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #FFFFFF;
    text-align: center;
    font-family: "Courier New", Courier, monospace;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    position: absolute;
    left: -100vw;
    right: -100vw;
    top: -100vh;
    bottom: -100vh;
    z-index: 9999;
}

.cyber-spinner {
    position: relative;
    width: 80px;
    height: 80px;
    border: 4px solid rgba(254, 195, 68, 0.2);
    border-top: 4px solid #fec344;
    border-radius: 50%;
    animation: spin 1.5s linear infinite;
    box-shadow: 0 0 15px #fec344, 0 0 30px #fec344;
}

.cyber-spinner::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60%;
    height: 60%;
    border: 2px solid rgba(254, 195, 68, 0.5);
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(254, 195, 68, 0.8), 0 0 20px rgba(254, 195, 68, 0.5);
}

.loading-text {
    margin-top: 1rem;
    font-size: 2rem !important;
    font-weight: bold !important;
    letter-spacing: 2px;
    color: #ff9c26;
    text-shadow: 
        -2px -2px 0 white,
        0   -2px 0 white,
        2px -2px 0 white,
        -2px  0   0 white,
        2px  0   0 white,
        -2px  2px 0 white,
        0    2px 0 white,
        2px  2px 0 white;
    position: relative;
    padding: 1rem;
    text-align: center !important;
    max-width: 40rem;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* ==========================================
   Modal Base Styles
   ========================================== */
.settings-modal {
    display: none;
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: auto;
    max-width: 80vw;
    max-height: 80vh;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 99999;
    margin: 0 !important;
    padding: 0 !important;
}

.settings-modal-content {
    position: relative;
    width: 100%;
    height: 100%;
    background: white;
    border-radius: 16px;
    overflow: hidden;
}

.settings-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
}

.settings-modal-title {
    margin: 0 1rem 0 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.close-button {
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.settings-modal-body {
    overflow-y: auto;
}

.settings-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #eee;
}

.settings-item:last-child {
    border-bottom: none;
}

.settings-item label {
    font-size: 15px;
    color: #333;
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 24px;
}

.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: .3s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #FF8727;
}

input:checked + .slider:before {
    transform: translateX(22px);
}

/* Validation Hint */
.am-validation-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    background: #fff9e6;
    border-top: 1px solid #FEC344;
    border-bottom: 1px solid #FEC344;
    color: #FF8727;
    font-size: 13px;
    font-weight: 500;
}

.am-validation-hint i {
    font-size: 16px;
    flex-shrink: 0;
}

/* Modal Footer */
.settings-modal-footer {
    padding: 16px 20px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: center;
    gap: 10px;
}

.setting-button {
    min-width: 100px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.setting-button:hover {
    opacity: 0.5 !important;
}

.setting-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #ccc !important;
    color: #999 !important;
}

.button-cancel {
    background: #ffffff;
    color: #FF8727;
    border: 1px solid #FF8727;
}

.button-primary {
    background: #FF8727;
    color: white;
    border: 1px solid #FF8727;
}

/* Modal Overlay */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 99998;
    pointer-events: all;
}

body.no-scroll {
    overflow: hidden;
}

/* ==========================================
   Toast Notifications
   ========================================== */
.custom-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    min-width: 200px;
    padding: 16px 24px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 999999;
    opacity: 0;
    transition: all 0.3s ease;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.custom-toast.success {
    background-color: #4CAF50;
    color: white;
}

.custom-toast.error {
    background-color: #f44336;
    color: white;
}

.custom-toast.warning {
    background-color: #ff9800;
    color: white;
}

.custom-toast.info {
    background-color: #2196F3;
    color: white;
}

.custom-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ==========================================
   Settings Checkboxes (Main Toggle Options)
   ========================================== */
.settings-checkboxes {
    display: flex;
    align-items: center;
    gap: 0.3rem 0.5rem;
    flex-wrap: wrap;
    max-width: 100%;
    padding-bottom: 8px;
    -webkit-overflow-scrolling: touch;
}

.settings-checkboxes::-webkit-scrollbar {
    height: 4px;
}

.settings-checkboxes::-webkit-scrollbar-track {
    background: transparent;
}

.settings-checkboxes::-webkit-scrollbar-thumb {
    background-color: rgba(255, 135, 39, 0.3);
    border-radius: 2px;
}

.setting-option {
    display: flex;
    align-items: center;
    padding: 4px 8px;
    background: #fefdf8;
    border-radius: 20px;
    border: 2px solid #f8f2dd;
    white-space: nowrap;
    flex-shrink: 0;
    gap: 6px;
    cursor: pointer;
}

.setting-option .badge {
    position: absolute;
    top: -10px;
    right: -10px;
    background-color: #4caf50;
    color: white;
    font-size: 12px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 50%;
    display: none;
    line-height: initial !important;
}

.setting-option label {
    font-size: 1rem;
    color: #666;
    cursor: pointer;
    user-select: none;
    margin: 0;
    order: 2;
    position: relative;
    flex-grow: 1;
}

@media (min-width: 768px) {
    .setting-option label {
        font-size: 1.4rem;
    }
}

.setting-option .toggle-switch {
    width: 16px;
    height: 16px;
    position: relative;
    order: 1;
    flex-shrink: 0;
}

.setting-option input[type="checkbox"] {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.setting-option .toggle-dot {
    position: absolute;
    top: 0;
    left: 0;
    width: 16px;
    height: 16px;
    background-color: #fff;
    border: 2px solid #FF8727;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.setting-option input[type="checkbox"]:checked + .toggle-dot {
    background-color: #FF8727;
}

.setting-option input[type="checkbox"]:checked + .toggle-dot::after {
    content: '✓';
    position: absolute;
    color: white;
    font-size: 10px;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

.setting-option.disabled {
    background: #f5f5f5 !important;
    cursor: not-allowed;
}

.setting-option.disabled label {
    color: #dfd9d9 !important;
}

.setting-option.disabled .toggle-dot {
    border-color: rgb(221 221 221) !important;
}

/* ==========================================
   Digital Assets Dialog Styles
   ========================================== */
#settings-digital-assets {
    width: 90vw;
    max-width: 480px;
}

.da-dialog {
    display: flex;
    flex-direction: column;
}

.da-body {
    padding: 0 !important;
}

.da-section {
    padding: 16px 20px;
}

.da-section + .da-section {
    border-top: 1px solid #f0f0f0;
}

.da-section-header {
    margin-bottom: 12px;
}

.da-section-title {
    font-size: 13px;
    font-weight: 600;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.da-enable-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.da-enable-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.da-enable-label {
    font-size: 15px;
    font-weight: 500;
    color: #333;
}

.da-enable-hint {
    font-size: 13px;
    color: #888;
}

.da-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.preset-btn {
    padding: 10px 16px;
    border: 2px solid #f0ebe0;
    border-radius: 20px;
    background-color: #fefdf8;
    color: #666;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preset-btn:hover {
    border-color: #FEC344;
    background-color: #fff9e6;
}

.preset-btn.active {
    border-color: #FF8727;
    background-color: #FF8727;
    color: white;
}

.da-date-inputs {
    display: flex;
    align-items: flex-end;
    gap: 12px;
}

.da-date-field {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.da-date-field label {
    font-size: 13px;
    font-weight: 500;
    color: #666;
}

.digital-assets-date-input {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #f0ebe0;
    border-radius: 10px;
    font-size: 14px;
    color: #333;
    background-color: #fefdf8;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    min-height: 44px;
    box-sizing: border-box;
}

.digital-assets-date-input:focus {
    border-color: #FF8727;
    box-shadow: 0 0 0 3px rgba(255, 135, 39, 0.15);
}

.digital-assets-date-input:hover {
    border-color: #FEC344;
}

.da-date-separator {
    color: #ccc;
    font-size: 16px;
    padding-bottom: 12px;
    flex-shrink: 0;
}

.da-date-hint {
    display: none;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    padding: 8px 12px;
    background-color: #f8f5e8;
    border-radius: 8px;
    font-size: 13px;
    color: #888;
}

.da-date-hint.visible {
    display: flex;
}

.da-date-hint i {
    color: #FEC344;
    font-size: 14px;
    flex-shrink: 0;
}

.da-dialog .settings-modal-footer {
    padding: 16px 20px;
}

.da-dialog .settings-modal-footer .setting-button {
    width: 100%;
    min-height: 48px;
    font-size: 16px;
    font-weight: 600;
}

/* Digital Assets Responsive */
@media (max-width: 479px) {
    #settings-digital-assets {
        width: 95vw;
        max-width: none;
        margin: 0 auto;
    }

    .da-section {
        padding: 14px 16px;
    }

    .da-presets {
        gap: 6px;
    }

    .preset-btn {
        flex: 1 1 calc(33.33% - 6px);
        min-width: 60px;
        padding: 10px 8px;
        font-size: 13px;
    }

    .da-date-inputs {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .da-date-separator {
        display: none;
    }

    .da-enable-label {
        font-size: 14px;
    }

    .da-enable-hint {
        font-size: 12px;
    }
}

@media (min-width: 480px) and (max-width: 768px) {
    #settings-digital-assets {
        width: 85vw;
        max-width: 420px;
    }

    .preset-btn {
        flex: 0 1 auto;
    }
}

@media (min-width: 769px) {
    #settings-digital-assets {
        width: auto;
        min-width: 400px;
        max-width: 480px;
    }

    .da-section {
        padding: 20px 24px;
    }

    .da-dialog .settings-modal-footer {
        padding: 16px 24px;
    }

    .da-dialog .settings-modal-footer .setting-button {
        width: auto;
        min-width: 120px;
    }
}

/* ==========================================
   First-time Tour
   ========================================== */
.am-tour-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.am-tour-content {
    background: white;
    border-radius: 12px;
    padding: 32px;
    max-width: 480px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    animation: tourSlideIn 0.3s ease;
}

@keyframes tourSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.am-tour-content i {
    font-size: 64px;
    color: #FF8727;
    margin-bottom: 20px;
    display: block;
}

.am-tour-content h3 {
    font-size: 20px;
    margin-bottom: 12px;
    color: #333;
}

.am-tour-content p {
    font-size: 14px;
    color: #666;
    line-height: 1.6;
    margin-bottom: 24px;
}

.am-tour-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.am-tour-skip,
.am-tour-next {
    padding: 10px 24px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.am-tour-skip {
    background: #f0f0f0;
    color: #666;
}

.am-tour-skip:hover {
    background: #e0e0e0;
}

.am-tour-next {
    background: #FF8727;
    color: white;
}

.am-tour-next:hover {
    background: #e67620;
}

.am-tour-next:active,
.am-tour-skip:active {
    transform: scale(0.98);
}

/* ==========================================
   Agent Master Dialog Styles (NEW)
   ========================================== */
#settings-agent-master {
    width: 90vw;
    max-width: 900px;
    max-height: 90vh;
}

.agent-master-dialog {
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

.am-body {
    padding: 0 !important;
    overflow-y: visible;
    overflow-x: hidden;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.am-section {
    padding: 16px 20px;
}

.am-section + .am-section {
    border-top: 1px solid #f0f0f0;
}

/* Section 1: Enable Toggle */
.am-enable-section {
    background: #fefdf8;
}

.am-enable-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.am-enable-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.am-enable-label {
    font-size: 15px;
    font-weight: 500;
    color: #333;
}

.am-enable-hint {
    font-size: 13px;
    color: #888;
}

/* Section 2 & 3: Main Layout */
.am-main-section {
    padding: 0 !important;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.am-main-layout {
    display: flex;
    gap: 20px;
    padding: 20px;
    flex: 1;
    overflow: hidden;
}

.am-selection-panel {
    flex: 0 0 60%;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow: hidden;
}

.am-selected-panel {
    flex: 0 0 40%;
    display: flex;
    flex-direction: column;
    border: 2px solid #f0ebe0;
    border-radius: 12px;
    background: #fefdf8;
    padding: 16px;
    overflow: hidden;
}

/* Search Bar */
.am-search-bar {
    position: relative;
}

.am-search-bar input {
    width: 100%;
    padding: 10px 40px 10px 36px;
    border: 2px solid #f0ebe0;
    border-radius: 10px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
}

.am-search-bar input:focus {
    border-color: #FF8727;
}

.am-search-bar .bi-search {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
}

.am-search-bar .btn-clear-search {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 4px 8px;
}

.am-search-bar .btn-clear-search:hover {
    color: #333;
}

.am-search-hint {
    font-size: 12px;
    color: #666;
    padding: 4px 8px;
}

/* Agent List */
.am-agent-list {
    flex: 1;
    overflow-y: auto;
    padding-right: 8px;
}

.am-agent-list::-webkit-scrollbar {
    width: 6px;
}

.am-agent-list::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 3px;
}

.am-agent-list::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.am-agent-list::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Office Section */
.am-office-section {
    margin-bottom: 8px;
}

.am-office-header {
    display: flex;
    align-items: center;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s ease;
}

.am-office-header:hover {
    background: #f0f1f2;
}

.am-chevron {
    margin-right: 8px;
    transition: transform 0.2s ease;
    font-size: 14px;
}

.am-office-section[data-expanded="false"] .am-chevron {
    transform: rotate(-90deg);
}

.am-office-name {
    flex: 1;
    font-weight: 600;
    font-size: 15px;
    color: #333;
}

.am-office-count {
    color: #666;
    font-size: 13px;
}

.am-office-agents {
    padding: 8px 12px 8px 32px;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    max-height: 1000px;
    opacity: 1;
}

.am-office-section[data-expanded="false"] .am-office-agents {
    max-height: 0;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
}

/* Agent Option */
.am-agent-option {
    padding: 8px 12px;
    margin: 0 -12px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    border-radius: 6px;
    transition: background-color 0.15s ease;
}

.am-agent-option:hover {
    background-color: #f8f9fa;
}

.am-agent-option:active {
    background-color: #e9ecef;
}

.am-agent-add-btn {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border: 2px solid #FF8727;
    border-radius: 50%;
    background: white;
    color: #FF8727;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
    line-height: 1;
    pointer-events: none;
}

.am-agent-option:hover .am-agent-add-btn {
    background: #FF8727;
    color: white;
    transform: scale(1.15);
}

.am-agent-add-btn:disabled {
    border-color: #ddd;
    color: #ddd;
    transform: none;
}

.am-agent-option:has(.am-agent-add-btn:disabled) {
    cursor: not-allowed;
    opacity: 0.6;
}

.am-agent-option:has(.am-agent-add-btn:disabled):hover {
    background-color: transparent;
}

.am-agent-option:has(.am-agent-add-btn:disabled):hover .am-agent-add-btn {
    background: white;
    color: #ddd;
    transform: none;
}

.am-agent-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.am-agent-option .agent-name {
    font-size: 14px;
    color: #333;
    flex: 1;
}

.am-agent-option .agent-name mark {
    background-color: #FEC344;
    color: #333;
    padding: 0 2px;
    border-radius: 2px;
}

.am-agent-count-badge {
    font-size: 12px;
    color: #666;
    font-weight: 600;
    padding: 2px 8px;
    background: #f0f0f0;
    border-radius: 10px;
    border: 1px solid #ddd;
    display: none;
    transition: all 0.2s ease;
}

.am-agent-count-badge.show {
    display: inline-block;
}

/* Color-coded badges based on count */
.am-agent-count-badge.count-1 {
    color: #666;
    background: #f0f0f0;
    border-color: #ddd;
}

.am-agent-count-badge.count-2,
.am-agent-count-badge.count-3 {
    color: #FF8727;
    background: #fff9e6;
    border-color: #FEC344;
}

.am-agent-count-badge.count-4-plus {
    color: #d32f2f;
    background: #ffebee;
    border-color: #ef9a9a;
}

/* Loading Skeleton */
.am-loading-skeleton {
    padding: 12px;
}

.skeleton-office {
    margin-bottom: 24px;
}

.skeleton-office-header {
    height: 20px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
    margin-bottom: 12px;
    width: 60%;
}

.skeleton-agent {
    height: 36px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 6px;
    margin-bottom: 8px;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* Error State */
.am-error-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.am-error-state i {
    font-size: 48px;
    color: #f44336;
    margin-bottom: 16px;
    display: block;
}

.am-error-state p {
    margin-bottom: 20px;
    font-size: 14px;
}

.am-retry-btn {
    background: #FF8727;
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.2s ease;
}

.am-retry-btn:hover {
    background: #e67620;
}

.am-retry-btn:active {
    transform: scale(0.98);
}

/* No Results */
.am-no-results {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.am-no-results i {
    font-size: 48px;
    margin-bottom: 16px;
    display: block;
}

/* Workflow Visualization */
.am-workflow-item {
    display: flex;
    flex-direction: column;
    gap: 0;
    will-change: transform;
    position: relative;
}

/* Visual feedback during FLIP animation */
.am-workflow-moving {
    z-index: 10;
}

.am-workflow-moving .am-selected-item {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

/* Add animation */
.am-workflow-adding {
    animation: workflowAdd 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes workflowAdd {
    0% {
        opacity: 0;
        transform: scale(0.9) translateY(-10px);
    }
    50% {
        transform: scale(1.02) translateY(0);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Remove animation - slide right and fade out */
.am-workflow-removing {
    pointer-events: none;
}

.am-workflow-removing .am-selected-item {
    animation: workflowItemRemove 0.25s ease-out forwards;
}

.am-workflow-removing .am-flow-connector {
    animation: workflowConnectorRemove 0.25s ease-out forwards;
}

@keyframes workflowItemRemove {
    0% {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateX(30px) scale(0.9);
    }
}

@keyframes workflowConnectorRemove {
    0% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

/* Clear all animation - staggered fade out */
.am-clearing .am-selected-item {
    animation: clearingFade 0.2s ease-out forwards;
}

.am-clearing .am-flow-connector {
    animation: clearingFade 0.2s ease-out forwards;
}

@keyframes clearingFade {
    0% {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateX(20px) scale(0.95);
    }
}

/* Search result animations */
.am-search-visible {
    animation: searchFadeIn 0.3s ease-out forwards;
}

.am-search-hidden {
    animation: searchFadeOut 0.2s ease-out forwards;
}

.am-restore-visible {
    animation: searchFadeIn 0.25s ease-out forwards;
}

@keyframes searchFadeIn {
    0% {
        opacity: 0;
        transform: translateY(-8px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes searchFadeOut {
    0% {
        opacity: 1;
        transform: translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateY(-8px);
    }
}

.am-flow-connector {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px 0;
}

.am-flow-arrow {
    color: #bbb;
    font-size: 14px;
    user-select: none;
}

/* Selected Panel */
.am-selected-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 2px solid #f0ebe0;
}

.am-selected-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.am-selected-count {
    font-size: 14px;
    font-weight: 600;
    color: #666;
}

.am-selected-count.warning {
    color: #ff9800;
}

.am-selected-count.error {
    color: #f44336;
}

.am-selected-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    margin-bottom: 12px;
    padding: 0 10px 0 10px;
    margin-left: -10px;
    margin-right: -10px;
    transition: background 0.2s ease;
}

/* Visual feedback when dragging is active */
.am-selected-list.drag-mode {
    background: #f8f9fa;
    border-radius: 8px;
}

.am-selected-list::-webkit-scrollbar {
    width: 6px;
}

.am-selected-list::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 3px;
}

.am-selected-list::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

/* Empty State */
.am-empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.am-empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    display: block;
    color: #ddd;
}

.am-empty-title {
    margin: 8px 0;
    font-size: 15px;
    font-weight: 600;
    color: #333;
}

.am-empty-help {
    margin-top: 20px;
    text-align: left;
    display: inline-block;
}

.am-help-step {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
    font-size: 13px;
    color: #666;
}

.am-step-number {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    background: #FF8727;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 12px;
}

.am-help-step span:last-child {
    flex: 1;
    line-height: 24px;
}

.am-empty-state .hint {
    font-size: 12px;
    color: #bbb;
}

/* Selected Item */
.am-selected-item {
    display: flex;
    align-items: center;
    padding: 6px;
    background: white;
    border: 2px solid #f0ebe0;
    border-radius: 8px;
    margin-bottom: 2px;
    transition: background 0.2s ease, border-color 0.2s ease, opacity 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    /* Note: transform transition is handled separately by FLIP animation */
}

.am-selected-item:hover {
    border-color: #FEC344;
}

.am-selected-item.dragging {
    opacity: 0.4;
    cursor: grabbing;
    transform: scale(0.95);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    background: #f8f9fa;
    border-color: #FF8727;
}

.am-selected-item.am-highlight {
    border-color: #FF8727;
    background-color: #fff9e6;
    animation: highlightPulse 0.6s ease;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
}

@keyframes highlightPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 135, 39, 0.4);
    }
    50% {
        transform: scale(1.02);
        box-shadow: 0 0 0 8px rgba(255, 135, 39, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 135, 39, 0);
    }
}

.am-drag-handle {
    cursor: grab;
    color: #999;
    margin-right: 8px;
    font-size: 16px;
    user-select: none;
    transition: all 0.2s ease;
    padding: 4px;
    border-radius: 4px;
}

.am-drag-handle:hover {
    color: #FF8727;
    background: #fff9e6;
    transform: scale(1.1);
}

.am-drag-handle:active {
    cursor: grabbing;
    background: #FEC344;
}

.am-order-number {
    font-weight: 600;
    color: #FF8727;
    margin-right: 12px;
    min-width: 24px;
    text-align: center;
    font-size: 14px;
}

.am-agent-name {
    flex: 1;
    font-size: 14px;
    color: #333;
}

.am-btn-remove {
    background: none;
    border: none;
    font-size: 20px;
    color: #999;
    cursor: pointer;
    padding: 0 8px;
    line-height: 1;
    transition: color 0.2s ease;
    margin-left: auto;
}

.am-btn-remove:hover {
    color: #f44336;
}

/* Mobile Reorder Buttons */
.am-mobile-reorder {
    display: none;
    gap: 4px;
}

.am-btn-move-up,
.am-btn-move-down {
    background: #f0ebe0;
    border: 1px solid #e0e0e0;
    color: #666;
    cursor: pointer;
    padding: 8px 10px;
    font-size: 16px;
    border-radius: 6px;
    transition: all 0.2s ease;
    min-width: 40px;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.am-btn-move-up:hover,
.am-btn-move-down:hover {
    background: #FEC344;
    border-color: #FF8727;
}

.am-btn-move-up:active,
.am-btn-move-down:active {
    transform: scale(0.95);
}

.am-btn-move-up:disabled,
.am-btn-move-down:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Selected Footer */
.am-selected-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    border-top: 2px solid #f0ebe0;
}

.am-remaining-hint {
    font-size: 13px;
    color: #666;
}

.am-remaining-hint .count {
    font-weight: 600;
    color: #FF8727;
}

.btn-clear-all {
    background: white;
    border: 1px solid #ddd;
    padding: 6px 12px;
    border-radius: 6px;
    color: #666;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
}

.btn-clear-all:hover {
    background: #f5f5f5;
    border-color: #999;
}

/* Limit Warning */
.am-limit-warning {
    display: none;
    padding: 8px 12px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 6px;
    color: #856404;
    font-size: 13px;
    margin-top: 8px;
    text-align: center;
}

.am-limit-warning.show {
    display: block;
}

/* Drag & Drop Insertion Line */
/* Drop target indicator - bottom line (insert after this item) */
.am-selected-item.drag-target::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    right: 0;
    height: 4px;
    background: #FF8727;
    z-index: 10;
    border-radius: 2px;
    box-shadow: 0 0 8px rgba(255, 135, 39, 0.6);
    animation: dropPulse 0.6s ease infinite;
}

/* Drop target background highlight */
.am-selected-item.drag-target {
    background: #fff9e6;
    border-color: #FEC344;
    transform: scale(1.02);
}

@keyframes dropPulse {
    0%, 100% {
        opacity: 1;
        transform: scaleY(1);
    }
    50% {
        opacity: 0.7;
        transform: scaleY(1.2);
    }
}

/* ==========================================
   Agent Master Responsive Styles
   ========================================== */

/* Mobile Layout */
@media (max-width: 768px) {
    #settings-agent-master {
        width: 95vw;
        max-width: none;
        max-height: 90vh;
    }

    .settings-modal-header {
        padding: 12px 16px;
    }

    .settings-modal-title {
        font-size: 16px;
    }

    .am-enable-section {
        padding: 12px 16px;
    }

    .am-enable-label {
        font-size: 14px;
    }

    .am-enable-hint {
        font-size: 12px;
    }

    .am-main-layout {
        flex-direction: column;
        gap: 12px;
        padding: 12px;
        max-height: none;
    }

    .am-selected-panel {
        order: -1;
        flex: 0 0 auto;
        max-height: 30vh;
        min-height: 100px;
    }

    .am-selection-panel {
        flex: 1 1 auto;
        min-height: 35vh;
        gap: 8px;
    }

    .am-search-bar {
        margin-bottom: 0;
    }

    .am-search-bar input {
        padding: 8px 36px 8px 32px;
        font-size: 13px;
    }

    .am-agent-list {
        padding-right: 4px;
    }

    .am-office-section {
        margin-bottom: 6px;
    }

    .am-office-header {
        padding: 8px;
    }

    .am-office-agents {
        padding: 6px 8px 6px 24px;
    }

    .am-agent-option {
        padding: 6px 8px;
        margin: 0 -8px;
    }

    .settings-modal-footer {
        padding: 12px 16px;
    }

    .am-drag-handle {
        display: none;
    }

    .am-mobile-reorder {
        display: flex;
        flex-shrink: 0;
    }

    .am-selected-header {
        padding-bottom: 8px;
        margin-bottom: 8px;
    }

    .am-selected-header h3 {
        font-size: 14px;
    }

    .am-selected-count {
        font-size: 12px;
    }

    .am-agent-name {
        font-size: 13px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .am-office-name {
        font-size: 14px;
    }

    .am-selected-item {
        padding: 5px;
        gap: 4px;
    }

    .am-order-number {
        min-width: 22px;
        margin-right: 0;
        font-size: 14px;
        flex-shrink: 0;
    }

    .am-btn-remove {
        font-size: 22px;
        padding: 0;
        min-width: 40px;
        min-height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 6px;
        background: #f9f9f9;
        border: 1px solid #e0e0e0;
        flex-shrink: 0;
        margin-left: auto;
    }

    .am-btn-remove:active {
        transform: scale(0.95);
        background: #ffe5e5;
    }

    .am-selected-list {
        padding: 0 6px 0 6px;
        margin-left: -6px;
        margin-right: -6px;
    }

    .am-selected-footer {
        padding-top: 8px;
    }

    .am-remaining-hint {
        font-size: 12px;
    }

    .btn-clear-all {
        font-size: 12px;
        padding: 4px 10px;
    }
    
    /* Workflow visualization on mobile */
    .am-flow-connector {
        padding: 1px 0;
    }
    
    .am-flow-arrow {
        font-size: 12px;
    }
}

/* Tablet */
@media (min-width: 769px) and (max-width: 1024px) {
    #settings-agent-master {
        width: 90vw;
        max-width: 800px;
    }

    .am-main-layout {
        gap: 16px;
    }
}

/* Desktop */
@media (min-width: 1025px) {
    #settings-agent-master {
        width: 85vw;
        max-width: 900px;
    }

    .am-mobile-reorder {
        display: none;
    }
}
