/* Modal Styles - Overlays, content, headers/footers, close buttons, dialogs */

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

/* Standard modal — full-viewport overlay with centered content */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    max-height: none;
    max-width: none;
    overflow: hidden;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 0;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
}

.modal.active {
    display: flex;
}

.modal .modal-content {
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal .modal-body {
    flex: 1;
    overflow-y: auto;
    max-height: none;
}

#mySettingsModal .settings-modal-content {
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    min-height: auto;
    overflow: hidden;
    margin: 0;
    padding: 0;
    border: none;
    animation: modalSlideIn 0.3s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #e9ecef;
}

.modal-header h3 {
    margin: 0;
    color: white;
    font-size: 1.1rem;
    font-weight: 500;
    font-family: inherit;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: white;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: #f8f9fa;
    color: #333;
}

.modal-body {
    padding: 2rem;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
}

.modal-actions .btn-primary,
.modal-actions .btn-secondary,
.modal-actions .btn-danger {
    margin: 0;
    min-width: 120px;
}

/* Modal footer specific styling */
.modal-footer {
    height: 62px;
    margin-top: 24px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1rem;
}

.modal-footer .btn-secondary {
    margin: 0px;
}

.cta-button.secondary {
    background: #6c757d;
    border-color: #6c757d;
}

.cta-button.secondary:hover {
    background: #5a6268;
    border-color: #545b62;
}


/* Edit Modal Styles */
.edit-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.edit-modal {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.edit-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #e9ecef;
    background: #f8f9fa;
    border-radius: 12px 12px 0 0;
}

.edit-modal-header h3 {
    margin: 0;
    color: #2d5f3f;
    font-size: 12pt;
}

.close-modal {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-modal:hover {
    color: #333;
}

.edit-modal-body {
    padding: 2rem;
}

#editFormFields {
    max-height: 50vh;
    overflow-y: auto;
    margin-bottom: 2rem;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 1rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e9ecef;
}

.form-actions .btn-primary,
.form-actions .btn-secondary,
.form-actions .btn-danger {
    margin: 0;
    min-width: 100px;
}

/* Delete Confirmation Modal */
.delete-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.delete-modal {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.15);
    max-width: 400px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
}

.delete-modal-header {
    padding: 1.5rem 2rem 1rem 2rem;
    border-bottom: 1px solid #e9ecef;
    background: #f8f9fa;
    border-radius: 12px 12px 0 0;
}

.delete-modal-header h3 {
    margin: 0;
    color: #dc3545;
    font-size: 12pt;
    font-weight: 600;
}

.delete-modal-body {
    padding: 2rem;
}

.delete-modal-text {
    color: #495057;
    font-size: 10pt;
    line-height: 1.5;
    margin-bottom: 2rem;
    text-align: center;
}

.delete-modal-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.delete-modal-actions .btn-secondary,
.delete-modal-actions .btn-danger {
    min-width: 100px;
    height: 38px;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10pt;
    font-weight: 500;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}


/* Modal overlay styles for deletion confirmation */
#delete-confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2500;
}

#delete-confirm-overlay[style*="display: none"] {
    display: none !important;
}

#delete-confirm-overlay[style*="display: block"] {
    display: flex !important;
}

/* Notes page: .modal used as inner content box inside .modal-overlay */
.modal-overlay > .modal {
    position: static;
    display: block;
    width: 90%;
    height: auto;
    max-width: 400px;
    max-height: 80vh;
    overflow-y: auto;
    padding: 1.5rem;
    margin: 0;
    background: white;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    backdrop-filter: none;
    z-index: auto;
}

/* Specific styling for delete confirmation modal */
#delete-confirm-overlay .modal {
    max-width: 300px;
    padding: 0.75rem;
    max-height: 25vh;
}

#delete-confirm-overlay .modal h3 {
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

#delete-confirm-overlay .modal p {
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

.modal h3 {
    margin: 0 0 1rem 0;
    font-size: 1.2rem;
    font-weight: 600;
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 1rem;
}

#delete-confirm-overlay .modal-actions {
    margin-top: 0.25rem;
    gap: 0.5rem;
}

#delete-confirm-overlay .btn-secondary,
#delete-confirm-overlay .btn-danger {
    padding: 0.3rem 0.6rem;
    font-size: 0.75rem;
    min-width: 60px;
}

.inline-edit-input,
.inline-edit-textarea,
.inline-edit-select {
    padding: 0.25rem 0.5rem;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 0.9rem;
    width: auto;
    min-width: 200px;
    margin-left: 0.5rem;
}

.inline-edit-textarea {
    resize: vertical;
    font-family: inherit;
    min-width: 300px;
}

.inline-edit-input:focus,
.inline-edit-textarea:focus,
.inline-edit-select:focus {
    outline: none;
    border-color: #2d5f3f;
    box-shadow: 0 0 0 2px rgba(45, 95, 63, 0.1);
}


/* Password Reset Modal */
.password-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.password-modal {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.password-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #e9ecef;
    background: #f8f9fa;
    border-radius: 12px 12px 0 0;
}

.password-modal-header h3 {
    margin: 0;
    color: #2d5f3f;
    font-size: 12pt;
    font-weight: 600;
}

.password-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.password-modal-close:hover {
    color: #333;
    background: #e9ecef;
}

.password-modal-body {
    padding: 2rem;
}

.password-error-message {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1.5rem;
    font-size: 10pt;
    display: none;
}

.password-input-group {
    margin-bottom: 1.5rem;
}

.password-input-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #333;
    font-weight: 600;
    font-size: 10pt;
}

.password-input-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 10pt;
    box-sizing: border-box;
    transition: border-color 0.3s ease;
}

.password-input-group input:focus {
    outline: none;
    border-color: #2d5f3f;
    box-shadow: 0 0 0 2px rgba(45, 95, 63, 0.1);
}

.password-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding: 1.5rem 2rem;
    border-top: 1px solid #e9ecef;
    background: #f8f9fa;
    border-radius: 0 0 12px 12px;
}

.password-btn {
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 10pt;
    font-weight: 600;
    transition: all 0.3s ease;
    min-width: 80px;
}

.password-btn-primary {
    background: #2d5f3f;
    color: white;
}

.password-btn-primary:hover {
    background: #1e4029;
}

.password-btn-secondary {
    background: #6c757d;
    color: white;
}

.password-btn-secondary:hover {
    background: #545b62;
}

/* Mobile responsive adjustments for password modal */
@media (max-width: 480px) {
    .password-modal {
        width: 95%;
        margin: 1rem;
    }
    
    .password-modal-header,
    .password-modal-body,
    .password-modal-footer {
        padding: 1rem 1.5rem;
    }
    
    .password-modal-footer {
        flex-direction: column-reverse;
        gap: 0.75rem;
    }
    
    .password-btn {
        width: 100%;
        padding: 1rem;
    }
    
    .password-input-group input {
        padding: 1rem;
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

.edit-input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 3px;
    margin-bottom: 0.5rem;
    font-size: 14px;
}

.edit-input:focus {
    outline: none;
    border-color: #2d5f3f;
    box-shadow: 0 0 0 2px rgba(45, 95, 63, 0.1);
}

/* Save Message Modal Styles */
.save-message-modal {
    max-width: 400px;
    width: 90%;
}

.save-message-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    padding-top: 10px;
    padding-left: 10px;
    border-bottom: 1px solid #eee;
}

.save-message-icon {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    color: white;
    box-sizing: border-box;
}

.save-message-success .save-message-icon {
    background-color: #2d5f3f;
}

.save-message-error .save-message-icon {
    background-color: #dc3545;
}

.save-message-info .save-message-icon {
    background-color: #7db8a3;
}

.save-message-header h3 {
    margin: 0;
    color: #333;
    font-size: 1.1rem;
    font-weight: 500;
}

.save-message-body {
    margin-bottom: 1.5rem;
}

.save-message-body p {
    margin: 0;
    color: #555;
    line-height: 1.5;
    text-align: left;
    padding-left: 20px;
}

.save-message-footer {
    display: flex;
    justify-content: flex-end;
}

.save-message-footer .btn-primary {
    min-width: 80px;
    padding: 0.5rem 1rem;
}


/* .modal and .modal.active are defined in the Modal Styles section near line 483 */

/* .modal-content is defined in the Modal Styles section near line 527 */

/* Large modal variant for complex forms */
.modal-content.modal-lg {
    max-width: 1000px;
    width: 95%;
    max-height: none;
}

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

.modal-header {
    background-color: #2d5f3f;
    color: white;
    padding: 1.5rem 2rem;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.modal-close {
    color: white;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    transition: opacity 0.2s ease;
}

.modal-close:hover,
.modal-close:focus {
    opacity: 0.7;
}

.modal-body {
    padding: 1.5rem 2rem 2rem;
    overflow-y: auto;
    max-height: calc(90vh - 80px);
}

.modal-body .form-group {
    margin-bottom: 1rem;
}

.modal-body .form-label {
    display: block;
    margin-bottom: 0.5rem;
    color: #333;
    font-weight: 500;
    font-size: 0.95rem;
}

.modal-body .form-input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s ease;
    background-color: #f8f9fa;
}

.modal-body .form-input:focus {
    outline: none;
    border-color: #2d5f3f;
    background-color: white;
    box-shadow: 0 0 0 3px rgba(45, 95, 63, 0.1);
}

.modal-body .submit-button {
    width: 100%;
    background-color: #2d5f3f;
    color: white;
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
}

.modal-body .submit-button:hover {
    background-color: #245f3a;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(45, 95, 63, 0.3);
}

.modal-body .submit-button:active {
    transform: translateY(0);
}


/* Modal Alert Styles */
.modal-body .alert {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    font-weight: 500;
}

.modal-body .alert.success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.modal-body .alert.error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

/* Mobile Modal Adjustments */
@media (max-width: 768px) {
    .modal-content {
        margin: 10% auto;
        width: 95%;
    }
    
    .modal-header {
        padding: 1.25rem 1.5rem;
    }
    
    .modal-header h2 {
        font-size: 1.25rem;
    }
    
    .modal-body {
        padding: 1.5rem;
    }
}

.favorite-save-icon:hover {
    opacity: 1;
    transform: scale(1.1);
}

.favorite-save-icon.saved {
    color: #2d5f3f;
    fill: #2d5f3f;
    opacity: 1;
}

/* Confirmation modal button styling */
.confirmation-footer {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    margin-top: 2rem;
    padding: 0 2rem 1.5rem 2rem;
}

.confirmation-btn.btn-secondary {
    background-color: #666;
    color: white;
}

.confirmation-btn.btn-secondary:hover {
    background-color: #555;
    transform: translateY(-1px);
}

.confirmation-btn.btn-primary {
    background-color: #2d5f3f;
    color: white;
}

.confirmation-btn.btn-primary:hover {
    background-color: #1e3f2a;
    transform: translateY(-1px);
}

