/**
 * Secure Links - Main Stylesheet
 *
 * Organized by component/section for maintainability.
 * As the plugin grows, consider splitting into:
 *   - viewer.css
 *   - editor.css
 *   - dashboard.css
 *   - common.css
 *
 * Current sections:
 *   - Upgrade / Payment
 *   - Editor
 *   - Viewer (general + comments)
 */

.sl-upgrade-wrapper {
    max-width: 520px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.sl-toggle {
    display: flex;
    background: #f1f1f1;
    border-radius: 9999px;
    padding: 4px;
    margin-bottom: 20px;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

.sl-toggle-btn {
    padding: 10px 24px;
    border: none;
    background: transparent;
    border-radius: 9999px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #555;
}

.sl-toggle-btn.active {
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    color: #111;
}

.sl-plan-card {
    background: #1f1f1f;
    color: #00de04;
    border: 2px solid #00de04;
    border-radius: 16px;
    padding: 28px 24px;
    text-align: center;
    margin-bottom: 20px;
}

.sl-plan-price {
    font-size: 28px;
    font-weight: 700;
    margin: 12px 0;
}

.sl-plan-duration {
    font-size: 15px;
    opacity: 0.85;
    margin-bottom: 16px;
}

.sl-pay-btn {
    background: #00de04;
    color: #111;
    border: none;
    padding: 14px 32px;
    font-size: 16px;
    font-weight: 700;
    border-radius: 9999px;
    cursor: pointer;
    width: 100%;
    max-width: 280px;
    transition: transform 0.2s ease;
}

.sl-pay-btn:hover {
    transform: translateY(-1px);
}

.sl-pay-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Expandable Benefits */
.sl-benefits-toggle {
    text-align: center;
    margin: 16px 0;
}

.sl-benefits-toggle button {
    background: none;
    border: none;
    color: #00de04;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 auto;
}

.sl-benefits-content {
    background: #161616;
    border: 1px solid #333;
    border-radius: 12px;
    padding: 16px 20px;
    margin-top: 8px;
    text-align: left;
    display: none;
}

.sl-benefits-content.open {
    display: block;
}

.sl-benefits-content ul {
    margin: 0;
    padding-left: 18px;
    line-height: 1.6;
}

.sl-benefits-content li {
    margin-bottom: 8px;
    font-size: 14px;
    color: #ddd;
}

/* Status messages */
.sl-status {
    text-align: center;
    margin-top: 16px;
    font-size: 14px;
    min-height: 40px;
    color: #ccc;
}

.sl-status a {
    color: #00de04;
    text-decoration: underline;
}

/* Mobile responsiveness */
@media (max-width: 480px) {
    .sl-plan-card {
        padding: 22px 18px;
    }
    
    .sl-toggle-btn {
        padding: 8px 18px;
        font-size: 14px;
    }
    
    .sl-plan-price {
        font-size: 24px;
    }
}

/* Basic styles for creation form */
.sl-create-form {
    max-width: 600px;
    margin: 20px 0;
}

.sl-create-form label {
    font-weight: 600;
    display: block;
    margin-bottom: 4px;
}

.sl-create-form input[type="text"],
.sl-create-form input[type="password"],
.sl-create-form textarea {
    border: 1px solid #444;
    background: #222;
    color: #eee;
    border-radius: 6px;
}

.sl-create-form .sl-btn {
    background: #00de04;
    color: #111;
    border: none;
    padding: 10px 24px;
    font-weight: 700;
    border-radius: 9999px;
    cursor: pointer;
}

/* ========================================
   EDITOR STYLES
   ======================================== */

/* Image wrappers inside the editor */
.sl-editor-content .sl-image-wrapper {
    position: relative;
    display: inline-block;
    margin: 8px 0;
    max-width: 100%;
    cursor: move;
    border: 1px dashed transparent;
}

.sl-editor-content .sl-image-wrapper:hover {
    border-color: #00de04;
}

/* Nice "pop up" lift effect when entering moving mode (especially on touch) */
.sl-editor-content .sl-image-wrapper.moving-mode {
    transform: scale(1.09) translateY(-6px);
    box-shadow: 0 16px 35px rgba(0, 0, 0, 0.45);
    transition: transform 0.1s ease-out, box-shadow 0.1s ease-out;
    z-index: 50;
    border-color: #00de04;
    border-style: solid;
}

/* Even stronger pop + "picked up" feel on touch devices */
@media (pointer: coarse) {
    .sl-editor-content .sl-image-wrapper.moving-mode {
        transform: scale(1.15) translateY(-10px) rotate(1deg);
        box-shadow: 0 25px 50px rgba(0, 0, 0, 0.55);
        border-color: #00de04;
        border-style: solid;
        transition: transform 0.08s ease-out, box-shadow 0.08s ease-out;
    }

    /* Hide controls while actively moving on mobile so it feels cleaner */
    .sl-editor-content .sl-image-wrapper.moving-mode .sl-image-controls {
        display: none !important;
    }
}

.sl-editor-content .sl-image-wrapper img {
    display: block;
    max-width: 100%;
    height: auto;
    user-select: none;
}

/* Resize handle */
.sl-editor-content .sl-image-wrapper .sl-resize-handle {
    position: absolute;
    right: -6px;
    bottom: -6px;
    width: 14px;
    height: 14px;
    background: #00de04;
    border: 2px solid #111;
    border-radius: 50%;
    cursor: nwse-resize;
    z-index: 10;
}

/* Bigger touch target on mobile */
@media (pointer: coarse) {
    .sl-editor-content .sl-image-wrapper .sl-resize-handle {
        width: 28px;
        height: 28px;
        right: -10px;
        bottom: -10px;
    }
}

/* Alignment controls that appear on hover */
.sl-editor-content .sl-image-wrapper .sl-image-controls {
    position: absolute;
    top: -26px;
    left: 0;
    display: none;
    background: #1f1f1f;
    border: 1px solid #444;
    border-radius: 6px;
    padding: 3px;
    z-index: 20;
    gap: 3px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* Show controls when image is selected (click/tap), or on hover for quick access */
.sl-editor-content .sl-image-wrapper:hover .sl-image-controls,
.sl-editor-content .sl-image-wrapper.selected .sl-image-controls {
    display: flex;
}

/* Auto-flipped toolbar placed below the image */
.sl-editor-content .sl-image-wrapper.toolbar-bottom .sl-image-controls {
    top: auto;
    bottom: -26px;
}

.sl-editor-content .sl-image-wrapper .sl-image-controls button {
    background: #333;
    color: #ddd;
    border: none;
    padding: 1px 7px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 4px;
    line-height: 1.1;
    transition: all 0.1s ease;
}

.sl-editor-content .sl-image-wrapper .sl-image-controls button:hover {
    background: #00de04;
    color: #111;
}

.sl-editor-content .sl-image-wrapper .sl-image-controls .delete-btn {
    background: #662222;
    color: #ffdddd;
    padding: 1px 6px;
    font-size: 13px;
}

.sl-editor-content .sl-image-wrapper .sl-image-controls .delete-btn:hover {
    background: #aa3333;
    color: white;
}

/* Show current alignment */
.sl-editor-content .sl-image-wrapper .sl-image-controls button.active {
    background: #00de04;
    color: #111;
    font-weight: 700;
}

/* Text wrapping styles */
.sl-editor-content .sl-image-wrapper.float-left {
    float: left;
    margin-right: 12px;
    margin-bottom: 8px;
}

.sl-editor-content .sl-image-wrapper.float-right {
    float: right;
    margin-left: 12px;
    margin-bottom: 8px;
}

.sl-editor-content .sl-image-wrapper.center {
    display: block;
    margin-left: auto;
    margin-right: auto;
    float: none;
}

.sl-editor-content .sl-image-wrapper.full {
    display: block;
    width: 100%;
    margin: 12px 0;
    float: none;
}

/* Editor content area base styles */
.sl-editor-content {
    min-height: 280px;
    padding: 20px;
    border: 1px solid #333;
    border-radius: 8px;
    background: #1a1a1a;
    color: #eee;
    outline: none;
    overflow: auto;
    line-height: 1.5;
    font-size: 15px;
}

.sl-editor-content:empty:before {
    content: attr(data-placeholder);
    color: #666;
}

/* Better text wrapping around images */
.sl-editor-content p,
.sl-editor-content div {
    margin: 0 0 12px 0;
}

.sl-editor-content::after {
    content: "";
    display: table;
    clear: both;
}

/* ========================================
   VIEWER STYLES - BASE
   ======================================== */

:root { --green: #00de04; }

body {
    margin: 0;
    background: #0a0a0a;
    color: #ddd;
    font-family: system-ui, -apple-system, sans-serif;
    line-height: 1.5;
}

/* General viewer container */
.sl-viewer {
    max-width: 960px;
    margin: 40px auto;
    padding: 20px;
}

.sl-viewer-header {
    text-align: center;
    margin-bottom: 20px;
}

.sl-viewer-header h1 {
    color: #fff;
    font-size: 22px;
    margin: 0 0 4px;
}

.sl-content {
    background: #111;
    border: 1px solid #222;
    border-radius: 10px;
    padding: 24px;
}

.sl-fixed-canvas {
    position: relative;
    margin: 0 auto;
    border: 1px dashed #333;
    background: #0d0d0d;
}

.sl-fixed-canvas .sl-image-wrapper {
    position: relative;
}

.sl-content img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Gallery styling */
.sl-gallery {
    position: relative;
    overflow: hidden;
    margin: 12px 0;
    border: 1px solid #333;
    border-radius: 6px;
    background: #0f0f0f;
}

.sl-gallery > * {
    margin: 0;
}

.sl-gallery:empty::after {
    content: "This gallery is currently empty. Images added to it will be swipeable in the viewer.";
    display: block;
    padding: 20px 12px;
    text-align: center;
    color: #888;
    font-size: 11px;
    font-style: italic;
    border: 1px dashed #333;
    margin: 6px;
    border-radius: 4px;
    background: #0a0a0a;
}

.sl-image-wrapper {
    display: inline-block;
    vertical-align: top;
    margin: 4px;
}

.sl-image-wrapper.float-left  { float: left; margin-right: 14px; }
.sl-image-wrapper.float-right { float: right; margin-left: 14px; }
.sl-image-wrapper.center { display: block; margin-left: auto; margin-right: auto; text-align: center; }
.sl-image-wrapper.full  { display: block; width: 100%; }

.sl-image-wrapper img {
    max-width: 100%;
    border-radius: 4px;
}

.sl-fixed-canvas {
    position: relative;
    margin: 0 auto;
    border: 1px dashed #333;
    background: #0d0d0d;
}

.sl-fixed-canvas .sl-image-wrapper {
    position: relative;
}

.sl-footer-note {
    text-align: center;
    margin-top: 30px;
    font-size: 11px;
    color: #444;
}

/* Viewer header elements */
.sl-viewer-header {
    text-align: center;
    margin-bottom: 20px;
}

#sl-countdown {
    font-size: 13px;
    color: #00de04;
    margin-top: 4px;
    font-family: monospace;
    background: rgba(0, 222, 4, 0.08);
    padding: 2px 8px;
    border-radius: 4px;
    display: inline-block;
}

.sl-copy-btn {
    margin-top: 10px;
    background: #222;
    color: #00de04;
    border: 1px solid #00de04;
    padding: 5px 14px;
    border-radius: 999px;
    font-size: 12px;
    cursor: pointer;
}

/* ========================================
   VIEWER - EXTRA ENCRYPTION GATE
   ======================================== */

#sl-decrypt-gate {
    max-width: 420px;
    margin: 60px auto;
    background: #111;
    border: 1px solid #00de04;
    border-radius: 12px;
    padding: 28px;
    text-align: center;
}

#sl-decrypt-gate h2 {
    color: #00de04;
    margin: 0 0 8px;
}

#sl-decrypt-pass {
    width: 100%;
    padding: 12px;
    background: #1a1a1a;
    color: #eee;
    border: 1px solid #444;
    border-radius: 6px;
    font-size: 15px;
    margin-bottom: 12px;
    box-sizing: border-box;
}

#sl-decrypt-btn {
    background: #00de04;
    color: #111;
    border: none;
    padding: 12px 32px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    width: 100%;
}

#sl-decrypt-error {
    color: #ff6666;
    margin-top: 10px;
    font-size: 13px;
    display: none;
}

.sl-content img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ========================================
   VIEWER STYLES - EPHEMERAL COMMENTS
   ======================================== */

#sl-comments-section {
    margin-top: 30px;
    border-top: 1px solid #222;
    padding-top: 20px;
}

#sl-comments-section > div:first-child {
    font-weight: 600;
    margin-bottom: 8px;
    color: #00de04;
    font-size: 14px;
}

#sl-comments-list {
    max-height: 240px;
    overflow: auto;
    margin-bottom: 10px;
    font-size: 13px;
    line-height: 1.4;
}

#sl-comments-list > div {
    background: #1a1a1a;
    padding: 7px 10px;
    border-radius: 5px;
    margin-bottom: 5px;
    border-left: 3px solid #00de04;
}

#sl-comments-list strong {
    color: #00de04;
    font-size: 12px;
}

#sl-no-comments {
    color: #888;
    font-size: 12px;
    font-style: italic;
    padding: 8px 10px;
    border-left: 3px solid #333;
    background: #1a1a1a;
    border-radius: 4px;
}

#sl-comments-section input[type="text"] {
    background: #1a1a1a;
    border: 1px solid #333;
    color: #eee;
    padding: 6px 8px;
    border-radius: 4px;
    font-size: 13px;
}

#sl-comments-section button {
    background: #00de04;
    color: #111;
    border: none;
    padding: 6px 16px;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    font-size: 13px;
}

#sl-comment-status {
    font-size: 11px;
    color: #666;
    margin-top: 4px;
}
