@import url('/static/css/tokens.css');

/* ==========================================================================
   WA BROADCAST STYLESHEET (UNIVERSAL EDITORIAL SYSTEM)
   ========================================================================== */

.bc-container {
    padding: 30px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    box-sizing: border-box;
    min-height: 100vh;
    background: var(--bg-body);
}

.bc-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: 24px;
    box-shadow: var(--shadow-card);
    transition: border-color var(--transition-base), box-shadow var(--transition-base);
    position: relative;
    overflow: hidden;
}

.bc-card:hover {
    border-color: var(--border-focus);
}

.bc-header {
    margin-bottom: 16px;
}

.bc-header h1 {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 4px;
    color: var(--accent);
    letter-spacing: -0.5px;
    font-family: var(--font-main);
}

.bc-header p {
    color: var(--text-muted);
    font-size: 13px;
    margin: 0;
}

.bc-composer-section {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 20px;
    width: 100%;
}

@media (max-width: 1200px) {
    .bc-composer-section {
        grid-template-columns: 1fr;
    }
}

.bc-textarea {
    width: 100%;
    min-height: 180px;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    padding: 14px 16px;
    font-family: var(--font-main);
    font-size: 14px;
    resize: vertical;
    line-height: 1.6;
    transition: border-color var(--transition-fast);
    box-sizing: border-box;
}

.bc-textarea:focus {
    outline: none;
    border-color: var(--input-focus-border);
}

.bc-vars {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    width: 100%;
}

.bc-var-btn {
    background: var(--accent-subtle);
    color: var(--accent);
    border: 1px solid var(--accent-subtle);
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 12px;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.bc-var-btn:hover {
    background: var(--accent);
    color: var(--text-inverse);
    border-color: var(--accent);
    transform: translateY(-1px);
}

@media (max-width: 768px) {
    .bc-container {
        padding: 15px;
        gap: 15px;
    }
    .bc-card {
        padding: 18px;
    }
    .bc-var-btn {
        padding: 5px 10px;
        font-size: 11px;
    }
    .bc-composer-section {
        gap: 15px;
    }
}

.bc-filter-item {
    margin-bottom: 16px;
    position: relative;
}

.bc-filter-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.bc-select {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    color: var(--text-primary);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font-main);
    transition: border-color var(--transition-fast);
    cursor: pointer;
    box-sizing: border-box;
}

.bc-select:focus {
    outline: none;
    border-color: var(--input-focus-border);
}

.bc-select option {
    background: var(--bg-card);
    color: var(--text-primary);
}

.bc-input {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    color: var(--text-primary);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: var(--font-main);
    transition: border-color var(--transition-fast);
    box-sizing: border-box;
}

.bc-input:focus {
    outline: none;
    border-color: var(--input-focus-border);
}

.bc-odp-grid {
    max-height: 160px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 12px;
    background: var(--bg-card-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

@media (max-width: 480px) {
    .bc-odp-grid {
        grid-template-columns: 1fr;
        gap: 6px;
        padding: 8px;
    }
}

.bc-odp-grid::-webkit-scrollbar {
    width: 4px;
}
.bc-odp-grid::-webkit-scrollbar-thumb {
    background: var(--accent-subtle);
    border-radius: 2px;
}

.bc-odp-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    transition: color 0.15s;
}
.bc-odp-checkbox:hover {
    color: var(--accent);
}
.bc-odp-checkbox input[type="radio"], .bc-odp-checkbox input[type="checkbox"] {
    accent-color: var(--accent);
    cursor: pointer;
}

/* Target Summary Dashboard Widgets */
.bc-summary-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 12px;
    margin-bottom: 16px;
}
.bc-summary-widget {
    background: var(--bg-card-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: border-color var(--transition-fast);
}
.bc-summary-widget:hover {
    border-color: var(--border-focus);
}
.bc-summary-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
}
.bc-summary-icon.target {
    background: var(--accent-subtle);
    color: var(--accent);
    border: 1px solid var(--accent-subtle);
}
.bc-summary-icon.security {
    background: var(--success-subtle);
    color: var(--success-text);
    border: 1px solid var(--success-subtle);
}
.bc-summary-info {
    display: flex;
    flex-direction: column;
}
.bc-summary-title {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.bc-summary-value {
    font-size: 14px;
    font-weight: 800;
    color: var(--text-primary);
    margin-top: 2px;
}

.bc-progress-area {
    margin-top: 16px;
    padding: 18px 20px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

.bc-progress-bar {
    height: 8px;
    background: var(--bg-card-subtle);
    border-radius: 999px;
    overflow: hidden;
    margin: 10px 0;
    border: 1px solid var(--border);
}

.bc-progress-fill {
    height: 100%;
    background: var(--accent);
    width: 0%;
    transition: width 0.4s ease;
    border-radius: 999px;
}

.bc-table-container {
    margin-top: 16px;
    overflow-x: auto;
}

.bc-table-container table,
.fin-table,
#queueListTable {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
}

.bc-table-container table th,
.fin-table th,
#queueListTable th,
.bc-card table th {
    background: var(--bg-card-subtle, rgba(255, 255, 255, 0.04)) !important;
    color: var(--text-primary) !important;
    font-weight: 700 !important;
    font-size: 11.5px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    padding: 10px 12px !important;
    border-bottom: 1.5px solid var(--border) !important;
    white-space: nowrap !important;
}

.bc-table-container table td,
.fin-table td,
#queueListTable td,
.bc-card table td {
    padding: 10px 12px !important;
    color: var(--text-primary) !important;
    border-bottom: 1px solid var(--border-subtle, var(--border)) !important;
    font-size: 12px !important;
}

.bc-table-container table tbody tr:hover,
.fin-table tbody tr:hover,
#queueListTable tbody tr:hover {
    background: var(--bg-card-hover, rgba(255, 255, 255, 0.03)) !important;
}

/* Clean Terminal Log Box */
.bc-log-box {
    margin-top: 12px;
    background: var(--bg-card-subtle);
    border-radius: var(--radius-md);
    padding: 16px;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-primary);
    height: 160px;
    overflow-y: auto;
    border: 1px solid var(--border);
    box-sizing: border-box;
    line-height: 1.5;
}
.bc-log-box::-webkit-scrollbar {
    width: 6px;
}
.bc-log-box::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.bc-action-btns {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    position: relative;
}

.btn-bc-send {
    background: var(--accent);
    color: var(--text-inverse);
    border: none;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-weight: 800;
    font-size: 13px;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all var(--transition-fast);
    flex: 1;
}

.btn-bc-send:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.btn-bc-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.btn-bc-stop {
    background: var(--danger);
    color: var(--text-inverse);
    border: none;
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    transition: all var(--transition-fast);
}
.btn-bc-stop:hover {
    background: var(--danger-text);
    transform: translateY(-1px);
}

/* Status Badges */
.bc-status-badge {
    padding: 4px 10px;
    border-radius: 50px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.status-wait {
    background: var(--accent-subtle);
    color: var(--accent);
    border: 1px solid var(--accent-subtle);
}
.status-proc {
    background: var(--warning-subtle);
    color: var(--warning-text);
    border: 1px solid var(--warning-subtle);
}
.status-sent {
    background: var(--success-subtle);
    color: var(--success-text);
    border: 1px solid var(--success-subtle);
}
.status-fail {
    background: var(--danger-subtle);
    color: var(--danger-text);
    border: 1px solid var(--danger-subtle);
}
.status-skip {
    background: var(--bg-card-subtle) !important;
    color: var(--text-muted) !important;
    border: 1px solid var(--border) !important;
}

/* Image Preview Dropzone */
.bc-image-preview {
    width: 100px;
    height: 100px;
    border-radius: var(--radius-md);
    border: 2px dashed var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card-subtle);
    position: relative;
    transition: all var(--transition-fast);
    cursor: pointer;
    overflow: hidden;
    box-sizing: border-box;
}
.bc-image-preview:hover {
    border-color: var(--accent);
    background: var(--accent-subtle);
}
.bc-image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-sm);
}
.bc-image-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    background: var(--danger);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 10px;
    transition: all 0.2s;
    z-index: 10;
}
.bc-image-remove:hover {
    background: var(--danger-text);
    transform: scale(1.1);
}

/* Toast Notifications */
.nms-toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}
.nms-toast {
    pointer-events: auto;
    min-width: 300px;
    max-width: 400px;
    padding: 12px 18px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-card);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    animation: toastSlideIn 0.3s ease;
}
.nms-toast.toast-out {
    animation: toastSlideOut 0.3s ease forwards;
}
.nms-toast-icon {
    width: 30px; height: 30px; border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; flex-shrink: 0;
}
.nms-toast-body { flex: 1; line-height: 1.4; }
.nms-toast-title { font-weight: 700; font-size: 13px; margin-bottom: 2px; }
.nms-toast-msg { font-weight: 400; font-size: 12px; color: var(--text-secondary); }
.nms-toast-close {
    background: none; border: none; color: var(--text-muted); cursor: pointer;
    font-size: 14px; padding: 4px;
}
.nms-toast-close:hover { color: var(--text-primary); }
.nms-toast-progress {
    position: absolute; bottom: 0; left: 0; height: 3px; border-radius: 0 0 10px 10px;
    animation: toastProgress linear forwards;
}
.nms-toast.toast-success { border-color: var(--success-subtle); }
.nms-toast.toast-success .nms-toast-icon { background: var(--success-subtle); color: var(--success-text); }
.nms-toast.toast-success .nms-toast-progress { background: var(--success); }
.nms-toast.toast-error { border-color: var(--danger-subtle); }
.nms-toast.toast-error .nms-toast-icon { background: var(--danger-subtle); color: var(--danger-text); }
.nms-toast.toast-error .nms-toast-progress { background: var(--danger); }
.nms-toast.toast-warning { border-color: var(--warning-subtle); }
.nms-toast.toast-warning .nms-toast-icon { background: var(--warning-subtle); color: var(--warning-text); }
.nms-toast.toast-warning .nms-toast-progress { background: var(--warning); }
.nms-toast.toast-info { border-color: var(--accent-subtle); }
.nms-toast.toast-info .nms-toast-icon { background: var(--accent-subtle); color: var(--accent); }
.nms-toast.toast-info .nms-toast-progress { background: var(--accent); }

@keyframes toastSlideIn {
    from { transform: translateX(120%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
@keyframes toastSlideOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(120%); opacity: 0; }
}
@keyframes toastProgress {
    from { width: 100%; }
    to { width: 0%; }
}

/* Modal Box */
.nms-confirm-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: var(--overlay-bg);
    backdrop-filter: blur(4px);
    z-index: 99998; display: flex; align-items: center; justify-content: center;
}
.nms-confirm-box {
    background: var(--modal-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px; max-width: 400px; width: 90%;
    box-shadow: var(--shadow-lg);
    text-align: center;
}
.nms-confirm-icon {
    width: 50px; height: 50px; border-radius: 50%; margin: 0 auto 14px;
    display: flex; align-items: center; justify-content: center; font-size: 22px;
}
.nms-confirm-icon.warn { background: var(--warning-subtle); color: var(--warning-text); border: 2px solid var(--warning-subtle); }
.nms-confirm-icon.danger { background: var(--danger-subtle); color: var(--danger-text); border: 2px solid var(--danger-subtle); }
.nms-confirm-title { font-size: 16px; font-weight: 700; color: var(--text-primary); margin-bottom: 6px; }
.nms-confirm-text { font-size: 12px; color: var(--text-secondary); line-height: 1.5; margin-bottom: 20px; }
.nms-confirm-btns { display: flex; gap: 8px; justify-content: center; }
.nms-confirm-btn {
    padding: 8px 20px; border-radius: var(--radius-sm); font-weight: 700; font-size: 12px;
    cursor: pointer; border: none; transition: all 0.2s;
}
.nms-confirm-btn.cancel {
    background: var(--bg-card-subtle); color: var(--text-secondary); border: 1px solid var(--border);
}
.nms-confirm-btn.cancel:hover { background: var(--bg-hover); color: var(--text-primary); }
.nms-confirm-btn.confirm {
    background: var(--accent); color: var(--text-inverse);
}
.nms-confirm-btn.confirm:hover { background: var(--accent-hover); }
.nms-confirm-btn.danger {
    background: var(--danger); color: var(--text-inverse);
}
.nms-confirm-btn.danger:hover { background: var(--danger-text); }

.bc-custom-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
@media (max-width: 480px) {
    .bc-custom-inputs {
        grid-template-columns: 1fr;
        gap: 6px;
    }
}

/* ==========================================================================
   LIGHT MODE & LIGHT MONOCHROME OVERRIDES
   ========================================================================== */
[data-theme="light"] .bc-card {
    background: #ffffff !important;
    border-color: #e2e8f0 !important;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05) !important;
}

[data-theme="light"] .bc-header p {
    color: #64748b !important;
}

[data-theme="light"] .bc-filter-label,
[data-theme="light"] .bc-summary-title {
    color: #64748b !important;
}

[data-theme="light"] .bc-summary-widget {
    background: #f8fafc !important;
    border-color: #e2e8f0 !important;
}

[data-theme="light"] .bc-summary-value {
    color: #0f172a !important;
}

[data-theme="light"] .bc-log-box {
    background: #f8fafc !important;
    border-color: #e2e8f0 !important;
    color: #0f172a !important;
}

[data-theme="light"] .bc-textarea,
[data-theme="light"] .bc-select,
[data-theme="light"] .bc-input {
    background: #ffffff !important;
    border-color: #cbd5e1 !important;
    color: #0f172a !important;
}

[data-theme="light"] .fin-table th,
[data-theme="light"] table th {
    background: #f8fafc !important;
    color: #334155 !important;
    border-bottom: 1px solid #e2e8f0 !important;
}

[data-theme="light"] .fin-table td,
[data-theme="light"] table td {
    color: #0f172a !important;
    border-bottom: 1px solid #e2e8f0 !important;
}

[data-theme="light"] .nms-toast {
    background: #ffffff !important;
    color: #0f172a !important;
    border-color: #e2e8f0 !important;
}

[data-theme="light"] .nms-confirm-box {
    background: #ffffff !important;
    border-color: #e2e8f0 !important;
}