/**
 * Modals – translucent backdrop, light card content, rounded corners.
 */

.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(22, 35, 56, 0.25);
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    backdrop-filter: blur(8px);
    animation: modalFadeIn 0.25s ease-out;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalSlideUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-backdrop.visible {
    display: flex;
}

.modal {
    background: var(--color-bg-elevated);
    border-radius: var(--radius);
    padding: 0;
    max-width: 560px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    animation: modalSlideUp 0.3s ease-out;
    position: relative;
}

.modal::before {
    display: none;
}

.modal > *:not(.marker-modal-close):not(.modal-close) {
    padding: 1.75rem 2rem;
}

.modal > *:not(.marker-modal-close):not(.modal-close):first-child {
    padding-top: 1.75rem;
}

.modal > *:not(.marker-modal-close):not(.modal-close):last-child {
    padding-bottom: 1.75rem;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    background: var(--color-surface-strong);
    color: var(--color-text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
    z-index: 4;
}

.modal-close:hover {
    background: var(--color-accent-hover);
    border-color: var(--border-strong);
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 0;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-border);
}

.modal-btn {
    flex: 1;
    padding: 0.7rem 1.25rem;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-family: var(--font-body);
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
    letter-spacing: 0.02em;
    border: none;
}

.modal-btn::before {
    display: none;
}

.modal-btn.primary {
    background: var(--color-surface);
    color: var(--color-text);
    border: 1px solid var(--color-border);
}

.modal-btn.primary:hover {
    background: var(--color-accent-hover);
    border-color: var(--border-strong);
}

.modal-btn:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.modal-btn.secondary {
    background: transparent;
    border: 1px solid var(--color-border);
    color: var(--color-text);
}

.modal-btn.secondary:hover {
    background: var(--bg-elev-1);
    border-color: var(--border-strong);
}

/* Detail modal variant */
.details-modal .modal {
    max-width: 640px;
    width: 100%;
}

.details-modal.modal-backdrop {
    background: rgba(22, 35, 56, 0.2);
    backdrop-filter: blur(6px);
}

.details-modal .modal-close,
.details-modal .marker-modal-close {
    background: var(--color-surface-strong);
    border: 1px solid var(--color-border);
    color: var(--color-text);
}

.details-modal .modal-close:hover,
.details-modal .marker-modal-close:hover {
    background: var(--color-accent-hover);
}

.details-modal .modal-btn.secondary {
    background: transparent;
    border: 1px solid var(--color-border);
    color: var(--color-text);
}

.details-modal .modal-btn.secondary:hover {
    background: var(--bg-elev-1);
}

/* Share modal */
.share-modal .modal {
    max-width: 440px;
}

.share-modal-title {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 0.35rem;
}

.share-modal-subtitle {
    color: var(--color-muted);
    margin-bottom: 0.75rem;
    line-height: 1.5;
    font-size: 0.88rem;
}

.share-url-container {
    background: var(--color-surface);
    border-radius: var(--radius-sm);
    padding: 0.9rem 1rem;
    margin: 0.75rem 0;
    border: 1px solid var(--color-border);
}

.share-url {
    font-family: monospace;
    font-size: 0.8rem;
    color: var(--color-text);
    word-break: break-all;
}

.copy-btn {
    margin-top: 0.5rem;
    padding: 0.5rem 0.9rem;
    background: var(--color-surface);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.copy-btn:hover {
    background: var(--color-accent-hover);
}
