/* Modal Styles for Save/Load Calculations */

/* Modal Base */
.saved-calculations-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: white;
    border-radius: 12px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    max-width: 700px;
    max-height: 80vh;
    width: 90%;
    overflow: hidden;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Modal Header */
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 28px;
    border-bottom: 1px solid #e5e7eb;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: background-color 0.2s;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Modal Body */
.modal-body {
    padding: 24px 28px;
    max-height: 50vh;
    overflow-y: auto;
}

/* Saved Calculations List */
.saved-calculations-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.saved-calculation-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    transition: all 0.2s;
    background: #fafafa;
}

.saved-calculation-item:hover {
    border-color: #667eea;
    background: #f8faff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.1);
}

.calc-info {
    flex: 1;
    min-width: 0;
}

.calc-description {
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.calc-details {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: #6b7280;
}

.calc-date,
.calc-result {
    display: flex;
    align-items: center;
    gap: 4px;
}

.calc-actions {
    display: flex;
    gap: 8px;
    margin-left: 16px;
}

/* Small Buttons */
.btn-small {
    padding: 6px 12px;
    font-size: 13px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
    min-width: 60px;
}

.btn-small.btn-primary {
    background: #667eea;
    color: white;
}

.btn-small.btn-primary:hover {
    background: #5a67d8;
    transform: translateY(-1px);
}

.btn-small.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-small.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

/* Modal Footer */
.modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 28px;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
}

/* Success Message Styles */
.save-success-message {
    margin-bottom: 20px;
    animation: slideInDown 0.3s ease-out;
}

.success-content {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.success-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.success-text {
    flex: 1;
    min-width: 0;
}

.success-text strong {
    display: block;
    margin-bottom: 4px;
}

.success-text p {
    margin: 4px 0;
    font-size: 14px;
    opacity: 0.9;
}

.success-text small {
    font-size: 12px;
    opacity: 0.8;
}

.success-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.success-actions .btn-small {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    font-size: 12px;
    padding: 4px 8px;
}

.success-actions .btn-small:hover {
    background: rgba(255, 255, 255, 0.3);
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        max-height: 90vh;
        margin: 20px;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 16px 20px;
    }
    
    .saved-calculation-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .calc-actions {
        width: 100%;
        justify-content: flex-end;
        margin-left: 0;
    }
    
    .calc-details {
        flex-direction: column;
        gap: 4px;
    }
    
    .success-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .success-actions {
        flex-direction: row;
        width: 100%;
        justify-content: flex-end;
    }
}

/* Calculate Another Modal */
.calculate-another-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.calculate-another-modal.show {
    opacity: 1;
}

.calculate-another-modal .modal-content {
    max-width: 500px;
    width: 90%;
}

.option-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

.option-btn {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    width: 100%;
}

.option-btn:hover {
    border-color: #667eea;
    background: #f8faff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.option-btn.primary {
    border-color: #667eea;
}

.option-btn.primary:hover {
    border-color: #5a67d8;
    background: #eef2ff;
}

.option-btn.secondary:hover {
    border-color: #10b981;
    background: #f0fdf4;
}

.option-btn.tertiary:hover {
    border-color: #f59e0b;
    background: #fffbeb;
}

.option-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.option-text {
    flex: 1;
}

.option-text strong {
    display: block;
    font-size: 15px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 4px;
}

.option-text small {
    font-size: 13px;
    color: #6b7280;
    line-height: 1.3;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #6b7280;
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.empty-state h4 {
    margin: 0 0 8px 0;
    color: #374151;
}

.empty-state p {
    margin: 0;
    font-size: 14px;
}

/* Responsive for Calculate Another */
@media (max-width: 768px) {
    .option-btn {
        padding: 14px 16px;
        gap: 12px;
    }
    
    .option-icon {
        font-size: 20px;
    }
    
    .option-text strong {
        font-size: 14px;
    }
    
    .option-text small {
        font-size: 12px;
    }
}