﻿/* FabiTrack Modern Modal Styles */
/* Modal Overlay */
.ft-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 50px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.ft-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}
/* Modal Container - Mac style slide down */
.ft-modal {
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(0, 0, 0, 0.1);
    max-width: 90vw;
    max-height: calc(100vh - 100px);
    width: 900px;
    display: flex;
    flex-direction: column;
    transform: translateY(-100%) scale(0.95);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
    overflow: hidden;
}
.ft-modal-overlay.active .ft-modal {
    transform: translateY(0) scale(1);
    opacity: 1;
}
/* Modal Header */
.ft-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: #1a365d;
    color: #ffffff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.ft-modal-title {
    font-size: 1.35rem;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.ft-modal-title i {
    font-size: 1.1rem;
}
.ft-modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #ffffff;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
    font-size: 1.25rem;
}
.ft-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
}
/* Modal Body */
.ft-modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
    max-height: calc(90vh - 140px);
}
/* Modal Footer */
.ft-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
}
/* Modal Buttons */
.ft-modal-btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.ft-modal-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.ft-modal-btn-primary {
    background: #1a365d;
    color: #ffffff;
}
.ft-modal-btn-primary:hover:not(:disabled) {
    background: #2c5282;
    box-shadow: 0 4px 12px rgba(26, 54, 93, 0.4);
}
.ft-modal-btn-secondary {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}
.ft-modal-btn-secondary:hover:not(:disabled) {
    background: #e2e8f0;
}
.ft-modal-btn-danger {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    color: #ffffff;
}
.ft-modal-btn-danger:hover:not(:disabled) {
    background: linear-gradient(135deg, #b91c1c 0%, #991b1b 100%);
}
/* Loading State */
.ft-modal-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 24px;
    min-height: 300px;
}
.ft-modal-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #e2e8f0;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: ft-spin 1s linear infinite;
}
@keyframes ft-spin {
    to {
        transform: rotate(360deg);
    }
}
.ft-modal-loading-text {
    margin-top: 16px;
    color: #64748b;
    font-size: 0.95rem;
}
/* Overlay blocking for saving */
.ft-modal-saving-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
    border-radius: 10px;
}
.ft-modal-saving-overlay .ft-modal-spinner {
    width: 40px;
    height: 40px;
}
.ft-modal-saving-text {
    margin-top: 12px;
    color: #1e40af;
    font-weight: 500;
}
/* Bootbox Override - z-index for nested modal, no backdrop */
.bootbox.modal {
    z-index: 10050 !important;
    background: transparent !important;
}
/* Hide bootbox backdrop */
.bootbox ~ .modal-backdrop,
.bootbox + .modal-backdrop {
    display: none !important;
}
.bootbox .modal-dialog {
    margin-top: 50px;
    animation: ftModalSlideDown 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes ftModalSlideDown {
    from {
        opacity: 0;
        transform: translateY(-100px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}
/* Bootbox Loading Overlay */
.bootbox-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    border-radius: 6px;
}
.bootbox-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e2e8f0;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: ft-spin 1s linear infinite;
}
.bootbox-loading-text {
    margin-top: 12px;
    color: #1e40af;
    font-weight: 600;
    font-size: 0.95rem;
}
/* Hide blockUI when FTModal is open */
.ft-modal-overlay.active ~ .blockUI,
.ft-modal-overlay.active ~ .blockOverlay {
    display: none !important;
}