/**
 * Nexus Modal System Styles
 */

/* Toast Notifications (non-blocking, top of screen) */
.nexus-toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 400px;
    pointer-events: none;
}

.nexus-toast {
    pointer-events: auto;
    background-color: var(--card-bg);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    transform: translateX(calc(100% + 40px));
    transition: transform 0.3s ease, opacity 0.3s ease;
    opacity: 0;
    border-left: 4px solid;
}

.nexus-toast.show {
    transform: translateX(0);
    opacity: 1;
}

.nexus-toast-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    font-size: 0.95rem;
    border-bottom: 1px solid var(--border-color);
}

.nexus-toast-body {
    padding: 12px 16px;
    font-size: 0.9rem;
    line-height: 1.5;
}

.nexus-toast-progress {
    height: 4px;
    background-color: rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

[data-theme="dark"] .nexus-toast-progress {
    background-color: rgba(255, 255, 255, 0.1);
}

.nexus-toast-progress-bar {
    height: 100%;
    width: 0;
    background-color: currentColor;
    transition: width linear;
    opacity: 0.7;
}

/* Toast color variations */
.nexus-toast-success {
    border-left-color: #198754;
    color: var(--text-primary);
}

.nexus-toast-success .nexus-toast-header {
    background-color: rgba(25, 135, 84, 0.1);
    color: #198754;
}

[data-theme="dark"] .nexus-toast-success .nexus-toast-header {
    background-color: rgba(126, 231, 135, 0.1);
    color: #7ee787;
}

.nexus-toast-warning {
    border-left-color: #ffc107;
    color: var(--text-primary);
}

.nexus-toast-warning .nexus-toast-header {
    background-color: rgba(255, 193, 7, 0.1);
    color: #856404;
}

[data-theme="dark"] .nexus-toast-warning .nexus-toast-header {
    background-color: rgba(227, 179, 65, 0.1);
    color: #e3b341;
}

.nexus-toast-danger {
    border-left-color: #dc3545;
    color: var(--text-primary);
}

.nexus-toast-danger .nexus-toast-header {
    background-color: rgba(220, 53, 69, 0.1);
    color: #dc3545;
}

[data-theme="dark"] .nexus-toast-danger .nexus-toast-header {
    background-color: rgba(255, 161, 152, 0.1);
    color: #ffa198;
}

.nexus-toast-info {
    border-left-color: #0dcaf0;
    color: var(--text-primary);
}

.nexus-toast-info .nexus-toast-header {
    background-color: rgba(13, 202, 240, 0.1);
    color: #055160;
}

[data-theme="dark"] .nexus-toast-info .nexus-toast-header {
    background-color: rgba(121, 192, 255, 0.1);
    color: #79c0ff;
}

.nexus-toast .btn-close {
    margin-left: auto;
    padding: 0.25rem;
}

/* Mobile responsive */
@media (max-width: 576px) {
    .nexus-toast-container {
        right: 10px;
        left: 10px;
        max-width: none;
    }
}

/* Modals are appended directly to body, no container needed */

/* Enhanced modal animations */
.modal.fade .modal-dialog {
    transition: transform 0.2s ease-out, opacity 0.2s ease-out;
    transform: scale(0.9) translateY(-20px);
    opacity: 0;
}

.modal.show .modal-dialog {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* Modal content improvements */
.modal-content {
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

/* Modal header */
.modal-header {
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
}

.modal-title {
    font-weight: 600;
    font-size: 1.125rem;
}

/* Modal body */
.modal-body {
    padding: 1.25rem;
    font-size: 0.95rem;
    line-height: 1.6;
}

/* Modal footer */
.modal-footer {
    border-top: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
}

/* Progress bar for auto-dismissing modals */
.modal .progress {
    border-radius: 2px;
    background-color: var(--bg-tertiary);
}

.modal .progress-bar {
    background-color: var(--text-secondary);
}

/* Input validation styles */
.modal .form-control.is-invalid {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

/* Icon sizing in modals */
.modal-body .bi {
    flex-shrink: 0;
}

/* Button spacing in modal footer */
.modal-footer .btn {
    min-width: 80px;
}

/* Make sure long messages are readable */
.modal-body > div {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Choice buttons styling */
.modal-body .btn.w-100 {
    text-align: left;
    padding: 0.75rem 1rem;
}

/* Notification modal specific styles */
.modal-sm .modal-dialog {
    max-width: 400px;
}

/* Dark mode specific enhancements */
[data-theme="dark"] .modal-content {
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .modal-backdrop.show {
    opacity: 0.7;
}

/* Animation for progress bar */
@keyframes progressBarAnimation {
    from {
        width: 100%;
    }
    to {
        width: 0%;
    }
}

/* Responsive adjustments */
@media (max-width: 576px) {
    .modal-dialog {
        margin: 0.5rem;
    }
    
    .modal-body {
        padding: 1rem;
    }
    
    .modal-footer {
        flex-direction: column;
    }
    
    .modal-footer .btn {
        width: 100%;
        margin: 0.25rem 0;
    }
}

/* Bootstrap handles z-index automatically when modals are direct children of body */

/* Input focus states in modals */
.modal .form-control:focus {
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

[data-theme="dark"] .modal .form-control:focus {
    box-shadow: 0 0 0 0.2rem rgba(56, 139, 253, 0.25);
}

/* Make buttons more prominent */
.modal-footer .btn-primary,
.modal-footer .btn-danger {
    font-weight: 600;
}

/* Hover effects for choice buttons */
.modal-body .btn.w-100:hover {
    transform: translateX(4px);
    transition: transform 0.2s ease;
}

/* Icon colors are already set by Bootstrap, just ensure they show properly */
.modal-body .text-success { color: #198754 !important; }
.modal-body .text-warning { color: #ffc107 !important; }
.modal-body .text-danger { color: #dc3545 !important; }
.modal-body .text-info { color: #0dcaf0 !important; }

[data-theme="dark"] .modal-body .text-success { color: #7ee787 !important; }
[data-theme="dark"] .modal-body .text-warning { color: #e3b341 !important; }
[data-theme="dark"] .modal-body .text-danger { color: #ffa198 !important; }
[data-theme="dark"] .modal-body .text-info { color: #79c0ff !important; }
