/**
 * Alert Block Styles
 */

.wp-custom-blocks-alert {
    --alert-background: #ffffff;
    --alert-text: #1f2937;
    --alert-border: #fbbf24;
    --alert-icon-bg: #fef3c7;
    --alert-padding: 1rem;
    --alert-radius: 0.5rem;
    --alert-gap: 0.75rem;

    position: relative;
    margin: 1.5rem 0;
    padding: var(--alert-padding);
    background: var(--alert-background);
    border-radius: var(--alert-radius);
    font-size: 0.95rem;
    line-height: 1.6;
}

.wp-custom-blocks-alert__inner {
    display: flex;
    align-items: flex-start;
    gap: var(--alert-gap);
}

.wp-custom-blocks-alert__icon {
    flex-shrink: 0;
    font-size: 1.25rem;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--alert-icon-bg);
    border-radius: 0.375rem;
}

.wp-custom-blocks-alert__content {
    flex: 1;
    min-width: 0;
}

.wp-custom-blocks-alert__title {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: var(--alert-heading-font-weight, 600);
    font-size: var(--alert-heading-font-size, 1rem);
    color: var(--alert-text);
}

.wp-custom-blocks-alert__text {
    margin: 0;
    color: var(--alert-text);
}

.wp-custom-blocks-alert__text p {
    margin: 0;
}

.wp-custom-blocks-alert__dismiss {
    flex-shrink: 0;
    width: 1.5rem;
    height: 1.5rem;
    padding: 0;
    background: transparent;
    border: none;
    color: var(--alert-text);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s ease;
}

.wp-custom-blocks-alert__dismiss:hover {
    opacity: 1;
}

.wp-custom-blocks-alert__dismiss:focus {
    outline: 2px solid var(--alert-border);
    outline-offset: 2px;
    border-radius: 0.25rem;
}

/* Alert Types - can be overridden by custom colors */
.wp-custom-blocks-alert--warning {
    --alert-background: #fef3c7;
    --alert-text: #92400e;
    --alert-border: #f59e0b;
    --alert-icon-bg: #fbbf24;
}

/* Custom color overrides */
.wp-custom-blocks-alert[style*="--alert-background"] {
    --alert-icon-bg: var(--alert-background);
}

.wp-custom-blocks-alert[style*="--alert-border"] .wp-custom-blocks-alert__icon {
    background: var(--alert-border);
    opacity: 0.2;
}

.wp-custom-blocks-alert--info {
    --alert-background: #dbeafe;
    --alert-text: #1e40af;
    --alert-border: #3b82f6;
    --alert-icon-bg: #60a5fa;
}

.wp-custom-blocks-alert--success {
    --alert-background: #d1fae5;
    --alert-text: #065f46;
    --alert-border: #10b981;
    --alert-icon-bg: #34d399;
}

.wp-custom-blocks-alert--error {
    --alert-background: #fee2e2;
    --alert-text: #991b1b;
    --alert-border: #ef4444;
    --alert-icon-bg: #f87171;
}

.wp-custom-blocks-alert--tip {
    --alert-background: #f3e8ff;
    --alert-text: #5b21b6;
    --alert-border: #a855f7;
    --alert-icon-bg: #c084fc;
}

/* Border Styles */
.wp-custom-blocks-alert--border-left {
    border-left: 4px solid var(--alert-border);
    padding-left: 1.25rem;
}

.wp-custom-blocks-alert--border-full {
    border: 2px solid var(--alert-border);
}

.wp-custom-blocks-alert--border-top {
    border-top: 3px solid var(--alert-border);
    border-radius: 0 0 var(--alert-radius) var(--alert-radius);
}

.wp-custom-blocks-alert--border-none {
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

/* Animation for dismissible */
.wp-custom-blocks-alert[style*="display: none"] {
    animation: fadeOut 0.3s ease;
}

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

/* Dark mode support - using Tabs color scheme with alert variants */
body.wp-custom-blocks-blocks-dark-mode .wp-custom-blocks-alert--warning {
    --alert-background: #1f2937;   /* Tabs main background */
    --alert-text: #fbbf24;         /* Warm orange for warnings */
    --alert-border: #f59e0b;       /* Bright orange border */
    --alert-icon-bg: #374151;     /* Tabs elevated surface */
}

body.wp-custom-blocks-blocks-dark-mode .wp-custom-blocks-alert--info {
    --alert-background: #1f2937;   /* Tabs main background */
    --alert-text: #60a5fa;         /* Tabs accent blue */
    --alert-border: #3b82f6;       /* Blue border */
    --alert-icon-bg: #374151;     /* Tabs elevated surface */
}

body.wp-custom-blocks-blocks-dark-mode .wp-custom-blocks-alert--success {
    --alert-background: #1f2937;   /* Tabs main background */
    --alert-text: #34d399;         /* Fresh green for success */
    --alert-border: #10b981;       /* Green border */
    --alert-icon-bg: #374151;     /* Tabs elevated surface */
}

body.wp-custom-blocks-blocks-dark-mode .wp-custom-blocks-alert--error {
    --alert-background: #1f2937;   /* Tabs main background */
    --alert-text: #f87171;         /* Soft red for errors */
    --alert-border: #ef4444;       /* Red border */
    --alert-icon-bg: #374151;     /* Tabs elevated surface */
}

body.wp-custom-blocks-blocks-dark-mode .wp-custom-blocks-alert--tip {
    --alert-background: #1f2937;   /* Tabs main background */
    --alert-text: #a78bfa;         /* Purple for tips */
    --alert-border: #8b5cf6;       /* Purple border */
    --alert-icon-bg: #374151;     /* Tabs elevated surface */
}

/* Ensure dismiss button and all text elements are properly visible */
body.wp-custom-blocks-blocks-dark-mode .wp-custom-blocks-alert__dismiss {
    color: var(--alert-text) !important;
    opacity: 0.87; /* High emphasis in dark mode */
}

body.wp-custom-blocks-blocks-dark-mode .wp-custom-blocks-alert__dismiss:hover {
    opacity: 1 !important;
    color: var(--alert-text) !important;
}

/* Ensure all alert text is properly visible */
body.wp-custom-blocks-blocks-dark-mode .wp-custom-blocks-alert__content,
body.wp-custom-blocks-blocks-dark-mode .wp-custom-blocks-alert__content p,
body.wp-custom-blocks-blocks-dark-mode .wp-custom-blocks-alert__content h1,
body.wp-custom-blocks-blocks-dark-mode .wp-custom-blocks-alert__content h2,
body.wp-custom-blocks-blocks-dark-mode .wp-custom-blocks-alert__content h3,
body.wp-custom-blocks-blocks-dark-mode .wp-custom-blocks-alert__content h4,
body.wp-custom-blocks-blocks-dark-mode .wp-custom-blocks-alert__content h5,
body.wp-custom-blocks-blocks-dark-mode .wp-custom-blocks-alert__content h6 {
    color: var(--alert-text) !important;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .wp-custom-blocks-alert {
        --alert-padding: 0.75rem;
        --alert-gap: 0.625rem;
    }

    .wp-custom-blocks-alert__icon {
        font-size: 1.125rem;
        width: 1.75rem;
        height: 1.75rem;
    }

    .wp-custom-blocks-alert__title {
        font-size: 0.95rem;
    }

    .wp-custom-blocks-alert__text {
        font-size: 0.9rem;
    }
}

/* Print styles */
@media print {
    .wp-custom-blocks-alert {
        border: 1px solid var(--alert-border) !important;
        background: white !important;
    }

    .wp-custom-blocks-alert__dismiss {
        display: none;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .wp-custom-blocks-alert {
        border: 2px solid var(--alert-border) !important;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .wp-custom-blocks-alert[style*="display: none"] {
        animation: none;
    }
}