/* ==========================================
   SISTEMA LOCADORA - MODAL CSS (VERSÃO 2.0)
   Mobile First | Performance Otimizada
========================================== */

/* ----- GLOBAL MODAL STATE ----- */
body.locadora-modal-open {
    overflow: hidden !important;
    touch-action: none;
    -webkit-overflow-scrolling: none;
    position: relative;
    height: 100vh;
    width: 100vw;
}

/* ----- OVERLAY ----- */
.locadora-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    padding: 16px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.locadora-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ----- CONTAINER PRINCIPAL ----- */
.locadora-modal-container {
    background: #fff;
    border-radius: 28px;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    transform: translateY(30px) scale(0.95);
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.locadora-modal-overlay.active .locadora-modal-container {
    transform: translateY(0) scale(1);
}

/* ----- HEADER ----- */
.locadora-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 28px;
    background: linear-gradient(145deg, #4361ee, #3a0ca3);
    color: white;
    border-radius: 28px 28px 0 0;
    position: sticky;
    top: 0;
    z-index: 10;
}

.locadora-modal-header h3 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.5px;
    line-height: 1.2;
}

/* ----- BOTÃO FECHAR ----- */
.locadora-modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
    padding: 0;
    line-height: 1;
}

.locadora-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg) scale(1.1);
}

.locadora-modal-close:focus-visible {
    outline: 2px solid white;
    outline-offset: 2px;
}

/* ----- BODY ----- */
.locadora-modal-body {
    padding: 28px;
}

.modal-subtitle {
    text-align: center;
    color: #4b5563;
    margin-bottom: 28px;
    font-size: 1.1rem;
    font-weight: 400;
}

/* ----- GRID DE DATAS ----- */
.modal-date-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 8px;
}

.modal-date-field {
    display: flex;
    flex-direction: column;
}

.modal-date-field label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-weight: 600;
    color: #1f2937;
    font-size: 0.95rem;
}

.modal-date-input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 14px;
    font-size: 1rem;
    transition: all 0.2s ease;
    background: #fff;
    color: #1f2937;
    font-family: inherit;
}

.modal-date-input:focus {
    border-color: #4361ee;
    box-shadow: 0 0 0 4px rgba(67, 97, 238, 0.1);
    outline: none;
}

.modal-date-input:invalid {
    border-color: #fca5a5;
}

.date-preview {
    font-size: 0.85rem;
    margin-top: 6px;
    min-height: 20px;
    color: #6b7280;
    padding-left: 4px;
}

/* ----- CARD DE RESUMO ----- */
.summary-card {
    margin-top: 28px;
    background: linear-gradient(145deg, #f9fafb, #f3f4f6);
    padding: 24px;
    border-radius: 20px;
    border-left: 6px solid #10b981;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.summary-card h4 {
    margin: 0 0 12px 0;
    font-size: 1.1rem;
    color: #374151;
}

.period-dates {
    font-weight: 700;
    font-size: 1.25rem;
    color: #4361ee;
    margin-bottom: 8px;
}

.period-days {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #4b5563;
    font-size: 1rem;
}

/* ----- FEEDBACK ----- */
.modal-feedback {
    display: none;
    margin-top: 20px;
    padding: 14px 16px;
    border-radius: 12px;
    font-weight: 500;
    text-align: center;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-feedback.success {
    display: block;
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.modal-feedback.error {
    display: block;
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* ----- FOOTER ----- */
.locadora-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 16px;
    padding: 24px 28px;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
    border-radius: 0 0 28px 28px;
    position: sticky;
    bottom: 0;
}

/* ----- BOTÕES ----- */
.locadora-btn-primary {
    background: linear-gradient(145deg, #4361ee, #3a0ca3);
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 14px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 6px -1px rgba(67, 97, 238, 0.2);
}

.locadora-btn-primary:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 12px 20px -8px rgba(67, 97, 238, 0.4);
}

.locadora-btn-primary:active:not(:disabled) {
    transform: translateY(-1px);
}

.locadora-btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.locadora-btn-secondary {
    background: white;
    border: 2px solid #d1d5db;
    padding: 12px 24px;
    border-radius: 14px;
    font-weight: 600;
    color: #4b5563;
    cursor: pointer;
    transition: all 0.2s ease;
}

.locadora-btn-secondary:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

/* ----- BOTÃO FLUTUANTE ----- */
.locadora-floating-button {
    position: fixed;
    bottom: 28px;
    right: 28px;
    background: linear-gradient(145deg, #4361ee, #3a0ca3);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 16px 28px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    z-index: 99999;
    box-shadow: 0 12px 24px -8px rgba(67, 97, 238, 0.4);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    font-weight: 600;
    font-size: 1rem;
}

.locadora-floating-button:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 20px 28px -8px rgba(67, 97, 238, 0.5);
}

.floating-icon {
    font-size: 1.4rem;
}

.floating-text {
    display: none;
}

/* ----- BOTÃO TRIGGER (SHORTCODE) ----- */
.locadora-modal-trigger-btn {
    background: linear-gradient(145deg, #4361ee, #3a0ca3);
    color: white;
    border: none;
    padding: 16px 32px;
    border-radius: 16px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1.1rem;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    transition: all 0.25s ease;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.locadora-modal-trigger-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 20px -8px rgba(67, 97, 238, 0.4);
}

/* ----- NOTIFICAÇÃO FLUTUANTE ----- */
.floating-notification {
    position: fixed;
    bottom: 100px;
    right: 28px;
    background: #10b981;
    color: white;
    padding: 16px 24px;
    border-radius: 16px;
    box-shadow: 0 12px 24px -8px rgba(0, 0, 0, 0.2);
    z-index: 1000000;
    max-width: 320px;
    font-weight: 500;
    animation: slideInRight 0.3s ease;
    border-left: 6px solid #059669;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ===== RESPONSIVIDADE AVANÇADA ===== */

/* Tablet */
@media (min-width: 768px) {
    .floating-text {
        display: inline;
    }
    
    .locadora-floating-button {
        padding: 16px 32px;
    }
}

/* Mobile Grande */
@media (max-width: 480px) {
    .modal-date-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .locadora-modal-header {
        padding: 20px 24px;
    }
    
    .locadora-modal-header h3 {
        font-size: 1.3rem;
    }
    
    .locadora-modal-body,
    .locadora-modal-footer {
        padding: 20px 24px;
    }
    
    .locadora-floating-button {
        bottom: 20px;
        right: 20px;
        padding: 14px 24px;
    }
}

/* Mobile Pequeno */
@media (max-width: 380px) {
    .locadora-modal-container {
        border-radius: 24px;
        max-height: 95vh;
    }
    
    .locadora-modal-header {
        padding: 16px 20px;
        border-radius: 24px 24px 0 0;
    }
    
    .locadora-modal-header h3 {
        font-size: 1.2rem;
    }
    
    .locadora-modal-body,
    .locadora-modal-footer {
        padding: 18px 20px;
    }
    
    .modal-date-input {
        padding: 12px 14px;
        font-size: 0.95rem;
    }
    
    .summary-card {
        padding: 18px;
    }
    
    .period-dates {
        font-size: 1.1rem;
    }
    
    .locadora-btn-primary,
    .locadora-btn-secondary {
        padding: 12px 20px;
        font-size: 0.95rem;
    }
    
    .locadora-floating-button {
        bottom: 16px;
        right: 16px;
        padding: 12px 20px;
        border-radius: 40px;
    }
}

/* Landscape */
@media (max-height: 600px) and (orientation: landscape) {
    .locadora-modal-container {
        max-height: 95vh;
    }
    
    .locadora-modal-body {
        padding: 16px 24px;
    }
    
    .modal-date-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
    
    .summary-card {
        margin-top: 16px;
        padding: 16px;
    }
}

/* ----- UTILITÁRIOS ----- */
.locadora-hidden {
    display: none !important;
}

.locadora-text-center {
    text-align: center;
}

/* ----- LOADING ANIMATION ----- */
.btn-loading i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ----- ACESSIBILIDADE ----- */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}
/* BOTÃO COM BADGE DE ATUALIZAR */
.locadora-modal-trigger-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.button-badge {
    background: #ff9800;
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 20px;
    margin-left: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.8; }
    100% { opacity: 1; }
}

.button-icon {
    font-size: 1.2em;
}

/* QUANDO JÁ TEM DATAS */
.locadora-modal-trigger-btn[data-has-dates="true"] {
    background: linear-gradient(145deg, #4CAF50, #388E3C);
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

.locadora-modal-trigger-btn[data-has-dates="true"]:hover {
    background: linear-gradient(145deg, #66BB6A, #43A047);
}
/* FIM DO CSS */