/* Senior Citizen E-Magazine - Main Styles */

:root {
    --scem-bg: #ffffff;
    --scem-text: #222222;
    --scem-toolbar-bg: #f0f0f1;
    --scem-btn-bg: #0073aa;
    --scem-btn-text: #ffffff;
    --scem-border: #cccccc;
}

.scem-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    background: var(--scem-bg);
    color: var(--scem-text);
    border: 1px solid var(--scem-border);
    max-width: 100%;
    margin: 20px auto;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* High Contrast Mode */
.scem-container.high-contrast {
    --scem-bg: #000000;
    --scem-text: #ffff00;
    /* Yellow on Black for max visibility */
    --scem-toolbar-bg: #333333;
    --scem-btn-bg: #feea03;
    /* Bright Yellow */
    --scem-btn-text: #000000;
    --scem-border: #ffffff;
}

/* Toolbar */
.scem-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    background: var(--scem-toolbar-bg);
    padding: 10px;
    border-top: 2px solid var(--scem-border);
    gap: 10px;
}

.scem-toolbar-group {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Typography for Page Info */
.scem-page-info {
    font-size: 18px;
    font-weight: bold;
    padding: 0 10px;
    white-space: nowrap;
}

/* Buttons */
.scem-btn {
    background: var(--scem-btn-bg);
    color: var(--scem-btn-text);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    text-decoration: none;
    transition: transform 0.1s;
}

.scem-btn:hover {
    opacity: 0.9;
}

.scem-btn:active {
    transform: scale(0.96);
}

.scem-btn .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
    margin: 0 4px;
}

/* Button Sizes */
.scem-size-normal .scem-btn {
    height: 40px;
    padding: 0 15px;
    font-size: 16px;
}

.scem-size-large .scem-btn {
    height: 48px;
    padding: 0 20px;
    font-size: 18px;
}

.scem-size-xlarge .scem-btn {
    height: 60px;
    padding: 0 25px;
    font-size: 22px;

}

.scem-size-xlarge .scem-btn .dashicons {
    font-size: 28px;
    width: 28px;
    height: 28px;
}

/* Canvas / PDF Area */
.scem-canvas-wrapper {
    width: 100%;
    overflow: auto;
    /* Allow scrolling if zoomed very large */
    text-align: center;
    padding: 20px;
    background: #dedede;
    /* Contrast backdrop from page */
    min-height: 400px;
    position: relative;
}

.scem-container.high-contrast .scem-canvas-wrapper {
    background: #111;
}

.scem-container.high-contrast canvas#scem-pdf-render {
    filter: invert(1);
}

canvas#scem-pdf-render {
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
    max-width: 100%;
    height: auto;
    display: inline-block;
}

/* Loading Spinner */
#scem-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 20px;
    font-weight: bold;
    background: rgba(255, 255, 255, 0.9);
    padding: 20px;
    border-radius: 8px;
    display: none;
    /* JS toggles this */
}

/* Loading Spin Animation */
.spin {
    animation: scem-spin 2s infinite linear;
    display: inline-block;
}

@keyframes scem-spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Mobile Responsiveness */
@media (max-width: 600px) {
    .scem-toolbar {
        justify-content: center;
        padding: 5px;
    }

    .scem-toolbar-group {
        margin-bottom: 5px;
    }

    /* User requested LABELS to be visible on mobile too. */
    /* We reduce padding slightly to fit, but keep text. */
    .scem-opts-group .scem-btn {
        /* font-size: 0; removed to keep text visible */
        padding: 0 8px;
        font-size: 14px;
    }

    .scem-opts-group .scem-btn .dashicons {
        margin: 0 2px;
        font-size: 20px;
    }

    /* Prioritize Prev/Next */
    .scem-nav-group {
        width: 100%;
        justify-content: space-between;
        order: 1;
        margin-bottom: 5px;
    }

    .scem-zoom-group {
        order: 2;
    }

    .scem-opts-group {
        order: 3;
    }
}

/* Fullscreen Mode override */
body.scem-fullscreen-active {
    overflow: hidden;
}

body.scem-fullscreen-active .scem-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 99999;
    margin: 0;
    border: none;
    display: flex;
    flex-direction: column;
}

body.scem-fullscreen-active .scem-canvas-wrapper {
    flex: 1;
    overflow: auto;
}