/**
 * Post Augments - Styles
 * Styling for sidebar widget, Spoiler, and NSFW MyCode blocks
 * 
 * @package Post Augments
 * @author Cuddly Dragon
 * @version 1.0.8
 */

/* ========================================
   Sidebar Widget (matches MyBB table style)
   ======================================== */
.post-augments-table {
    margin-top: 10px;
    table-layout: fixed;
    width: 168px;
    max-width: 168px;
}

.post-augments-table .thead {
    text-align: left;
    padding: 3px 6px !important;
    font-size: 11px;
}

.post-augments-table .trow1 {
    padding: 4px !important;
}

.post-augments-buttons {
    display: flex;
    gap: 3px;
    justify-content: center;
    align-items: center;
    padding: 2px 0;
}

.post-augment-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    padding: 0;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 3px;
    color: #333;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
}

.post-augment-btn:hover {
    background: #f0f0f0;
    border-color: #999;
    transform: translateY(-2px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.post-augment-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* GIF button text styling */
.post-augment-btn[data-action="giphy"] {
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 0.2px;
}

/* Specific button hover colors */
.post-augment-btn[data-action="spoiler"]:hover {
    background: #fff5e6;
    border-color: #ffb347;
}

.post-augment-btn[data-action="nsfw"]:hover {
    background: #ffe6e6;
    border-color: #ff6b6b;
}

.post-augment-btn[data-action="giphy"]:hover {
    background: #e6f3ff;
    border-color: #4fb4ff;
}

/* ========================================
   Spoiler - Simple black box with reveal
   ======================================== */
.spoiler {
    background: #000;
    color: transparent;
    padding: 4px 12px;
    margin: 2px 0;
    border-radius: 3px;
    cursor: pointer;
    user-select: none;
    transition: color 0.3s ease, background 0.2s ease;
    display: inline-block;
    min-width: 100px;
    position: relative;
    overflow: hidden;
}

.spoiler:hover {
    background: #111;
}

.spoiler.revealed {
    color: inherit;
    background: #1a1a1a;
    cursor: default;
    user-select: text;
}

/* Hide content in unrevealed spoilers - prevents text selection leaks */
.spoiler:not(.revealed) * {
    opacity: 0 !important;
    visibility: hidden !important;
}

/* ========================================
   NSFW - Block-level with blur effect
   ======================================== */
.nsfw {
    background: #1a1d24;
    border: 1px solid rgba(255, 100, 100, 0.4);
    border-radius: 4px;
    margin: 10px 0;
    overflow: hidden;
}

.nsfw_header {
    background: linear-gradient(to bottom, #3a2424 0%, #2a1818 100%);
    border-bottom: 1px solid rgba(255, 100, 100, 0.3);
    padding: 8px 12px;
    font-size: 11px;
    color: #ff6b6b;
    font-weight: bold;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s ease;
}

.nsfw_header:hover {
    background: linear-gradient(to bottom, #422828 0%, #321c1c 100%);
}

.nsfw_toggle {
    color: #888;
    font-style: italic;
    font-weight: normal;
}

.nsfw_content {
    padding: 12px;
    color: inherit;
    background: #16181d;
    filter: blur(20px);
    -webkit-filter: blur(20px);
    transition: filter 0.3s ease, -webkit-filter 0.3s ease;
    cursor: pointer;
    user-select: none;
}

.nsfw_content.revealed {
    filter: blur(0);
    -webkit-filter: blur(0);
    cursor: default;
    user-select: text;
}

/* ========================================
   GIPHY Overlay
   ======================================== */
.giphy-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
}

.giphy-overlay.is-open {
    display: flex;
}

.giphy-modal {
    background: #1a1d24;
    border-radius: 8px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.giphy-header {
    padding: 16px 20px;
    border-bottom: 1px solid #2a2d34;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.giphy-title {
    font-size: 18px;
    font-weight: bold;
    color: #fff;
    margin: 0;
}

.giphy-close {
    background: transparent;
    border: none;
    color: #888;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s ease, color 0.2s ease;
}

.giphy-close:hover {
    background: #2a2d34;
    color: #fff;
}

.giphy-search {
    padding: 16px 20px;
    border-bottom: 1px solid #2a2d34;
}

.giphy-search input {
    width: 100%;
    padding: 10px 12px;
    background: #0f1116;
    border: 1px solid #2a2d34;
    border-radius: 4px;
    color: #fff;
    font-size: 14px;
}

.giphy-search input:focus {
    outline: none;
    border-color: #4fb4ff;
}

.giphy-results {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    align-content: start;
}

.giphy-item {
    position: relative;
    cursor: pointer;
    border-radius: 4px;
    overflow: hidden;
    background: #0f1116;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.giphy-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(79, 180, 255, 0.3);
}

.giphy-item img {
    width: 100%;
    height: auto;
    display: block;
}

.giphy-loading,
.giphy-empty,
.giphy-error {
    padding: 40px 20px;
    text-align: center;
    color: #888;
    font-size: 14px;
}

/* ========================================
   Light Theme Support
   ======================================== */
body.light-theme .post-augments-sidebar {
    background: #fff;
}

body.light-theme .nsfw,
body.light-theme .giphy-modal {
    background: #f5f5f5;
    border-color: rgba(200, 50, 50, 0.3);
}

body.light-theme .nsfw_header {
    background: linear-gradient(to bottom, #ffe5e5 0%, #ffd0d0 100%);
    border-bottom-color: rgba(200, 50, 50, 0.2);
    color: #c00;
}

body.light-theme .nsfw_content {
    background: #fff;
    color: #333;
}

body.light-theme .giphy-header,
body.light-theme .giphy-search {
    border-color: #ddd;
}

body.light-theme .giphy-search input {
    background: #fff;
    border-color: #ccc;
    color: #333;
}
