/* ----------------------------------------------------
   DEPARTMENTS MODULE - PROFESSIONAL UI
   ---------------------------------------------------- */

:root {
    --dept-card-bg: rgba(255, 255, 255, 0.03);
    --dept-border: rgba(255, 255, 255, 0.08);
    --dept-hover-bg: rgba(255, 255, 255, 0.06);
    --dept-sidebar-bg: rgba(0, 0, 0, 0.15);
}

/* 1. VIEW CONTAINER & HEADER */
.dept-view-container {
    padding: 20px;
    animation: wbcDeptsFadeIn 0.4s ease-out;
}

.dept-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--dept-border);
}

.dept-header-bar .header-text h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    color: var(--wb-text-light);
}

.dept-header-bar .header-subtitle {
    margin: 5px 0 0;
    font-size: 13px;
    color: var(--wb-text-muted);
}

/* 2. CARD GRID STYLING */
.dept-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 25px;
    padding: 5px;
}

.dept-card {
    position: relative;
    background: var(--dept-card-bg);
    border: 1px solid var(--dept-border);
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.dept-card:hover {
    transform: translateY(-8px);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
    background: rgba(255, 255, 255, 0.06);
}

.card-edge {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 6px;
}

.card-header {
    padding: 25px 25px 15px;
    display: flex;
    align-items: center;
    gap: 18px;
}

.dept-icon-circle {
    width: 54px;
    height: 54px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.dept-info-main h4 {
    margin: 0 0 6px;
    font-size: 18px;
    font-weight: 600;
    color: var(--wb-text-light);
}

.dept-badge {
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dept-badge.status-active {
    background: rgba(40, 199, 111, 0.15);
    color: #28c76f;
}

.dept-badge.status-inactive {
    background: rgba(255, 255, 255, 0.05);
    color: var(--wb-text-muted);
}

.card-body {
    padding: 0 25px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.card-stat {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.card-stat .stat-label {
    color: var(--wb-text-muted);
}

.card-stat .stat-value {
    color: var(--wb-text-light);
    font-weight: 500;
}

.card-footer {
    margin-top: auto;
    padding: 15px 25px;
    background: rgba(0, 0, 0, 0.15);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    border-top: 1px solid var(--dept-border);
}

.btn-icon-action {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--dept-border);
    color: var(--wb-text-muted);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 16px;
}

.btn-icon-action:hover {
    background: var(--wb-accent-blue);
    color: white;
    border-color: var(--wb-accent-blue);
}

.btn-icon-action.btn-delete:hover {
    background: #ea5455;
    border-color: #ea5455;
}

/* Empty State / Loader in Grid */
.empty-grid-placeholder {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 100px 20px;
    color: var(--wb-text-muted);
    background: var(--dept-card-bg);
    border: 2px dashed var(--dept-border);
    border-radius: 20px;
}

.empty-grid-placeholder i {
    font-size: 60px;
    margin-bottom: 20px;
    opacity: 0.2;
}

.grid-loader {
    grid-column: 1 / -1;
    padding: 100px !important;
}

/* 3. MODAL DESIGN */
.dept-modal-content {
    max-width: 850px !important;
    width: 90%;
    background: #1a1d21 !important;
    border: 1px solid var(--dept-border) !important;
    border-radius: 16px !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5) !important;
    padding: 0 !important;
    overflow: hidden;
}

.dept-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--dept-border);
}

.header-title-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-icon {
    font-size: 18px;
    color: var(--wb-accent-blue);
}

.dept-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.dept-modal-header .close-modal {
    font-size: 28px;
    color: var(--wb-text-muted);
    transition: color 0.2s;
}

.dept-modal-header .close-modal:hover {
    color: var(--wb-text-light);
}

/* Modal Body & Sidebar */
.dept-modal-body {
    display: flex;
    height: 550px;
}

.dept-modal-sidebar {
    width: 200px;
    background: var(--dept-sidebar-bg);
    border-right: 1px solid var(--dept-border);
    padding: 20px 10px;
}

.dept-tabs-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.modal-tab-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    margin-bottom: 5px;
    border-radius: 8px;
    color: var(--wb-text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
}

.modal-tab-item i {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.modal-tab-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--wb-text-light);
}

.modal-tab-item.active {
    background: var(--wb-accent-blue);
    color: white !important;
    box-shadow: 0 4px 12px rgba(85, 110, 230, 0.3);
}

/* Modal Content Area */
.dept-modal-main-content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}

.dept-modal-main-content::-webkit-scrollbar {
    width: 6px;
}

.dept-modal-main-content::-webkit-scrollbar-thumb {
    background: var(--dept-border);
    border-radius: 10px;
}

/* 4. FORM ELEMENTS */
.form-group-modern {
    margin-bottom: 25px;
}

.form-group-modern label {
    display: block;
    margin-bottom: 10px;
    font-size: 13px;
    font-weight: 500;
    color: var(--wb-text-muted);
}

.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-icon i {
    position: absolute;
    left: 15px;
    color: var(--wb-text-muted);
}

.input-with-icon .dark-input {
    padding-left: 45px !important;
}

.color-picker-wrapper {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(0, 0, 0, 0.2);
    padding: 10px 15px;
    border-radius: 8px;
    border: 1px solid var(--dept-border);
}

.color-picker-wrapper input[type="color"] {
    -webkit-appearance: none;
    appearance: none;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 6px;
    cursor: pointer;
    background: transparent;
}

.color-picker-wrapper input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-picker-wrapper input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

.color-preview-text {
    font-size: 12px;
    color: var(--wb-text-muted);
}

.input-with-unit {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    border: 1px solid var(--dept-border);
    overflow: hidden;
}

.input-with-unit .dark-input {
    border: none !important;
    background: transparent !important;
    flex: 1;
}

.input-with-unit .unit {
    padding: 0 15px;
    background: rgba(255, 255, 255, 0.05);
    height: 100%;
    display: flex;
    align-items: center;
    color: var(--wb-text-muted);
    font-size: 12px;
    border-left: 1px solid var(--dept-border);
}

.helper-text {
    display: block;
    margin-top: 8px;
    font-size: 11px;
    color: var(--wb-text-muted);
}

/* Info Banners */
.info-banner-warning {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    background: rgba(255, 193, 7, 0.05);
    border-left: 3px solid #ffc107;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 25px;
}

.info-banner-warning i {
    color: #ffc107;
    margin-top: 2px;
}

.info-banner-warning p {
    margin: 0;
    font-size: 13px;
    color: #ffc107;
    line-height: 1.5;
}

/* Coming Soon */
.coming-soon-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--wb-text-muted);
    text-align: center;
    padding: 40px;
}

.coming-soon-wrapper i {
    font-size: 50px;
    margin-bottom: 20px;
    opacity: 0.3;
}

.coming-soon-wrapper h4 {
    margin: 0 0 10px;
    color: var(--wb-text-light);
}

/* 5. FOOTER & BUTTONS */
.dept-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    padding: 20px 25px;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid var(--dept-border);
}

.btn-save-dept {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 25px !important;
    font-weight: 600 !important;
    letter-spacing: 0.5px;
}

/* 6. UTILS & ANIMATIONS */
@keyframes wbcDeptsFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.animated {
    animation-duration: 0.3s;
    animation-fill-mode: both;
}

.fadeIn {
    animation-name: wbcDeptsFadeIn;
}

/* Custom Styles for JS injected elements */
.dept-status-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.dept-color-dot {
    display: inline-block;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* Agents Grid */
.agents-grid-selection {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
}

.agent-item-checkbox {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--dept-border);
    border-radius: 10px;
    transition: all 0.2s;
    cursor: pointer;
}

.agent-item-checkbox:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--wb-accent-blue);
}

.agent-item-checkbox input {
    width: 18px;
    height: 18px;
}

.agent-info {
    display: flex;
    flex-direction: column;
}

.agent-name {
    font-size: 14px;
    font-weight: 500;
}

.agent-role {
    font-size: 11px;
    color: var(--wb-text-muted);
}

/* 7. COMPLEX SECTIONS (BOT, AUTO-CLOSE, SCHEDULE) */

/* Bot Flow */
.dept-bot-actions {
    position: relative;
}

.btn-text-small {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--dept-border);
    color: var(--wb-text-light);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-text-small:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--wb-accent-blue);
}

.dept-steps-list-wrapper {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.dept-step-card {
    background: rgba(255, 255, 255, 0.02) !important;
    border: 1px solid var(--dept-border) !important;
    border-radius: 12px !important;
    padding: 15px !important;
    transition: border-color 0.2s;
}

.dept-step-card:hover {
    border-color: rgba(255, 255, 255, 0.15) !important;
}

/* Switches & Layout */
.dept-switches-group {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--dept-border);
    margin-top: 15px;
}

.switch-item {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: var(--wb-text-light);
}

.switch-item.main-switch {
    background: rgba(255, 255, 255, 0.03);
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

/* Resolution */
.resol-config-fields {
    padding: 5px;
}

.checkbox-options-group {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-top: 20px;
}

/* Schedule Grid */
.schedule-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.schedule-day-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    border: 1px solid var(--dept-border);
}

.day-check {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 120px;
}

.day-times {
    display: flex;
    align-items: center;
    gap: 10px;
}

.time-picker-mini {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(0, 0, 0, 0.2);
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid var(--dept-border);
}

.mini-input {
    width: 28px;
    background: transparent;
    border: none;
    color: var(--wb-text-light);
    font-size: 12px;
    text-align: center;
}

.mini-select {
    background: transparent;
    border: none;
    color: var(--wb-accent-blue);
    font-size: 11px;
    font-weight: bold;
    cursor: pointer;
    outline: none;
}

.time-sep {
    color: var(--wb-text-muted);
    font-size: 12px;
}

/* WB Dropdown Override */
.wb-dropdown-menu {
    background: #25282c;
    border: 1px solid var(--dept-border);
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.4);
    overflow: hidden;
    width: 180px;
}

.wb-dropdown-item {
    padding: 10px 15px;
    font-size: 13px;
    color: var(--wb-text-muted);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.wb-dropdown-item:hover {
    background: var(--wb-accent-blue);
    color: white;
}

.wb-dropdown-item i {
    width: 16px;
    text-align: center;
}


/* ----------------------------------------------------
   RESPONSIVE DESIGN SYSTEM DEPARTAMENTOS (v8.5 - Scaled Design)
   ---------------------------------------------------- */
@media (max-width: 768px) {
    .dept-view-container {
        padding: 12px !important;
    }

    .dept-header-bar {
        padding-bottom: 12px !important;
        margin-bottom: 15px !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 10px !important;
    }

    .dept-header-bar .header-text h2 {
        font-size: 20px !important;
    }

    .dept-header-bar .header-subtitle {
        font-size: 11.5px !important;
    }

    .dept-cards-grid {
        grid-template-columns: 1fr 1fr !important; /* Scaled Grid: 2 columns */
        gap: 12px !important;
        padding: 0 !important;
    }

    .dept-card {
        border-radius: 12px !important;
        min-height: auto !important;
    }

    .dept-card-header {
        padding: 12px !important;
        gap: 8px !important;
    }

    .dept-card-header h3 {
        font-size: 13px !important;
    }

    .dept-card-body {
        padding: 12px !important;
    }

    .dept-card-body p {
        font-size: 10.5px !important;
        line-height: 1.4 !important;
    }

    .dept-card-footer {
        padding: 10px 12px !important;
        font-size: 10.5px !important;
    }

    /* Scale iOS-style switches and toggles for mobile precision */
    .wb-switch {
        transform: scale(0.85) !important;
    }
}

