
/* Namespace Select */
#ns-select {
    min-width: 240px;
}

#ns-select .custom-select__trigger {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    font-size: 0.875rem;
    color: var(--text-primary);
    background: var(--card-bg);
    transition: border-color var(--transition), background var(--transition);
}

#ns-select .custom-select__trigger:hover {
    border-color: var(--brand-primary);
}

#ns-select.custom-select--open .custom-select__trigger {
    border-color: var(--brand-primary);
}

#ns-select .custom-select__option--disabled {
    color: var(--text-placeholder);
    pointer-events: none;
    cursor: default;
}

/* Widget Save Button */
.widget-save-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 12px 16px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #fff;
    background: var(--brand-primary);
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}

.widget-save-btn:hover:not(:disabled) {
    background: var(--brand-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(108, 92, 231, 0.4);
}

.widget-save-btn:disabled {
    opacity: 0.45;
    cursor: default;
}

.widget-save-btn svg {
    width: 15px;
    height: 15px;
}

/* ========================================
   Widget Grid
   ======================================== */
.widget-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

/* Widget Add Card (+ button in grid) */
.widget-add-card {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    min-height: 236px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    color: var(--text-placeholder);
    transition: all var(--transition);
}

.widget-add-card:hover {
    border-color: var(--brand-primary);
    color: var(--brand-primary);
    background: rgba(108, 92, 231, 0.04);
}

[data-theme="dark"] .widget-add-card:hover {
    background: rgba(108, 92, 231, 0.08);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .widget-add-card:hover {
        background: rgba(108, 92, 231, 0.08);
    }
}

.widget-add-card__icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid currentColor;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.widget-add-card:hover .widget-add-card__icon {
    background: var(--brand-primary);
    border-color: var(--brand-primary);
    color: #fff;
}

.widget-add-card__icon svg {
    width: 22px;
    height: 22px;
}

.widget-add-card__label {
    font-size: 0.85rem;
    font-weight: 500;
}

/* Widget Empty State */
.widget-empty {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 60px 20px;
    color: var(--text-placeholder);
}

.widget-empty svg {
    width: 48px;
    height: 48px;
    opacity: 0.5;
}

.widget-empty p {
    font-size: 0.9rem;
    font-weight: 500;
}

/* Widget Card */
.widget-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: background var(--transition), border-color var(--transition), box-shadow var(--transition), opacity 0.2s ease;
    animation: fadeIn 0.3s ease;
    cursor: grab;
    min-height: 350px;
    max-height: 350px;
    display: flex;
    flex-direction: column;
}

.widget-card canvas {
    cursor: default; /* 캔버스 위에서는 기본 포인터 */
}

.widget-card:active {
    cursor: grabbing;
}

.widget-card.is-dragging {
    opacity: 0.4;
}

.widget-card.drag-over {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 2px rgba(108, 92, 231, 0.25);
}

.widget-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.widget-card.drag-over:hover {
    box-shadow: 0 0 0 2px rgba(108, 92, 231, 0.25);
}

[data-theme="dark"] .widget-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .widget-card:hover {
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    }
}

.widget-card__header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 16px;
    transition: border-color var(--transition);
}

.widget-card__drag-handle {
    color: var(--text-placeholder);
    display: flex;
    align-items: center;
    flex-shrink: 0;
    cursor: grab;
    transition: color var(--transition);
}

.widget-card__drag-handle:active {
    cursor: grabbing;
}

.widget-card:hover .widget-card__drag-handle {
    color: var(--text-secondary);
}

.widget-card__drag-handle svg {
    width: 16px;
    height: 16px;
}

.widget-card__title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
    transition: color var(--transition);
}

.widget-card__delete {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-placeholder);
    transition: all var(--transition);
}

.widget-card__delete:hover {
    background: rgba(225, 112, 85, 0.1);
    color: var(--error);
}

.widget-card__delete svg {
    width: 16px;
    height: 16px;
}

.widget-card__body {
    padding: 8px;
    flex: 1;
    overflow: hidden;
}

.widget-chart {
    width: 100%;
    height: 100%;
}

/* ========================================
   Widget Add Dropdown
   ======================================== */
.widget-add-card {
    position: relative;
}

.widget-dropdown {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    min-width: 220px;
    max-height: 200px;
    overflow-y: auto;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    z-index: 100;
    transition: background var(--transition), border-color var(--transition);
}

[data-theme="dark"] .widget-dropdown {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .widget-dropdown {
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    }
}

.widget-dropdown--visible {
    display: block;
    animation: dropdownIn 0.15s ease;
}

@keyframes dropdownIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.widget-dropdown__title {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    padding: 12px 14px 8px;
    transition: color var(--transition);
}

.widget-dropdown__item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 14px;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-primary);
    text-align: left;
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
}

.widget-dropdown__item:hover {
    background: var(--hover-bg);
    color: var(--brand-primary);
}

.widget-dropdown__item:last-child {
    margin-bottom: 4px;
}

.widget-dropdown__item svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: var(--text-placeholder);
    transition: color var(--transition);
}

.widget-dropdown__item:hover svg {
    color: var(--brand-primary);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ========================================
   Request Solution
   ======================================== */
#requestSolution-wrapper {
    display: flex;
    flex: 1;
    padding: 10px;
    gap: 5px;
    height: 100%;
}

#today-request, #total-request {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex: 1;
    background-color: var(--content-bg);
    border-radius: 8px;
    padding: 18px;
}

.request-content {
    text-align: right;
}

.request-content p {
    color: var(--text-primary);
    font-size: 20px;
    font-weight: 500;
}

.request-content span {
    color: var(--text-secondary);
    font-size: 12px;
}

#today-request {
    color: #667eea;
}

#total-request {
    color: #805ad5;
}

.request-header svg {
    width: 26px;
    height: 26px;
}

/* ========================================
   Cluster
   ======================================== */
.cluster-total {
    display: flex;
    width: 100%;
    justify-content: right;
    border-top: 1px solid var(--border);
    margin-top: 45px;
    padding: 5px 15px;
    box-sizing: border-box;
    font-size: 14px;
    color: #6C5CE7;
    font-weight: 500;
}

/* ========================================
   Data Ingestion
   ======================================== */
#data-ingestion-total {
    width: 100%;
    font-size: 14px;
    text-align: right;
    font-weight: 600;
    color: #6C5CE7;
    height: 25px;
    padding-right: 15px;
}
.table-wrapper {
    height: calc(100% - 30px);
    margin: 10px;
    overflow: hidden;
}

#data-ingestion-table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
    height: 100%;
}

#data-ingestion-table thead {
    text-align: center;
    background-color: var(--content-bg);
}

#data-ingestion-table th {
    padding: 12px 20px;
    font-weight: 600;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
    height: 30px;
    box-sizing: border-box;
}

#data-ingestion-table th:first-child {
    border-top-left-radius: 8px;
}

#data-ingestion-table th:last-child {
    border-top-right-radius: 8px;
}

#data-ingestion-table tbody {
    display: block;
    height: 190px;
    overflow-y: auto;
    width: 100%;
}

#data-ingestion-table thead,
#data-ingestion-table tbody tr {
    display: table;
    width: 100%;
    table-layout: fixed;
}

#data-ingestion-table tbody tr {
    height: 40px;
    border-bottom: 1px solid var(--border);
    transition: background-color 0.2s ease;
}

#data-ingestion-table td {
    padding: 6px 20px;
    font-size: 14px;
    height: 40px;
    box-sizing: border-box;
    vertical-align: middle;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#data-ingestion-table td:last-child {
    text-align: right;
    font-weight: 600;
    color: #6C5CE7;
}

#data-ingestion-table tbody tr:hover {
    background-color: var(--content-bg);
}

#data-ingestion-table tbody td:first-child {
    font-weight: 500;
}

/* ========================================
   TUI Chart Dark Theme Override
   ======================================== */
[data-theme="dark"] .toastui-chart-wrapper {
    background: transparent !important;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .toastui-chart-wrapper {
        background: transparent !important;
    }
}

/* ========================================
   Chart Tooltip
   ======================================== */
.tooltip-body {
    display: flex;
    align-items: center;
    padding: 10px;
    font-size: 12px;
    gap: 10px;
    color: white;
}

.tooltip-icon {
    width: 13px;
    height: 13px;
}

.tooltip-lebel {
    display: flex;
    flex-direction: column;
    max-width: 120px;
    gap: 1px;
    font-weight: normal;
}

.tooltip-label span {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ========================================
   Responsive
   ======================================== */
@media (min-width: 769px) and (max-width: 1240px) {
    .widget-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 18px;
    }
}

/* ========================================
   Responsive - Tablet (768px ~ 1024px)
   ======================================== */
@media (min-width: 768px) and (max-width: 1024px) {
    .widget-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
}

/* ========================================
   Responsive - Mobile (~ 767px)
   ======================================== */
@media (max-width: 767px) {
    .widget-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    /*.widget-add-card {*/
    /*    min-height: 160px;*/
    /*}*/
}