.rolling-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    backdrop-filter: blur(5px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.rolling-modal.active {
    display: flex;
    opacity: 1;
}

.rolling-modal-content {
    background: #fff;
    width: 90%;
    max-width: 900px;
    margin: auto;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.rolling-modal.active .rolling-modal-content {
    transform: translateY(0);
}

.rolling-header {
    background: linear-gradient(135deg, var(--clr-primary) 0%, var(--clr-accent) 100%);
    color: #fff;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.rolling-header h2 {
    margin: 0;
    font-size: 20px;
    text-transform: uppercase;
    font-weight: 700;
}

.close-rolling {
    background: none;
    border: none;
    color: #fff;
    font-size: 30px;
    cursor: pointer;
    line-height: 1;
}

.rolling-body {
    padding: 25px;
    overflow-y: auto;
    flex: 1;
}

.rolling-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.rolling-form-group {
    margin-bottom: 20px;
}

.rolling-form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
}

.rolling-form-group select, .rolling-form-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 15px;
    background: #f9f9f9;
}

.rolling-result-box {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    border: 1px solid #eee;
}

.result-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px dashed #eee;
    font-size: 14px;
}

.result-item.total {
    border-bottom: none;
    padding-top: 15px;
    margin-top: 10px;
    border-top: 2px solid var(--clr-accent);
    font-weight: 800;
    font-size: 19px;
    color: var(--clr-accent);
}

.rolling-loan-section {
    margin-top: 30px;
    background: #F0F4F9;
    padding: 20px;
    border-radius: 10px;
    border: 1px solid #C8D6E5;
}

.loan-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 15px;
}

.rolling-footer-actions {
    padding: 20px;
    background: #f8f9fa;
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    border-top: 1px solid #eee;
}

.btn-rolling-print {
    background: #333;
    color: #fff;
    padding: 12px 25px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-rolling-details {
    background: #14397B;
    color: #fff;
    padding: 12px 25px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-weight: 600;
}

.btn-rolling-print:hover { background: #000; }
.btn-rolling-details:hover { background: #0D2652; }

@media (max-width: 768px) {
    .rolling-grid { grid-template-columns: 1fr; }
    .loan-controls { grid-template-columns: 1fr; }
    .rolling-modal-content { width: 95%; height: 95vh; }
}

@media (min-width: 769px) {
    .rolling-body {
        padding: 15px 25px;
    }
    .rolling-grid {
        gap: 20px;
    }
    .rolling-form-group {
        margin-bottom: 12px;
    }
    .rolling-form-group label {
        margin-bottom: 5px;
    }
    .rolling-form-group select, .rolling-form-group input {
        padding: 10px 12px;
    }
    .rolling-result-box {
        padding: 15px;
    }
    .rolling-result-box h4 {
        margin-bottom: 10px !important;
    }
    .result-item {
        padding: 8px 0;
    }
    .result-item.total {
        padding-top: 12px;
        margin-top: 8px;
    }
    .rolling-loan-section {
        margin-top: 15px;
        padding: 15px;
    }
    .rolling-loan-section h4 {
        margin-bottom: 10px !important;
    }
    .loan-controls {
        gap: 15px;
        margin-top: 10px;
    }
    .rolling-dealer-info {
        margin-top: 15px !important;
        padding: 15px !important;
    }
    #rolling-amortization-details {
        margin-top: 15px !important;
        padding-top: 15px !important;
    }
}

/* Printing styles */
@media print {
    html, body {
        height: auto !important;
        overflow: visible !important;
        position: static !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    body > *:not(#rolling-cost-modal) {
        display: none !important;
    }
    #rolling-cost-modal {
        position: static !important;
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
        background: transparent !important;
        width: 100% !important;
        height: auto !important;
    }
    #rolling-cost-modal * {
        visibility: visible !important;
    }
    .rolling-modal-content {
        position: static !important;
        width: 100% !important;
        max-width: 100% !important;
        max-height: none !important;
        overflow: visible !important;
        display: block !important;
        box-shadow: none !important;
        transform: none !important;
        background: transparent !important;
    }
    .rolling-body {
        padding: 0 !important;
        overflow: visible !important;
        height: auto !important;
        max-height: none !important;
    }
    .rolling-grid {
        display: block !important;
    }
    .rolling-inputs,
    .rolling-header,
    .rolling-footer-actions,
    .close-rolling,
    .no-print {
        display: none !important;
    }
    .print-header {
        display: block !important;
    }
    .print-signatures {
        display: flex !important;
    }
    .rolling-dealer-info {
        background: #fff !important;
        border: 1px solid #ddd !important;
        page-break-inside: avoid;
        margin-top: 40px !important;
    }
    #rolling-amortization-details {
        page-break-before: always;
        margin-top: 0 !important;
        padding-top: 20px !important;
        border-top: none !important;
    }
}
