/* Modal Alert System */
.note-creation-loading-modal {
    position: fixed;
    inset: 0;
    z-index: 10050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(17, 24, 39, 0.34);
    backdrop-filter: blur(2px);
}

.note-creation-loading-dialog {
    width: min(260px, 100%);
    min-height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(229, 231, 235, 0.85);
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.22);
}

.note-creation-loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: #4b5563;
    font-size: 13px;
    font-weight: 500;
}

.note-creation-loading-content i {
    color: #007DB8;
    font-size: 34px;
    line-height: 1;
}

html[data-theme='dark'] .note-creation-loading-modal,
body.dark-mode .note-creation-loading-modal {
    background: rgba(0, 0, 0, 0.46);
}

html[data-theme='dark'] .note-creation-loading-dialog,
body.dark-mode .note-creation-loading-dialog {
    background: var(--dm-surface);
    border-color: var(--dm-border);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.42);
}

html[data-theme='dark'] .note-creation-loading-content,
body.dark-mode .note-creation-loading-content {
    color: var(--dm-text-muted);
}

.alert-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: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.alert-modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.alert-modal {
    background: var(--bg-color, #fff);
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    transform: scale(0.9) translateY(-20px);
    transition: transform 0.3s ease;
}

.alert-modal-overlay.show .alert-modal {
    transform: scale(1) translateY(0);
}

.alert-modal-header {
    padding: 20px 20px 0 20px;
    border-bottom: 1px solid var(--border-color, #e0e0e0);
}

.alert-modal-title {
    margin: 0 0 16px 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-color, #333);
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-modal-icon {
    font-size: 20px;
}

.alert-modal-icon.warning {
    color: #ff9800;
}

.alert-modal-icon.error {
    color: #f44336;
}

.alert-modal-icon.info {
    color: #2196f3;
}

.alert-modal-icon.success {
    color: #4caf50;
}

.alert-modal-body {
    padding: 20px;
    color: var(--text-color, #666);
    line-height: 1.5;
}

.alert-modal-footer {
    padding: 0 20px 20px 20px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.alert-modal-button {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 400;
    transition: all 0.2s ease;
    min-width: 80px;
}

.alert-modal-button:focus {
    outline: none;
    box-shadow: none;
}

.alert-modal-button.primary {
    background: var(--primary-color, #007DB8);
    color: white;
}

.alert-modal-button.primary:hover {
    background: var(--primary-color-dark, #005a8a);
}

.alert-modal.snapshot-restore-confirm .alert-modal-button.primary,
.alert-modal-button.primary.snapshot-restore-confirm-button {
    background: #007DB8;
}

.alert-modal.snapshot-restore-confirm .alert-modal-button.primary:hover,
.alert-modal-button.primary.snapshot-restore-confirm-button:hover {
    background: #005a8a;
}

.alert-modal-button.secondary {
    background: #e04b4b;
    color: white;
}

.alert-modal-button.secondary:hover {
    background: #c43b3b;
}

/* Dark mode support */
html[data-theme='dark'] .alert-modal,
.dark-mode .alert-modal {
    background: var(--bg-color-dark, #2d3748);
    color: var(--text-color-dark, #e2e8f0);
}

html[data-theme='dark'] .alert-modal-header,
.dark-mode .alert-modal-header {
    border-color: var(--border-color-dark, #4a5568);
}

html[data-theme='dark'] .alert-modal-title,
.dark-mode .alert-modal-title {
    color: var(--text-color-dark, #e2e8f0);
}

html[data-theme='dark'] .alert-modal-body,
.dark-mode .alert-modal-body {
    color: var(--text-color-dark, #cbd5e0);
}

html[data-theme='dark'] .alert-modal-button,
.dark-mode .alert-modal-button {
    background-color: var(--dm-surface);
    color: var(--dm-text);
    border-color: var(--dm-border);
}

html[data-theme='dark'] .alert-modal-button:hover,
.dark-mode .alert-modal-button:hover {
    background-color: var(--dm-surface-hover);
}

html[data-theme='dark'] .alert-modal-button.primary,
.dark-mode .alert-modal-button.primary {
    background-color: var(--primary-color, #007DB8);
    color: white;
}

html[data-theme='dark'] .alert-modal-button.primary:hover,
.dark-mode .alert-modal-button.primary:hover {
    background-color: var(--primary-color-dark, #005a8a);
}

html[data-theme='dark'] .alert-modal-button.secondary,
.dark-mode .alert-modal-button.secondary {
    background-color: #e04b4b;
    color: #fff;
}

html[data-theme='dark'] .alert-modal-button.secondary:hover,
.dark-mode .alert-modal-button.secondary:hover {
    background-color: #c43b3b;
}

html[data-theme='dark'] .alert-modal.snapshot-restore-confirm .alert-modal-button.primary,
html[data-theme='dark'] .alert-modal-button.primary.snapshot-restore-confirm-button,
.dark-mode .alert-modal.snapshot-restore-confirm .alert-modal-button.primary,
.dark-mode .alert-modal-button.primary.snapshot-restore-confirm-button {
    background-color: #007DB8;
}

html[data-theme='dark'] .alert-modal.snapshot-restore-confirm .alert-modal-button.primary:hover,
html[data-theme='dark'] .alert-modal-button.primary.snapshot-restore-confirm-button:hover,
.dark-mode .alert-modal.snapshot-restore-confirm .alert-modal-button.primary:hover,
.dark-mode .alert-modal-button.primary.snapshot-restore-confirm-button:hover {
    background-color: #005a8a;
}

/* Responsive */
@media (max-width: 480px) {
    .alert-modal {
        margin: 20px;
        width: calc(100% - 40px);
    }

    .alert-modal-footer {
        flex-direction: column;
    }

    .alert-modal-button {
        width: 100%;
    }
}

/* Loading Spinner Modal */
.spinner-modal {
    text-align: center;
}

.spinner-overlay {
    pointer-events: none;
    /* Prevent interaction with background */
}

/* Base animation for indeterminate progress bars */
@keyframes indeterminate-progress {
    0% { left: -30%; width: 30%; }
    50% { left: 40%; width: 60%; }
    100% { left: 100%; width: 30%; }
}

/* Progress Bar Modal */
.progress-modal {
    text-align: center;
}

.progress-container {
    width: 100%;
    height: 12px;
    background: var(--border-color, #e0e0e0);
    border-radius: 6px;
    overflow: hidden;
    margin: 15px 0;
    position: relative;
}

.progress-bar-inner {
    height: 100%;
    background: var(--primary-color, #007DB8);
    width: 0%;
    position: absolute;
    left: 0;
    transition: width 0.3s ease;
}

html[data-theme='dark'] .progress-container,
.dark-mode .progress-container {
    background: var(--border-color-dark, #4a5568);
}

.spinner-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color, #e0e0e0);
    border-top: 2px solid var(--primary-color, #007DB8);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Dark mode spinner */
html[data-theme='dark'] .spinner,
.dark-mode .spinner {
    border-color: var(--border-color-dark, #4a5568);
    border-top-color: var(--primary-color, #007DB8);
}
