/* Modal Overlay */
.tml-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    padding: 20px;
    box-sizing: border-box;
    animation: tmlFadeIn 0.3s ease;
}

/* Modal Container */
.tml-modal {
    background: #fff;
    border-radius: 8px;
    width: 90%;
    max-width: 1200px;
    height: 85vh;
    max-height: 800px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    animation: tmlSlideIn 0.3s ease;
}

/* Modal Header */
.tml-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.tml-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
    max-width: calc(100% - 50px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tml-close {
    background: none;
    border: none;
    font-size: 28px;
    font-weight: bold;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
    line-height: 1;
}

.tml-close:hover,
.tml-close:focus {
    background: #e9ecef;
    color: #333;
    outline: none;
    transform: rotate(90deg);
}

/* Modal Content */
.tml-content {
    flex: 1;
    padding: 0;
    overflow: hidden;
    position: relative;
}

/* Loading Spinner */
.tml-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
}

.tml-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007cba;
    border-radius: 50%;
    animation: tmlSpin 1s linear infinite;
}

/* Iframe */
.tml-iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
    background: #fff;
}

/* Animações */
@keyframes tmlFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes tmlSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes tmlSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Classes auxiliares para fechar modal */
.tml-overlay.closing {
    animation: tmlFadeOut 0.3s ease forwards;
}

.tml-overlay.closing .tml-modal {
    animation: tmlSlideOut 0.3s ease forwards;
}

@keyframes tmlFadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

@keyframes tmlSlideOut {
    from {
        transform: translateY(0);
        opacity: 1;
    }
    to {
        transform: translateY(50px);
        opacity: 0;
    }
}

/* Responsividade */
@media (max-width: 768px) {
    .tml-overlay {
        padding: 10px;
    }
    
    .tml-modal {
        width: 95%;
        height: 90vh;
    }
    
    .tml-header {
        padding: 12px 15px;
    }
    
    .tml-title {
        font-size: 16px;
    }
    
    .tml-close {
        width: 28px;
        height: 28px;
        font-size: 24px;
    }
}

@media (max-width: 480px) {
    .tml-overlay {
        padding: 0;
    }
    
    .tml-modal {
        width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .tml-header {
        padding: 10px 12px;
    }
    
    .tml-title {
        font-size: 14px;
    }
}