﻿/* Shared Modal Styles for SfwBot Dashboard */
/* Following STYLE_GUIDE.md - Dark theme with gradient backgrounds */

/* ============================================
   MODAL BACKDROP
   ============================================ */

.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1050;
    animation: fadeIn 0.3s ease-in-out;
}

.modal-backdrop.fade.show {
    opacity: 1;
}

/* ============================================
   MODAL CONTAINER
   ============================================ */

.modal {
    position: fixed;
    z-index: 1060;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
}

.modal.fade.show {
    display: block;
}

.modal.d-block {
    display: block;
}

/* ============================================
   MODAL DIALOG
   ============================================ */

.modal-dialog {
    position: relative;
    width: auto;
    margin: 1.75rem auto;
    pointer-events: none;
}

.modal-dialog-centered {
    display: flex;
    align-items: center;
    min-height: calc(100% - 3.5rem);
}

.modal-dialog-scrollable {
    max-height: calc(100% - 3.5rem);
}

.modal-dialog-scrollable .modal-content {
    max-height: calc(100vh - 3.5rem);
    overflow: hidden;
}

.modal-dialog-scrollable .modal-body {
    overflow-y: auto;
}

/* Modal Sizes */
.modal-sm {
    max-width: 300px;
}

.modal-lg {
    max-width: 800px;
}

.modal-xl {
    max-width: 1140px;
}

/* ============================================
   MODAL CONTENT
   ============================================ */

.modal-content {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    pointer-events: auto;
    background: linear-gradient(180deg, #0f1729 0%, #1a1f3a 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    color: #ffffff;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(99, 102, 241, 0.2);
    animation: slideUp 0.4s ease-out;
}

/* Alternative lighter modal content for specific use cases */
.modal-content.modal-content-light {
    background: linear-gradient(180deg, #0f1729 0%, #1a1f3a 100%);
}

/* ============================================
   MODAL HEADER
   ============================================ */

.modal-header {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-title {
    margin: 0;
    color: #ffffff;
    font-weight: 700;
    font-size: 1.5rem;
    line-height: 1.2;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-title i {
    color: #ffffff;
}

/* Close Button */
.modal-header .btn-close {
    padding: 0.5rem;
    margin: -0.5rem -0.5rem -0.5rem auto;
    background: transparent;
    border: none;
    opacity: 0.7;
    filter: invert(1);
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.modal-header .btn-close:hover {
    opacity: 1;
}

/* ============================================
   MODAL BODY
   ============================================ */

.modal-body {
    position: relative;
    flex: 1 1 auto;
    padding: 1.5rem;
    color: rgba(255, 255, 255, 0.9);
}

.modal-body.modal-body-scrollable {
    max-height: 70vh;
    overflow-y: auto;
}

/* Custom scrollbar for modal body */
.modal-body::-webkit-scrollbar {
    width: 8px;
}

.modal-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.5);
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(99, 102, 241, 0.7);
}

/* ============================================
   MODAL FOOTER
   ============================================ */

.modal-footer {
    display: flex;
    flex-wrap: wrap;
    flex-shrink: 0;
    align-items: center;
    justify-content: flex-end;
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    gap: 0.5rem;
}

.modal-footer > * {
    margin: 0;
}

/* Modal Footer Buttons */
.modal-footer .btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.9);
    padding: 0.625rem 1.25rem;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.modal-footer .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    color: #ffffff;
}

.modal-footer .btn-primary {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border: none;
    color: #ffffff;
    padding: 0.625rem 1.25rem;
    border-radius: 8px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    transition: all 0.3s ease;
}

.modal-footer .btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
}

.modal-footer .btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

/* ============================================
   MODAL TABS (for multi-tab modals)
   ============================================ */

.modal-body .nav-tabs {
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 1.5rem;
}

.modal-body .nav-tabs .nav-item {
    margin-bottom: -2px;
}

.modal-body .nav-tabs .nav-link {
    color: rgba(255, 255, 255, 0.7);
    border: none;
    border-bottom: 2px solid transparent;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-body .nav-tabs .nav-link:hover {
    color: rgba(255, 255, 255, 0.9);
    border-bottom-color: rgba(99, 102, 241, 0.5);
}

.modal-body .nav-tabs .nav-link.active {
    color: #ffffff;
    border-bottom-color: #6366f1;
    background: transparent;
}

/* ============================================
   MODAL TEXT OVERRIDES
   ============================================ */

.modal-body .text-muted {
    color: rgba(255, 255, 255, 0.6) !important;
}

.modal-body .spinner-border {
    color: #6366f1;
}

/* ============================================
   MODAL FORM CONTROLS
   ============================================ */

.modal-body .form-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 0.5rem;
}

.modal-body .form-control,
.modal-body .form-select {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 0.75rem;
    font-size: 0.9375rem;
    color: #ffffff;
    transition: all 0.3s ease;
}

.modal-body .form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='rgba(255,255,255,0.6)' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
    padding-right: 2.5rem;
    appearance: none;
}

.modal-body .form-control:focus,
.modal-body .form-select:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(99, 102, 241, 0.4);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.modal-body .form-select:focus {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='rgba(255,255,255,0.9)' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
}

.modal-body .form-control::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.modal-body .form-select option {
    background: #1a1f3a;
    color: #ffffff;
}

.modal-body .form-text {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.875rem;
}

.modal-body .input-group-text {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
}

.modal-body .input-group .form-control {
    border-left: none;
}

.modal-body .input-group .form-control:focus {
    border-left: 1px solid rgba(99, 102, 241, 0.4);
}

.modal-body .form-check-input {
    background-color: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.modal-body .form-check-input:checked {
    background-color: #6366f1;
    border-color: #6366f1;
}

.modal-body .form-check-label {
    color: rgba(255, 255, 255, 0.9);
}

/* ============================================
   MODAL ALERTS
   ============================================ */

.modal-body .alert {
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-body .alert-info {
    background: rgba(13, 202, 240, 0.1);
    border: 1px solid rgba(13, 202, 240, 0.3);
    color: #ffffff;
}

.modal-body .alert-danger {
    background: rgba(220, 53, 69, 0.1);
    border: 1px solid rgba(220, 53, 69, 0.3);
    color: #ffffff;
}

.modal-body .alert-success {
    background: rgba(40, 167, 69, 0.1);
    border: 1px solid rgba(40, 167, 69, 0.3);
    color: #ffffff;
}

.modal-body .alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #ffffff;
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

/* Tablet and below */
@media (max-width: 991px) {
    .modal-dialog {
        margin: 1rem auto;
    }

    .modal-dialog-centered {
        min-height: calc(100% - 2rem);
    }

    .modal-xl {
        max-width: 95%;
    }
}

/* Mobile */
@media (max-width: 767px) {
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }

    .modal-dialog-centered {
        min-height: calc(100% - 1rem);
    }

    .modal-content {
        border-radius: 12px;
    }

    .modal-header {
        padding: 1rem 1.25rem;
    }

    .modal-title {
        font-size: 1.25rem;
    }

    .modal-body {
        padding: 1rem 1.25rem;
    }

    .modal-body.modal-body-scrollable {
        max-height: 60vh;
    }

    .modal-footer {
        padding: 0.75rem 1.25rem;
        flex-direction: column;
    }

    .modal-footer > * {
        width: 100%;
    }

    .modal-body .nav-tabs .nav-link {
        padding: 0.625rem 1rem;
        font-size: 0.875rem;
    }

    .modal-xl,
    .modal-lg {
        max-width: 100%;
    }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .modal-backdrop,
    .modal-content {
        animation: none;
    }

    .modal-body .nav-tabs .nav-link {
        transition: none;
    }
}

/* Focus states */
.modal-header .btn-close:focus,
.modal-body .nav-tabs .nav-link:focus {
    outline: 2px solid rgba(99, 102, 241, 0.5);
    outline-offset: 2px;
}

