/**
 * Card Oracle Gutenberg Block Styles
 * 
 * @package Card_Oracle
 * @since 1.1.9
 */

/* CSS Custom Properties */
:root {
    --card-oracle-primary: #8B4513;
    --card-oracle-bg: #f9f9f9;
    --card-oracle-border: #ccc;
    --card-oracle-text: #333;
    --card-oracle-text-light: #666;
    --card-oracle-text-lighter: #999;
    --card-oracle-error: #dc3232;
    --card-oracle-warning: #856404;
    --card-oracle-warning-bg: #fff3cd;
    --card-oracle-error-bg: #fef7f7;
    --card-oracle-success-bg: #fef7f0;
}

/* Block Preview Styles */
.card-oracle-block-preview {
    border: 1px solid var(--card-oracle-border);
    background-color: var(--card-oracle-bg);
    border-radius: 6px;
    padding: 16px;
    margin: 0;
    position: relative;
    overflow-x: auto;
}

.card-oracle-block-preview h4 {
    margin: 0 0 8px 0;
    color: var(--card-oracle-text-light);
    font-size: 16px;
    font-weight: 600;
}

.card-oracle-block-preview p {
    margin: 0 0 10px 0;
    color: var(--card-oracle-text);
    line-height: 1.5;
}

.card-oracle-block-preview code {
    font-size: 12px;
    color: var(--card-oracle-text-light);
    background-color: #f3f4f5;
    padding: 4px 8px;
    border-radius: 3px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    display: inline-block;
}

.card-oracle-block-preview__state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 24px 0;
    color: var(--card-oracle-text-light);
}

.card-oracle-block-preview__meta {
    margin-top: 16px;
    display: grid;
    gap: 8px;
    font-size: 13px;
    color: var(--card-oracle-text-lighter);
}

.card-oracle-block-preview__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.card-oracle-block-preview__feedback {
    font-size: 12px;
    color: var(--card-oracle-text-light);
}

.card-oracle-block-preview__feedback.is-success {
    color: #008a20;
}

.card-oracle-block-preview__feedback.is-error {
    color: var(--card-oracle-error);
}

.card-oracle-block__reading-defaults {
    margin: 0;
    padding-inline-start: 18px;
    font-size: 13px;
    color: var(--card-oracle-text);
}

.card-oracle-block__reading-defaults li {
    margin-bottom: 4px;
}

.card-oracle-block__reading-defaults strong {
    font-weight: 600;
    color: var(--card-oracle-text-light);
}

.card-oracle-block__reading-defaults--empty {
    margin: 0;
    font-size: 13px;
    color: var(--card-oracle-text-light);
}

.card-oracle-block__loading-hint {
    font-size: 12px;
    color: var(--card-oracle-text-lighter);
    margin: 12px 0 0;
}

/* State Classes */
.card-oracle-block-preview.has-reading {
    border-color: var(--card-oracle-primary);
    box-shadow: 0 0 0 1px rgba(139, 69, 19, 0.1);
}

.card-oracle-block-preview.is-loading {
    opacity: 0.75;
}

.card-oracle-block-preview.has-error {
    border-color: var(--card-oracle-error);
    background-color: var(--card-oracle-error-bg);
}

/* Inspector Controls Custom Styles */
.card-oracle-block .components-base-control__label {
    font-weight: 600;
    color: var(--card-oracle-text);
}

.card-oracle-block .components-select-control__input {
    border-radius: 4px;
}

.card-oracle-block .components-select-control__input:focus {
    border-color: var(--card-oracle-primary);
    box-shadow: 0 0 0 1px var(--card-oracle-primary);
}

/* Responsive Design */
@media (max-width: 782px) {
    .card-oracle-block-preview {
        padding: 15px;
    }
    
    .card-oracle-block-preview h4 {
        font-size: 14px;
    }
    
    .card-oracle-block-preview code {
        font-size: 11px;
        word-break: break-all;
    }
}

/* High Contrast Support */
@media (prefers-contrast: high) {
    .card-oracle-block-preview {
        border-width: 3px;
    }
    
    .card-oracle-block-preview.has-reading {
        border-color: var(--card-oracle-primary);
    }
    
    .card-oracle-block-preview.has-error {
        border-color: var(--card-oracle-error);
    }
}

/* Dark Mode Support — OS preference */
@media (prefers-color-scheme: dark) {
    :root {
        --card-oracle-bg: #2c2c2c;
        --card-oracle-border: #555;
        --card-oracle-text: #fff;
        --card-oracle-text-light: #ccc;
        --card-oracle-text-lighter: #aaa;
    }

    .card-oracle-block-preview code {
        background-color: #444;
        color: var(--card-oracle-text-light);
    }
}

/* Dark Mode Support — WordPress admin dark theme */
.interface-interface-skeleton__body[class*="is-dark-theme"] {
    --card-oracle-bg: #2c2c2c;
    --card-oracle-border: #555;
    --card-oracle-text: #fff;
    --card-oracle-text-light: #ccc;
    --card-oracle-text-lighter: #aaa;
}

.interface-interface-skeleton__body[class*="is-dark-theme"] .card-oracle-block-preview code {
    background-color: #444;
    color: var(--card-oracle-text-light);
}

/* IE11 Fallbacks */
.card-oracle-block-preview {
    border: 1px solid #ccc; /* Fallback */
    background-color: #f9f9f9; /* Fallback */
}

.card-oracle-block-preview h4 {
    color: #666; /* Fallback */
}

.card-oracle-block-preview p {
    color: #333; /* Fallback */
}
