/*
=================================================================
    Main Stylesheet for Smart ePaper System
=================================================================
    - General Body & Theme
    - Dark Mode Theme
    - Frontend ePaper Viewer
    - Hotmap Highlight Styles
    - Modal & Canvas
    - Admin Panel Map Editor
=================================================================
*/

/* --- General Body & Theme --- */
body {
    transition: background-color 0.3s, color 0.3s;
}

/* --- Dark Mode Theme --- */
[data-bs-theme="dark"] {
    background-color: #212529;
    color: #dee2e6;
}
[data-bs-theme="dark"] .card,
[data-bs-theme="dark"] .list-group-item,
[data-bs-theme="dark"] .modal-content {
    background-color: #343a40;
    color: #f8f9fa;
    border-color: #495057;
}
[data-bs-theme="dark"] .list-group-item.active {
    background-color: #0d6efd;
    border-color: #0d6efd;
}
[data-bs-theme="dark"] a {
    color: #6ea8fe;
}

/* --- Frontend ePaper Viewer --- */
#epaper-container {
    cursor: grab;
    transition: background-color 0.3s;
}
#epaper-container:active {
    cursor: grabbing;
}
#zoom-container {
    transition: transform 0.2s ease-in-out;
    transform-origin: top left;
}
#epaper-viewer {
    overflow: hidden;
    line-height: 0; /* Removes bottom space under the image */
}

/* --- Hotmap Highlight Styles for Mapped Areas --- */

/* 1. Define the pulsing animation */
@keyframes pulse-glow {
    0% {
        box-shadow: 0 0 4px rgba(2, 117, 216, 0.5);
    }
    50% {
        box-shadow: 0 0 14px rgba(2, 117, 216, 0.9);
    }
    100% {
        box-shadow: 0 0 4px rgba(2, 117, 216, 0.5);
    }
}

/* 2. Style the mapped area to be visible by default */
.mapped-area {
    position: absolute;
    cursor: pointer;
    box-sizing: border-box; /* Ensures border is inside the box dimensions */

    /* Default visible state */
    background-color: rgba(2, 117, 216, 0.15); /* A very subtle blue background */
    border: 1px solid rgba(2, 117, 216, 0.6);   /* A clearly visible border */
    
    /* Apply the pulsing animation */
    animation: pulse-glow 3s infinite ease-in-out;

    /* Smooth transition for the hover effect */
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

/* 3. Style the hover state to be more prominent */
.mapped-area:hover {
    background-color: rgba(2, 117, 216, 0.4); /* Darker background on hover */
    
    /* Pause the animation on hover and set a static, stronger glow */
    animation: none;
    box-shadow: 0 0 15px rgba(2, 117, 216, 1);
}


/* --- Modal & Canvas --- */
#news-cutout-canvas {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}
.modal-xl {
    max-width: 90%;
}

/* --- Page Thumbnails --- */
.page-thumbnails .list-group-item {
    cursor: pointer;
}

/* --- Admin Panel Map Editor --- */

/* Container for the image and overlays */
#map-container {
    position: relative;
    display: inline-block; /* To wrap around the image */
    user-select: none; /* Prevent image dragging */
}
/* Change cursor when in drawing mode */
#map-container.drawing-mode {
    cursor: crosshair;
}

/* The main newspaper image */
#map-image {
    display: block;
    max-width: 100%;
    height: auto;
}

/* --- Styles for the ADVANCED Movable/Resizable Box (interact.js) --- */
.resizable-draggable {
    position: absolute;
    top: 0;
    left: 0;
    width: 200px;
    height: 150px;
    border: 2px dashed #0d6efd;
    background-color: rgba(13, 110, 253, 0.2);
    box-sizing: border-box;
    touch-action: none; /* for touch screens */
    cursor: move;
}
.box-control-btn {
    position: absolute;
    bottom: -40px; /* Position button below the box */
    left: 0;
    z-index: 20;
}

/* --- Styles for the OLD static boxes (still used to display saved areas) --- */
.map-box {
    position: absolute;
    border: 2px solid #ff0000;
    background-color: rgba(255, 0, 0, 0.3);
    box-sizing: border-box;
}
.map-box .delete-box {
    position: absolute;
    top: -12px;
    right: -12px;
    width: 24px;
    height: 24px;
    background: red;
    color: white;
    border-radius: 50%;
    text-align: center;
    line-height: 22px;
    cursor: pointer;
    font-weight: bold;
    font-family: monospace;
    font-size: 1.2rem;
    border: 2px solid white;
}