/* Custom styling for iteration toggle switches */

/* Reduce switch size by 50% from increased size */
.form-switch .form-check-input {
    width: 1.95em !important;  /* 3.9em / 2 */
    height: 1.04em !important;  /* 2.08em / 2 */
}

/* More emphatic OFF state - lighter gray background with white toggle button */
.form-switch .form-check-input:not(:checked) {
    background-color: #9e9e9e !important;  /* Light gray background when off */
    border-color: #757575 !important;  /* Medium gray border */
    opacity: 1 !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23ffffff'/%3e%3c/svg%3e") !important;
}

/* ON state - brand primary color */
.form-switch .form-check-input:checked {
    background-color: #0047AB !important;  /* Brand primary color when on */
    border-color: #003580 !important;  /* Darker shade for border */
}

/* Hover effects for better interactivity */
.form-switch .form-check-input:not(:checked):hover {
    background-color: #bdbdbd !important;  /* Even lighter gray on hover */
    border-color: #757575 !important;
}

.form-switch .form-check-input:checked:hover {
    background-color: #0056d6 !important;  /* Lighter primary on hover */
    border-color: #003580 !important;
}

/* Focus state for accessibility */
.form-switch .form-check-input:focus {
    box-shadow: 0 0 0 0.25rem rgba(158, 158, 158, 0.25) !important;
}

.form-switch .form-check-input:checked:focus {
    box-shadow: 0 0 0 0.25rem rgba(0, 71, 171, 0.25) !important;
}

/* AI Loader Animation - Replace default Dash spinner */
.ai-loading-parent .dash-spinner {
    display: none !important;
}

.ai-loading-parent._dash-loading {
    position: relative !important;
    min-height: 200px !important;
}

.ai-loading-parent._dash-loading::before {
    content: '';
    display: block !important;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120px;
    height: 120px;
    background-image: url('https://kinetiq-group.s3.us-west-2.amazonaws.com/public/logos/AI.svg');
    background-size: 30px 30px;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 1000;
    pointer-events: none;
}

.ai-loading-parent._dash-loading::after {
    content: '';
    display: block !important;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120px;
    height: 120px;
    background-image: 
        radial-gradient(circle at 60px calc(60px - 27px), #47AEDB 10px, transparent 10px),
        radial-gradient(circle at calc(60px + 24px) calc(60px - 14px), #47AEDB 8px, transparent 8px),
        radial-gradient(circle at calc(60px + 24px) calc(60px + 14px), #47AEDB 12px, transparent 12px),
        radial-gradient(circle at 60px calc(60px + 27px), #47AEDB 9px, transparent 9px),
        radial-gradient(circle at calc(60px - 24px) calc(60px + 14px), #47AEDB 11px, transparent 11px),
        radial-gradient(circle at calc(60px - 24px) calc(60px - 14px), #47AEDB 7px, transparent 7px),
        radial-gradient(circle at calc(60px + 19px) calc(60px - 19px), #47AEDB 10px, transparent 10px),
        radial-gradient(circle at calc(60px + 27px) 60px, #47AEDB 8px, transparent 8px),
        radial-gradient(circle at calc(60px + 19px) calc(60px + 19px), #47AEDB 12px, transparent 12px),
        radial-gradient(circle at calc(60px - 19px) calc(60px + 19px), #47AEDB 9px, transparent 9px),
        radial-gradient(circle at calc(60px - 27px) 60px, #47AEDB 11px, transparent 11px),
        radial-gradient(circle at calc(60px - 19px) calc(60px - 19px), #47AEDB 7px, transparent 7px);
    animation: star-burst-all 2s ease-out infinite;
    z-index: 999;
    pointer-events: none;
}

@keyframes star-burst-all {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0);
    }
    20% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* Floating Voting Overlay Styles */
.voting-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
    z-index: 100010;  /* Higher than viewer container (100000) */
}

.voting-container {
    background-color: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    max-width: 600px;
    width: 90%;
    position: relative;
}

.vote-close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    border: none;
    background: transparent;
    font-size: 28px;
    line-height: 1;
    color: #999;
    cursor: pointer;
    padding: 0;
    transition: color 0.2s;
}

.vote-close-btn:hover {
    color: #333;
}

.vote-groups-container {
    display: flex;
    gap: 20px;
    justify-content: center;
    align-items: center;
}

.vote-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.vote-label {
    font-size: 13px;
    font-weight: 600;
    color: #495057;
    white-space: nowrap;
}

.vote-btn {
    width: 40px !important;
    height: 40px !important;
    border: 2px solid #dee2e6 !important;
    background-color: white !important;
    border-radius: 4px !important;
    font-size: 20px !important;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
    min-width: 40px !important;
}

.vote-btn:hover {
    border-color: #007bff !important;
    background-color: #f8f9fa !important;
    transform: scale(1.05);
}

.vote-btn.selected-up {
    background-color: #28a745 !important;
    border-color: #28a745 !important;
    color: white !important;
    transform: scale(1.1);
}

.submit-btn {
    padding: 8px 30px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
}

/* Ensure nav link icons align properly */
.workflow-nav-item .nav-link i {
    vertical-align: middle;
}

/* ==================== MODAL VIEWER SHARED STYLES ==================== */
/* Shared styles for Modal Custom and Template Viewer modals */

.modal-viewer-backdrop {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background-color: rgba(0, 0, 0, 0.7) !important;
    z-index: 999999 !important;
    display: none;
}

.modal-viewer-container {
    position: fixed !important;
    top: 5vh !important;
    left: 5vw !important;
    width: 90vw !important;
    height: 90vh !important;
    background-color: white !important;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 1000000 !important;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.modal-viewer-header {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #dee2e6;
    background-color: #f8f9fa;
}

.modal-viewer-body {
    padding: 20px;
    height: calc(100% - 71px);
    overflow: auto;
}

.modal-viewer-close-btn {
    font-size: 32px;
    border: none;
    background: none;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 40px;
    height: 40px;
    line-height: 32px;
}

/* Spinning animation for refresh buttons */
@keyframes spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* Publish modal — must sit above the modal-viewer-container (z-index: 1000000) */
#publish-modal {
    z-index: 1100000 !important;
}
#publish-modal .modal-dialog {
    z-index: 1100001 !important;
}
/* Strong visual contrast for the publish modal dialog */
#publish-modal .modal-content {
    border: 2px solid #0047AB !important;
    border-radius: 10px !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.75), 0 0 0 9999px rgba(0, 0, 0, 0.65) !important;
}
#publish-modal .modal-header {
    background-color: #0047AB !important;
    color: white !important;
    border-radius: 8px 8px 0 0 !important;
    border-bottom: none !important;
}
#publish-modal .modal-header .modal-title {
    color: white !important;
    font-weight: 600 !important;
}
#publish-modal .modal-header .btn-close {
    filter: invert(1) !important;
}
#publish-modal .modal-body {
    background-color: #ffffff !important;
    padding: 24px !important;
}
#publish-modal .modal-footer {
    background-color: #f8f9fa !important;
    border-top: 1px solid #dee2e6 !important;
    border-radius: 0 0 8px 8px !important;
}
/* Bootstrap injects .modal-backdrop into <body>; target the last one */
body > .modal-backdrop:last-of-type {
    z-index: 1099999 !important;
    opacity: 0.75 !important;
}
