/**
 * DeepRoots — branded modals (tree, dashboard, all feature popups)
 */

/* Teal accent bar */
.modal-content::before,
.dr-modal__panel::before {
    content: '' !important;
    display: block !important;
    flex-shrink: 0;
    height: 4px;
    width: 100%;
    background: linear-gradient(
        90deg,
        #0f766e 0%,
        #14b8a6 25%,
        #84cc16 50%,
        #14b8a6 75%,
        #0f766e 100%
    );
    background-size: 200% 100%;
    animation: dr-modal-accent-shift 5s ease-in-out infinite;
}

@keyframes dr-modal-accent-shift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.modal-content,
.dr-modal__panel {
    box-sizing: border-box;
    border: 1px solid var(--dr-cyan);
    box-shadow:
        0 24px 48px rgba(15, 118, 110, 0.18),
        0 0 0 1px rgba(255, 255, 255, 0.8) inset;
}

/* Branded header — bar is on .dr-modal__header; title is centered inside */
.modal .dr-modal__header {
    display: block;
    width: 100%;
    margin: 0;
    padding: 14px 48px 12px;
    text-align: center;
    border-bottom: 1px solid #ccfbf1;
    background: linear-gradient(180deg, #f0fdfa 0%, #ffffff 100%);
    box-sizing: border-box;
    flex-shrink: 0;
}

.modal .dr-modal__title,
.modal .dr-modal__header h2,
.modal-content > h2,
.dr-modal__header h2,
.dr-modal-toolbar h2 {
    margin: 0;
    padding: 0;
    border: none;
    background: transparent;
    color: #134e4a;
    text-align: center !important;
    width: 100%;
    box-sizing: border-box;
    font-size: var(--dr-text-lg, 1rem);
    font-weight: 700;
    line-height: 1.3;
}

.modal .close,
.dr-modal__close {
    background: #f0fdfa !important;
    color: #0f766e !important;
    border: 1px solid var(--dr-cyan);
}

.modal .close:hover,
.dr-modal__close:hover {
    background: #ccfbf1 !important;
    color: #134e4a !important;
}

/* Empty states inside modals */
.modal-content .dr-empty,
.dr-modal__body .dr-empty {
    text-align: center;
    padding: 28px 20px 32px;
    margin: 4px 0 8px;
    border-radius: var(--dr-radius, 12px);
    background: linear-gradient(165deg, #f0fdfa 0%, #f8fafc 55%, #ffffff 100%);
    border: 1px dashed var(--dr-cyan);
}

.dr-empty__icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 14px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, #ccfbf1 0%, #ecfdf5 100%);
    color: #0f766e;
    box-shadow: 0 4px 16px rgba(20, 184, 166, 0.2);
}

.dr-empty__icon svg {
    width: 26px;
    height: 26px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.dr-empty__title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #134e4a;
    margin: 0 0 8px;
}

.dr-empty p:not(.dr-empty__title) {
    color: var(--dr-text-muted);
    font-size: 0.92rem;
    line-height: 1.5;
}

.dr-empty .dr-btn,
.dr-empty .dr-btn-primary {
    margin-top: 18px;
    min-width: 200px;
}

.dr-empty .dr-modal-actions {
    margin-top: 18px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

/* 2FA / security setup */
.modal-content--security {
    max-width: 520px;
}

/* Security modal title — see deeproots-theme.css */

/* Compact modals (notifications, messages) */
.modal-content--compact {
    max-width: 440px;
}

/* Social / feed modals */
.modal-content--social {
    max-width: 640px;
}

/* Mobile — centered cards with brand styling (not edge-hugging sheets) */
@media (max-width: 768px) {
    .modal[style*="display: block"],
    .modal.is-open {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 16px !important;
        box-sizing: border-box;
    }

    .modal-content,
    .dr-modal__panel {
        width: 100% !important;
        max-width: min(560px, calc(100vw - 32px)) !important;
        max-height: min(88vh, 100%) !important;
        min-height: 0 !important;
        margin: 0 auto !important;
        border-radius: 16px !important;
    }

    .modal-content--compact {
        max-width: min(420px, calc(100vw - 32px)) !important;
    }

    .modal-content[style*="max-width"],
    .modal-content--wide,
    .modal-content--social {
        max-width: calc(100vw - 24px) !important;
    }

    .modal-content--member-admin {
        max-width: calc(100vw - 16px) !important;
    }

    .modal-content--member-admin .dr-member-admin-toolbar {
        padding-left: 16px;
        padding-right: 44px;
    }

    .modal-content > h2,
    .dr-modal-toolbar h2 {
        font-size: 1.1rem;
        padding-left: 44px;
        padding-right: 44px;
    }

    #feedBody .dr-empty .dr-btn-primary,
    .dr-empty .dr-btn-primary {
        width: 100%;
        max-width: 280px;
    }
}

@media (max-width: 480px) {
    .modal[style*="display: block"],
    .modal.is-open {
        padding: 12px !important;
    }

    .modal-content,
    .dr-modal__panel {
        max-width: calc(100vw - 20px) !important;
        max-height: 92vh !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .modal-content::before,
    .dr-modal__panel::before {
        animation: none;
    }
}
