/* ==========================================================================
   Easy Alerts — Frontend styles
   CSS-only icons (no font dependencies)
   ========================================================================== */

/* ---------- Base ---------- */

.ea-notif {
    display: none;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    box-sizing: border-box;
    z-index: 99999;
}

.ea-notif *,
.ea-notif *::before,
.ea-notif *::after {
    box-sizing: border-box;
}

.ea-notif--visible {
    display: block !important;
    animation: eaNotifFadeIn 0.3s ease-out;
}

.ea-notif--hiding {
    animation: eaNotifFadeOut 0.3s ease-in forwards;
}

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

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

/* ---------- Notification Containers ---------- */

#ea-top-bars {
    position: relative;
    z-index: 99999;
    width: 100%;
}

#ea-notifications-root {
    position: static;
    pointer-events: none;
}

#ea-notifications-root > .ea-notif--modal {
    pointer-events: auto;
}

/* ---------- Bar (Top / Bottom) ---------- */

.ea-notif--bar {
    left: 0;
    right: 0;
    padding: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.ea-notif--top {
    position: relative;
    z-index: 99999;
}

.ea-notif--bottom {
    position: fixed;
    top: auto;
    bottom: 0;
}

.ea-notif--bottom.ea-notif--visible {
    animation-name: eaNotifSlideUp;
}

.ea-notif--bottom.ea-notif--hiding {
    animation-name: eaNotifSlideDown;
}

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

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

.ea-notif__content {
    display: flex;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 20px;
    gap: 12px;
}

.ea-notif__text {
    flex: 1;
    min-width: 0;
}

.ea-notif__title {
    display: block;
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 2px;
}

.ea-notif__message {
    flex: 1;
}

/* Strip default margins from RTE-generated elements inside messages */
.ea-notif__message p,
.ea-notif__message div,
.ea-notif__message h1,
.ea-notif__message h2,
.ea-notif__message h3,
.ea-notif__message h4,
.ea-notif__message ul,
.ea-notif__message ol {
    margin: 0;
    padding: 0;
}

.ea-notif__message p + p {
    margin-top: 0.4em;
}

/* ---------- Modal ---------- */

.ea-notif--modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    width: 100vw;
    height: 100vh;
    max-width: 100%;
    max-height: 100%;
}

.ea-notif--modal.ea-notif--visible {
    display: flex !important;
    animation: eaNotifModalIn 0.3s ease-out;
}

.ea-notif--modal.ea-notif--hiding {
    animation: eaNotifModalOut 0.25s ease-in forwards;
}

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

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

.ea-notif__overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
}

.ea-notif__overlay--light { background: rgba(0, 0, 0, 0.25); }
.ea-notif__overlay--medium { background: rgba(0, 0, 0, 0.45); }
.ea-notif__overlay--dark { background: rgba(0, 0, 0, 0.65); }
.ea-notif__overlay--extra-dark { background: rgba(0, 0, 0, 0.82); }

.ea-notif__dialog {
    position: relative;
    z-index: 2;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    max-width: 520px;
    width: 90%;
    overflow: hidden;
}

.ea-notif__header {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 12px 16px 0;
}

.ea-notif__body {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 4px 20px 20px;
}

.ea-notif--modal .ea-notif__text {
    flex: 1;
    min-width: 0;
}

.ea-notif--modal .ea-notif__title {
    font-size: 16px;
    margin-bottom: 4px;
}

.ea-notif--modal .ea-notif__message {
    flex: 1;
}

.ea-notif--modal .ea-notif__icon {
    width: 28px;
    height: 28px;
    min-width: 28px;
    font-size: 16px;
    flex-shrink: 0;
}

.ea-notif--modal .ea-notif__icon--custom {
    font-size: 26px;
}

/* ---------- Close button ---------- */

.ea-notif__close {
    background: none;
    border: none;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    opacity: 0.6;
    padding: 0 4px;
    color: inherit;
    transition: opacity 0.15s;
}

.ea-notif__close:hover,
.ea-notif__close:focus {
    opacity: 1;
    outline: none;
}

/* ---------- CSS-only Icons (pseudo-elements) ---------- */

.ea-notif__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    min-width: 22px;
    border-radius: 50%;
    font-size: 14px;
    font-weight: 700;
    font-style: normal;
    color: #fff;
    line-height: 1;
}

.ea-notif__icon::before {
    display: block;
}

/* Info: "i" */
.ea-notif--info .ea-notif__icon {
    background: #2196F3;
}
.ea-notif--info .ea-notif__icon::before {
    content: "i";
    font-style: italic;
}

/* Success: checkmark */
.ea-notif--success .ea-notif__icon {
    background: #4CAF50;
}
.ea-notif--success .ea-notif__icon::before {
    content: "\2713";
    font-size: 13px;
}

/* Warning: "!" */
.ea-notif--warning .ea-notif__icon {
    background: #FF9800;
}
.ea-notif--warning .ea-notif__icon::before {
    content: "!";
}

/* Error: "x" */
.ea-notif--error .ea-notif__icon {
    background: #F44336;
}
.ea-notif--error .ea-notif__icon::before {
    content: "\2715";
    font-size: 12px;
}

/* ---------- Custom icons (emoji, no circle background) ---------- */

.ea-notif__icon--custom {
    background: none !important;
    color: inherit;
    font-size: 22px;
    width: auto;
    min-width: 22px;
    border-radius: 0;
    font-weight: 400;
}

.ea-notif__icon--custom::before {
    content: none !important;
}

.ea-notif__icon--custom::after {
    display: block;
}

.ea-notif__icon--custom[data-icon="bell"]::after { content: "\1F514"; }
.ea-notif__icon--custom[data-icon="star"]::after { content: "\2605"; }
.ea-notif__icon--custom[data-icon="heart"]::after { content: "\2764"; }
.ea-notif__icon--custom[data-icon="gift"]::after { content: "\1F381"; }
.ea-notif__icon--custom[data-icon="truck"]::after { content: "\1F69A"; }
.ea-notif__icon--custom[data-icon="megaphone"]::after { content: "\1F4E2"; }
.ea-notif__icon--custom[data-icon="fire"]::after { content: "\1F525"; }
.ea-notif__icon--custom[data-icon="cart"]::after { content: "\1F6D2"; }
.ea-notif__icon--custom[data-icon="bulb"]::after { content: "\1F4A1"; }
.ea-notif__icon--custom[data-icon="clock"]::after { content: "\23F0"; }
.ea-notif__icon--custom[data-icon="tag"]::after { content: "\1F3F7"; }
.ea-notif__icon--custom[data-icon="lock"]::after { content: "\1F512"; }
.ea-notif__icon--custom[data-icon="percent"]::after { content: "%"; font-weight: 700; }

/* ---------- Type color schemes ---------- */

/* Info — Blue */
.ea-notif--info.ea-notif--bar {
    background: #E3F2FD;
    border-left: 4px solid #2196F3;
    color: #0D47A1;
}

.ea-notif--info .ea-notif__dialog {
    border-top: 4px solid #2196F3;
    background: #E3F2FD;
    color: #0D47A1;
}

.ea-notif--info .ea-notif__close {
    color: #0D47A1;
}

/* Success — Green */
.ea-notif--success.ea-notif--bar {
    background: #E8F5E9;
    border-left: 4px solid #4CAF50;
    color: #1B5E20;
}

.ea-notif--success .ea-notif__dialog {
    border-top: 4px solid #4CAF50;
    background: #E8F5E9;
    color: #1B5E20;
}

.ea-notif--success .ea-notif__close {
    color: #1B5E20;
}

/* Warning — Orange */
.ea-notif--warning.ea-notif--bar {
    background: #FFF3E0;
    border-left: 4px solid #FF9800;
    color: #E65100;
}

.ea-notif--warning .ea-notif__dialog {
    border-top: 4px solid #FF9800;
    background: #FFF3E0;
    color: #E65100;
}

.ea-notif--warning .ea-notif__close {
    color: #E65100;
}

/* Error — Red */
.ea-notif--error.ea-notif--bar {
    background: #FFEBEE;
    border-left: 4px solid #F44336;
    color: #B71C1C;
}

.ea-notif--error .ea-notif__dialog {
    border-top: 4px solid #F44336;
    background: #FFEBEE;
    color: #B71C1C;
}

.ea-notif--error .ea-notif__close {
    color: #B71C1C;
}

/* Custom — User-defined colors (via inline styles) */
.ea-notif--custom.ea-notif--bar {
    background: transparent;
    border-left: none;
    color: #333;
}

.ea-notif--custom .ea-notif__dialog {
    border-top: none;
    color: #333;
}

.ea-notif--custom .ea-notif__close {
    color: #555;
}

.ea-notif--custom .ea-notif__icon {
    background: #999;
}

/* ---------- Countdown Timer ---------- */

.ea-notif__countdown {
    font-family: "SF Mono", "Cascadia Code", "Roboto Mono", Menlo, Consolas, monospace;
    font-variant-numeric: tabular-nums;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0.85;
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.08);
    flex-shrink: 0;
}

.ea-notif__countdown:empty {
    display: none;
}

.ea-notif__countdown--modal {
    display: block;
    text-align: center;
    margin-top: 8px;
    font-size: 14px;
    padding: 4px 12px;
    background: rgba(0, 0, 0, 0.06);
}

/* ---------- Responsive ---------- */

@media (max-width: 600px) {
    .ea-notif__content {
        padding: 10px 14px;
        font-size: 13px;
    }

    .ea-notif__dialog {
        width: 95%;
        max-width: none;
    }

    .ea-notif__close {
        font-size: 26px;
        padding: 4px 8px;
    }

    .ea-notif__countdown {
        font-size: 11px;
        padding: 2px 6px;
    }
}
