/**
 * BookGram Plugin Wrapper Styles
 *
 * Provides CSS isolation and consistent styling for embedded plugins
 * while maintaining OS/2 Warp theme aesthetic
 */

/* === Plugin Wrapper Container === */
.bookgram-plugin-wrapper {
    display: block;
    margin: 20px 0;
    padding: 0;
    background: #ffffff;
    border: 2px solid #000080;
    box-shadow: 2px 2px 0 #000000;
    font-family: "MS Sans Serif", Tahoma, sans-serif;
    font-size: 11pt;
    color: #000000;
    position: relative;
}

/* === Plugin Content Container === */
.bookgram-plugin-wrapper .plugin-content {
    padding: 15px;
    background: #ffffff;
    min-height: 50px;
}

/* === Error Messages === */
.plugin-error {
    background: #ffcccc;
    border: 2px solid #cc0000;
    padding: 15px;
    color: #cc0000;
    font-weight: bold;
    margin: 10px;
    box-shadow: inset 1px 1px 0 #ff0000, inset -1px -1px 0 #990000;
}

.plugin-error::before {
    content: "⚠ ";
    font-size: 1.2em;
}

/* === Loading State === */
.bookgram-plugin-wrapper.loading {
    opacity: 0.6;
}

.bookgram-plugin-wrapper.loading::after {
    content: "Loading plugin...";
    display: block;
    text-align: center;
    padding: 20px;
    font-style: italic;
    color: #666666;
}

/* === Plugin Title Bar (Optional) === */
.bookgram-plugin-wrapper .plugin-title-bar {
    background: linear-gradient(to right, #000080, #1084d0);
    color: #ffffff;
    padding: 4px 8px;
    font-weight: bold;
    font-size: 10pt;
    border-bottom: 2px solid #000000;
}

/* === Responsive Design === */
@media (max-width: 768px) {
    .bookgram-plugin-wrapper {
        margin: 15px 0;
    }

    .bookgram-plugin-wrapper .plugin-content {
        padding: 10px;
    }
}

/* === Print Styles === */
@media print {
    .bookgram-plugin-wrapper {
        border: 1px solid #000000;
        box-shadow: none;
    }

    .plugin-error {
        border: 1px solid #cc0000;
        box-shadow: none;
    }
}

/* === Privacy Access Denied === */
.plugin-access-denied {
    background: #fff3cd;
    border: 2px solid #ff6600;
    padding: 20px;
    text-align: center;
    color: #856404;
}

.plugin-access-denied h3 {
    margin-top: 0;
    color: #ff6600;
}

.plugin-access-denied .access-form {
    margin-top: 15px;
}

.plugin-access-denied input[type="password"] {
    padding: 8px;
    width: 250px;
    border: 2px inset #c0c0c0;
    font-family: "MS Sans Serif", sans-serif;
}

.plugin-access-denied button {
    padding: 8px 16px;
    background: #c0c0c0;
    border: 2px outset #c0c0c0;
    font-family: "MS Sans Serif", sans-serif;
    cursor: pointer;
}

.plugin-access-denied button:active {
    border-style: inset;
}

/* ================================================
   HTML EMBED STYLES
   ================================================ */

/* === HTML Embed Wrapper === */
.bookgram-html-embed-wrapper {
    display: block;
    margin: 20px 0;
    padding: 0;
    border: 2px solid #808080;
    background: #ffffff;
    box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.3);
    position: relative;
}

/* === HTML Embed IFrame === */
.html-embed-iframe {
    display: block;
    width: 100%;
    border: none;
    background: #ffffff;
}

/* === HTML Embed Error Messages === */
.html-embed-error {
    padding: 15px;
    margin: 10px 0;
    background: #ffcccc;
    border: 2px solid #cc0000;
    color: #cc0000;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    font-weight: bold;
    box-shadow: inset 1px 1px 0 #ff0000, inset -1px -1px 0 #990000;
}

.html-embed-error::before {
    content: "⚠ ";
    font-size: 1.2em;
}

/* === Responsive Handling === */
@media screen and (max-width: 768px) {
    .bookgram-html-embed-wrapper {
        margin: 15px 0;
    }

    .html-embed-iframe {
        min-height: 400px;
    }
}

/* === Tablet Devices === */
@media screen and (max-width: 1024px) and (min-width: 769px) {
    .bookgram-html-embed-wrapper {
        margin: 18px 0;
    }
}

/* === Print Styles === */
@media print {
    .bookgram-html-embed-wrapper {
        page-break-inside: avoid;
        border: 1px solid #cccccc;
        box-shadow: none;
    }

    .html-embed-iframe {
        display: none;
    }

    .bookgram-html-embed-wrapper::after {
        content: "Interactive HTML content not available in print";
        display: block;
        padding: 10px;
        font-style: italic;
        color: #666666;
        text-align: center;
        background: #f0f0f0;
    }

    .html-embed-error {
        border: 1px solid #cc0000;
        box-shadow: none;
    }
}

/* === Custom Styling Classes === */
.centered-embed {
    margin-left: auto;
    margin-right: auto;
    max-width: 90%;
}

.full-width-embed {
    margin-left: 0;
    margin-right: 0;
    width: 100%;
}

.bordered-embed {
    border: 3px solid #000080;
    box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.5);
}

/* ================================================
   PHP EMBED STYLES
   ================================================ */

/* === PHP Embed Wrapper === */
.bookgram-php-embed-wrapper {
    display: block;
    margin: 20px 0;
    padding: 0;
    border: 2px solid #999999;
    background: #f0f0f0;
    box-shadow: 3px 3px 0 #666666;
    position: relative;
}

/* === PHP Embed IFrame === */
.php-embed-iframe {
    display: block;
    width: 100%;
    border: none;
    background: #ffffff;
}

/* === PHP Embed Error Messages === */
.php-embed-error {
    padding: 15px;
    margin: 10px;
    background: #ffebee;
    border: 2px solid #c62828;
    color: #c62828;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    font-weight: bold;
    box-shadow: inset 1px 1px 0 #ef5350, inset -1px -1px 0 #b71c1c;
}

.php-embed-error::before {
    content: "⚠ ";
    font-size: 1.2em;
}

/* === Parameter Controls === */
.php-embed-controls {
    background: #e0e0e0;
    border-bottom: 2px solid #999999;
    padding: 15px;
}

.php-param-form {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-end;
}

.param-control {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.param-control label {
    font-weight: bold;
    font-size: 12px;
    color: #333333;
    font-family: "MS Sans Serif", Tahoma, sans-serif;
}

.param-control select,
.param-control input[type="text"] {
    padding: 5px 10px;
    border: 2px inset #999999;
    background: #ffffff;
    font-family: "MS Sans Serif", Tahoma, sans-serif;
    font-size: 11pt;
    min-width: 150px;
}

.param-control input[type="range"] {
    min-width: 200px;
    cursor: pointer;
}

.param-control span {
    display: inline-block;
    margin-left: 10px;
    padding: 2px 8px;
    background: #ffffff;
    border: 2px inset #999999;
    min-width: 50px;
    text-align: center;
    font-family: "MS Sans Serif", Tahoma, sans-serif;
}

.update-btn {
    padding: 8px 20px;
    background: #c0c0c0;
    color: #000000;
    border: 2px outset #999999;
    cursor: pointer;
    font-weight: bold;
    font-family: "MS Sans Serif", Tahoma, sans-serif;
    font-size: 11pt;
}

.update-btn:hover {
    background: #d0d0d0;
}

.update-btn:active {
    border-style: inset;
    background: #a0a0a0;
}

/* === Responsive Styles === */
@media screen and (max-width: 768px) {
    .bookgram-php-embed-wrapper {
        margin: 15px 0;
    }

    .php-param-form {
        flex-direction: column;
        align-items: stretch;
    }

    .param-control select,
    .param-control input[type="text"],
    .param-control input[type="range"] {
        width: 100%;
        min-width: auto;
    }

    .param-control input[type="range"] {
        max-width: 100%;
    }

    .update-btn {
        width: 100%;
        margin-top: 10px;
    }
}

/* === Tablet Devices === */
@media screen and (max-width: 1024px) and (min-width: 769px) {
    .bookgram-php-embed-wrapper {
        margin: 18px 0;
    }

    .php-param-form {
        gap: 12px;
    }
}

/* === Print Styles === */
@media print {
    .bookgram-php-embed-wrapper {
        page-break-inside: avoid;
        border: 1px solid #cccccc;
        box-shadow: none;
    }

    .php-embed-controls {
        display: none;
    }

    .php-embed-iframe {
        display: none;
    }

    .bookgram-php-embed-wrapper::after {
        content: "Interactive PHP content not available in print";
        display: block;
        padding: 20px;
        font-style: italic;
        color: #666666;
        text-align: center;
        background: #f5f5f5;
        border: 1px solid #cccccc;
    }

    .php-embed-error {
        border: 1px solid #c62828;
        box-shadow: none;
    }
}

/* === Accessibility === */
.param-control select:focus,
.param-control input[type="text"]:focus,
.param-control input[type="range"]:focus {
    outline: 2px solid #0078d7;
    outline-offset: 2px;
}

.update-btn:focus {
    outline: 2px solid #0078d7;
    outline-offset: 2px;
}
