/*
    -------------------------
    Button Styles
    -------------------------
*/
 
/* Container for all Buttons in a row */
.button-row {
    display: none; /* Hidden by default - shown on arrow click */
    flex-direction: row;
    flex-wrap: nowrap; /* Keep all in one row until absolutely necessary */
    justify-content: center; /* Center align horizontally */
    align-items: flex-start; /* Align to top (prevents tooltip from pushing layout) */
    gap: 0.8rem; /* Even spacing between buttons */
    overflow-x: auto; /* Allow horizontal scroll on small screens */
    scrollbar-width: none; /* Hide scrollbar (for cleaner look) */
    padding: 0.75rem 0 0 0; /* Top padding for breathing room, no bottom padding */
    margin-top: 0.75rem; /* Reduced from 1rem - integrate better with article */
    width: 100%;
    background: transparent; /* No separate background */
    border: none; /* No border - existing separator line handles visual separation */
}

.button-row::-webkit-scrollbar {
    display: none; /* Hide scrollbar in WebKit browsers */
}

/*
    -------------------------
    Standardized Button Dimensions
    -------------------------
*/
.button-row button,
.button-row .mark-read-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    height: 46px; /* Uniform height */
    min-width: 120px; /* Prevent very small buttons */
    max-width: 160px; /* Prevent long ones from expanding too much */
    flex: 1 1 auto; /* Allow balanced scaling */
    padding: 10px 14px;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 12px;
    white-space: nowrap; /* Prevent text wrapping inside buttons */
    box-sizing: border-box;
    transition: all 0.2s ease;
}

/* Hover/active feedback */
.button-row button:hover {
    transform: scale(1.05);
}

/*
    -------------------------
    Mark as Read Button Styling
    -------------------------
*/
.mark-read-wrapper {
    display: flex;
    align-items: center;
    gap: 4px;
    position: relative;
}

.read-button {
    background-color: #fadbd8;
    color: #e74c3c;
    border: 2px solid #e74c3c;
    cursor: pointer;
    box-shadow: 1px 1px 2px rgba(0,0,0,0.1);
    width: 100%;
}

.read-button.read-done {
    border-color: #2ecc71;
    color: #2ecc71;
    background-color: rgba(46, 204, 113, 0.1);
    border-radius: 20px;
    cursor: not-allowed;
}

.read-button .read-text {
    white-space: nowrap;
}

.read-icon {
    width: 18px;
    height: 18px;
    stroke-width: 2.2;
    vertical-align: middle;
}

.ticks {
    font-size: 16px;
    color: #2ecc71;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.ticks.visible {
    opacity: 1;
}

/*
    -------------------------
    Read Button - Collapsed Tile State
    -------------------------
    When tile is collapsed, only Read button remains visible
    Matches behavior from ethics_essays_poll.html
*/
.article-tile[data-expanded="false"] .button-row {
    display: flex !important; /* Override default display: none */
    justify-content: center;
    padding: 0.5rem 0;
    margin-top: 0.5rem;
}

.article-tile[data-expanded="false"] .button-row > *:not(.mark-read-wrapper) {
    display: none !important; /* Hide all other buttons when collapsed */
}

.article-tile[data-expanded="false"] .mark-read-wrapper {
    display: flex !important; /* Keep Read button visible */
    margin: 0 auto;
}

.article-tile[data-expanded="false"] .read-button {
    min-width: 100px;
    max-width: 140px;
    height: 40px;
    font-size: 0.85rem;
    padding: 8px 12px;
}

/*
    -------------------------
    Action Buttons Styling
    -------------------------
*/
/* Shared Styling for the other buttons */
.action-btn {
    background-color: transparent;
    border: 2px solid #e74c3c;
    color: #e74c3c;
    cursor: not-allowed;
    position: relative;
    box-shadow: 1px 1px 2px rgba(0,0,0,0.1);
    pointer-events: none;
    opacity: 0.6;
}

.action-btn.enabled {
    cursor: pointer;
    pointer-events: auto;
    opacity: 1;
}

.action-btn:hover {
    border-color: #c0392b;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    transform: scale(1.05);
}
 
.action-btn:active {
    transform: scale(0.98);
}

/* Styles for the clicked state */
.action-btn.voted, .action-btn.saved, .action-btn.clicked, .action-btn.summarized {
    background-color: rgba(46, 204, 113, 0.1);
    border-color: #2ecc71;
    color: #2ecc71;
}

.action-btn.voted:hover, .action-btn.saved:hover, .action-btn.clicked:hover, .action-btn.summarized:hover {
    border-color: #27ae60;
}
 
/* SVG Icon Styling */
.action-btn svg,
.action-btn i {
    height: 18px;
    width: 18px;
    font-size: 1.1rem;
    vertical-align: middle;
}
 
.action-btn .icon-path {
    fill: #e74c3c;
    stroke: #e74c3c;
    stroke-width: 2;
    transition: fill 0.3s, stroke 0.3s;
}
 
.action-btn.enabled.voted .icon-path,
.action-btn.enabled.saved .icon-path,
.action-btn.enabled.clicked .icon-path,
.action-btn.enabled.summarized .icon-path {
    fill: #2ecc71;
    stroke: #2ecc71;
}

/*
    -------------------------
    Tooltip Styling
    -------------------------
*/
/* Default Tooltip Styles (Dark Theme) */
.action-btn .tooltip {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    background-color: #333;
    color: #fff;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    transition: opacity 0.3s, visibility 0.3s;
    z-index: 10;
}
.action-btn:hover .tooltip {
    visibility: visible;
    opacity: 1;
}
.action-btn .tooltip::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #333 transparent transparent transparent;
}

/* Specific Reminder Button Tooltip (Pink Theme) */
.action-btn .reminder-tooltip {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    width: max-content;
    background-color: #ffe4e6;
    color: #333;
    text-align: center;
    border-radius: 6px;
    padding: 1px 8px;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%);
    transition: opacity 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    font-weight: 500;
    white-space: pre;
    pointer-events: none;
    z-index: 10;
}
.action-btn:hover .reminder-tooltip {
    visibility: visible;
    opacity: 1;
}
.action-btn .reminder-tooltip::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #ffe4e6 transparent transparent transparent;
}
 
/* Specific Styles for the Bookmark Button's Tooltips */
.action-btn .bookmark-tooltip {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    background-color: #333;
    color: #fff;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    transition: opacity 0.3s, visibility 0.3s;
    z-index: 10;
}
.action-btn:not(.saved):hover .bookmark-tooltip.initial {
    visibility: visible;
    opacity: 1;
}
.action-btn.saved:hover .bookmark-tooltip.saved {
    visibility: visible;
    opacity: 1;
}
.action-btn .bookmark-tooltip::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #333 transparent transparent transparent;
}
.action-btn .red-highlight {
    color: #fe2c55;
    font-weight: 600;
}

/*
    -------------------------
    Summary Modal - Sticky Note Design
    -------------------------
*/
.summary-container {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(var(--sticky-rotation, 0deg));
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    background-color: var(--sticky-color, #fff8a5);
    border: none;
    border-radius: 3px;
    /* 3D paper shadow effect */
    box-shadow:
        0 1px 3px rgba(0,0,0,0.12),
        0 4px 8px rgba(0,0,0,0.1),
        0 8px 16px rgba(0,0,0,0.08),
        inset 0 1px 0 rgba(255,255,255,0.5);
    z-index: 2000;
    padding: 0;
    flex-direction: column;
    overflow: hidden;
}

.summary-container.visible {
    display: flex;
}

/* Tape effect at top */
.summary-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 25px;
    background: rgba(255, 255, 255, 0.3);
    border-left: 1px solid rgba(0, 0, 0, 0.05);
    border-right: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 10;
    pointer-events: none;
}

/* Ink bleed texture effect */
.summary-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(circle at 20% 30%, rgba(0,0,0,0.02) 1px, transparent 1px),
        radial-gradient(circle at 80% 70%, rgba(0,0,0,0.02) 1px, transparent 1px),
        radial-gradient(circle at 40% 80%, rgba(0,0,0,0.015) 1px, transparent 1px);
    background-size: 50px 50px, 80px 80px, 100px 100px;
    pointer-events: none;
    z-index: 1;
    border-radius: 3px;
}

/* Smooth dropdown animation */
@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px) rotate(var(--sticky-rotation, 0deg));
    }
    to {
        opacity: 1;
        transform: translateY(0) rotate(var(--sticky-rotation, 0deg));
    }
}

/* Close Button - Absolute top-right corner, RED */
.summary-container .close-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(220, 53, 69, 0.1);
    border: none;
    font-size: 1rem;
    color: #dc3545;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 20;
    line-height: 1;
    font-weight: bold;
}

.summary-container .close-btn:hover {
    background: rgba(220, 53, 69, 0.2);
    color: #c82333;
}

/* Tape Header - Centered title on tape, positioned lower */
.summary-tape-header {
    text-align: center;
    padding: 1.8rem 1rem 0.4rem 1rem;
    position: relative;
    z-index: 15;
    font-family: 'Segoe UI', 'Arial', sans-serif;
}

.summary-tape-header .header-title {
    display: block;
    font-weight: bold;
    font-size: 0.95rem;
    color: #1f2937;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
    margin-bottom: 3px;
}

.summary-tape-header .header-article-name {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #1f2937;
    max-width: 280px;
    margin: 0 auto;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Meta Row - Date left, Word count right */
.summary-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    font-family: 'Segoe UI', 'Arial', sans-serif;
    position: relative;
    z-index: 5;
}

.summary-meta-row .meta-date {
    font-size: 0.8rem;
    color: #64748b;
    font-weight: normal;
}

.summary-meta-row .meta-word-count {
    font-size: 0.75rem;
    color: #64748b;
    font-weight: normal;
}

.summary-meta-row .meta-word-count.error {
    color: #e74c3c;
    font-weight: bold;
}

/* OLD HEADER STYLES - Kept for backwards compatibility */
.summary-header {
    display: none; /* Hidden - using new layout */
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    background-color: transparent;
    color: #1f2937;
    font-weight: bold;
    font-size: 1rem;
    padding: 1.5rem 1rem 0.75rem 1rem;
    border-bottom: none;
    position: relative;
    z-index: 5;
}

.header-left {
    justify-self: start;
    font-family: 'Segoe UI', 'Arial', sans-serif;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.header-left .header-title {
    font-weight: bold;
    font-size: 1rem;
    color: #1f2937;
}

.header-left .header-article-name {
    font-size: 0.75rem;
    font-weight: normal;
    color: rgba(0, 0, 0, 0.45);
    font-style: italic;
    max-width: 180px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-center {
    justify-self: center;
    font-size: 0.85rem;
    color: #64748b;
    font-weight: normal;
    font-family: 'Segoe UI', 'Arial', sans-serif;
}

.header-right {
    justify-self: end;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.summary-header .word-count-info {
    font-size: 0.75rem;
    color: #64748b;
    font-weight: normal;
    font-family: 'Segoe UI', 'Arial', sans-serif;
}

.summary-header .word-count-info.error {
    color: #e74c3c;
    font-weight: bold;
}

.summary-header .close-btn {
    background: none;
    border: none;
    font-size: 1.8rem;
    color: #e74c3c;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.summary-header .close-btn:hover {
    background: rgba(239, 68, 68, 0.15);
    transform: scale(1.1);
}

/* Sticky Note Body Container */
.summary-body-container {
    position: relative;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    z-index: 5;
}

/* Sticky Note Textarea */
textarea.summary-body {
    flex-grow: 1;
    min-height: 200px;
    padding: 1rem 1rem 4rem 1rem;
    font-size: 0.95rem;
    line-height: 1.6rem;
    resize: none;
    border: none;
    outline: none;
    background: transparent;
    background-image: repeating-linear-gradient(
        to bottom, transparent, transparent 23px, rgba(0,0,0,0.08) 24px
    );
    background-position: 0 14px;
    font-family: 'Segoe UI', 'Comic Sans MS', 'Arial', sans-serif;
    color: #1f2937;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
}

/* Placeholder styling - centered, smaller, dimmed, italic */
textarea.summary-body::placeholder {
    font-size: 0.72rem;
    color: rgba(0, 0, 0, 0.32);
    font-style: italic;
    text-align: center;
    font-weight: 400;
    line-height: 1.6;
}

/* Sticky Note Save Button */
.summary-save-chip-btn {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    background: #fc7306;
    color: white;
    border: none;
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(252, 115, 6, 0.25);
    z-index: 10;
    font-family: 'Segoe UI', 'Arial', sans-serif;
}

.summary-save-chip-btn:hover {
    background: #e45e00;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(252, 115, 6, 0.35);
}

.summary-save-chip-btn:active {
    transform: translateY(0);
}

/* Sticky Note Footer - minimal reminder */
.summary-footer {
    padding: 0.6rem 1rem;
    background: transparent;
    border-radius: 0 0 3px 3px;
    font-size: 0.7rem;
    color: rgba(0, 0, 0, 0.35);
    text-align: center;
    border-top: 1px dashed rgba(0, 0, 0, 0.08);
    position: relative;
    z-index: 5;
    font-family: 'Segoe UI', 'Arial', sans-serif;
    font-style: italic;
}

/* Get Your Notes Button Label - no longer used but kept for backwards compatibility */
.get-notes-label {
    display: none; /* Hidden - simplified footer */
    padding: 0.3rem 0.6rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    margin: 0 0.25rem;
    cursor: not-allowed;
    opacity: 0.9;
    font-family: 'Segoe UI', 'Arial', sans-serif;
}

/*
    -------------------------
    Refer Button Styles (Icon-Only with Instagram Gradient Border)
    -------------------------
*/
.refer-btn {
    background: white; /* Pure white background */
    color: #24A1DE;
    border: 1px solid #24A1DE; /* Simple blue border (no Instagram gradient) */
    cursor: pointer;
    box-shadow: 1px 1px 2px rgba(0,0,0,0.1);
    padding: 8px;
    border-radius: 8px;
    display: flex;
    flex-direction: row; /* Horizontal layout: text left, icon right */
    align-items: center;
    justify-content: space-between; /* Space between text and icon */
    gap: 6px; /* Gap between text and icon */
    /* Inherit standard button sizing: height 46px, min-width 120px, max-width 160px, flex 1 1 auto */
    /* No transition - no hover effects */
}

/* No hover effect - removed */
/* No active effect - removed */

/* Text container - stacks text vertically */
.refer-text-container {
    display: flex;
    flex-direction: column; /* Stack "Refer" and "Article" vertically */
    align-items: flex-start; /* Align text to left */
    line-height: 1.1;
}

/* Individual text lines */
.refer-line-1,
.refer-line-2 {
    font-size: 8px;
    font-weight: 600;
    color: #24A1DE;
    white-space: nowrap;
}

/* Styling for the Refer icon (icon-only button in button row) */
.refer-icon {
    width: 36px;
    height: 36px;
    display: block;
    flex-shrink: 0; /* Prevent icon from shrinking */
}

/*
    -------------------------
    Smart Refer Button - Highlight Indicator
    -------------------------
    When user has made highlights, button shows visual indicator
*/
.refer-btn.has-highlights {
    background: linear-gradient(135deg, #fffef7 0%, #fff9b0 100%); /* Subtle yellow glow */
    border-color: #ffc107; /* Golden border */
    box-shadow: 0 0 12px rgba(255, 193, 7, 0.4); /* Yellow glow effect */
    position: relative;
}

/* Badge indicator for highlighted content */
.refer-btn.has-highlights::after {
    content: '✨';
    position: absolute;
    top: -6px;
    right: -6px;
    font-size: 14px;
    background: #fff9b0;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #ffc107;
    animation: pulse 2s ease-in-out infinite;
}

/* Pulse animation for highlight badge */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

/* Disabled state - button greyed out until user makes highlights */
.refer-btn:disabled,
.refer-btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f5f5f5;
    border-color: #ccc;
    color: #999;
    box-shadow: none;
}

.refer-btn:disabled:hover,
.refer-btn[disabled]:hover {
    transform: none;
    box-shadow: none;
}

/*
    -------------------------
    Sidebar Refer Icon (Top-Right Corner of Article Tiles)
    -------------------------
    This icon shares personalized URL with user's highlights
    (different from button row refer which shares standard article)
*/
.refer-icon-sidebar {
    position: absolute;
    top: 12px;
    right: 12px;
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    display: none; /* Hidden by default, shown via JS when tile expands */
    z-index: 10; /* Above other tile content */
    transition: all 0.2s ease;
    /* Instagram gradient border (very faint) - same as button row */
    background-image:
      linear-gradient(transparent, transparent),
      linear-gradient(45deg, rgba(240, 148, 51, 0.2) 0%, rgba(230, 104, 60, 0.2) 25%, rgba(220, 39, 67, 0.2) 50%, rgba(204, 35, 102, 0.2) 75%, rgba(188, 24, 136, 0.2) 100%);
    background-origin: border-box;
    background-clip: padding-box, border-box;
    box-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

.refer-icon-sidebar:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    transform: scale(1.05);
}

.refer-icon-sidebar:active {
    transform: scale(0.98);
}

/* Styling for the icon image inside sidebar refer button */
.refer-icon-sidebar .refer-icon-img {
    width: 48px;
    height: 48px;
    display: block;
}

/*
    -------------------------
    Refer Highlights Strip (Fixed Right Edge)
    -------------------------
    VISUAL IMPLEMENTATION ONLY - Functionality to be added later

    PURPOSE:
    - URL-tracking share tool that captures window.location.href when clicked
    - Always visible strip at right edge of screen (desktop/tablet only)
    - Greyed out by default, activates when highlights are made

    FUTURE FUNCTIONALITY:
    - Detect URL changes when highlights are made (URL will contain highlight params)
    - Remove 'disabled' attribute when URL contains highlight data
    - Click handler will read window.location.href and share personalized URL
    - Integration with highlight system (script.js + ethics_essays_articles.js)
*/

/* Container - Fixed to right edge, vertically centered */
.refer-strip-container {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1000; /* Above all content */
    display: block; /* Visible on desktop/tablet */
}

/* Strip button - Vertical layout with icon + text */
.refer-strip-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 8px;
    background: transparent;
    border: 2px solid #24A1DE; /* Blue border */
    border-radius: 8px 0 0 8px; /* Rounded left edge only */
    cursor: pointer;
    transition: all 0.3s ease;
    width: 80px;
    min-height: 100px;
}

/* Disabled state - Greyed out button but KEEP text/icons visible */
.refer-strip-btn:disabled {
    border-color: #ccc;
    opacity: 0.5;
    cursor: not-allowed;
}

/* FORCE text to stay black even when disabled */
.refer-strip-btn:disabled .refer-strip-text {
    opacity: 1 !important;
    color: #000 !important; /* Black text always */
}

/* FORCE SVG icons to stay visible when disabled */
.refer-strip-btn:disabled svg {
    opacity: 1 !important;
}

/* Active state - Full color when enabled */
.refer-strip-btn:not(:disabled) {
    border-color: #24A1DE;
    opacity: 1;
}

/* Hover effect (only when enabled) */
.refer-strip-btn:not(:disabled):hover {
    background-color: rgba(36, 161, 222, 0.05);
    box-shadow: -2px 0 8px rgba(36, 161, 222, 0.2);
    transform: translateX(-2px);
}

/* Active/click effect */
.refer-strip-btn:not(:disabled):active {
    transform: translateX(-4px);
    background-color: rgba(36, 161, 222, 0.1);
}

/* Icon styling */
.refer-strip-icon {
    width: 32px;
    height: 32px;
    display: block;
}

/* Text styling */
.refer-strip-text {
    font-size: 10px;
    font-weight: 600;
    color: #24A1DE;
    text-align: center;
    line-height: 1.2;
    letter-spacing: 0.5px;
}

/* Override: Keep text BLACK when button is disabled (removed old grey rule) */
.refer-strip-btn:disabled .refer-strip-text {
    color: #000 !important; /* Force black */
}

/* Caption block below button - ALWAYS VISIBLE */
.refer-caption {
    position: fixed;
    right: 0;
    top: calc(50% + 65px); /* Below the button */
    background: #fff;
    border: 2px solid #fc7306; /* Orange border */
    border-radius: 8px 0 0 8px;
    padding: 10px 8px;
    width: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    z-index: 999; /* Below button but above content */
}

/* Main caption text - ALWAYS BLACK AND BOLD */
.caption-main {
    font-size: 11px;
    font-weight: 700;
    color: #000 !important; /* Always black */
    text-align: center;
    line-height: 1.3;
}

/* Thank you text - RED with emoji */
.caption-thanks {
    font-size: 10px;
    font-weight: 700;
    color: #dc3545 !important; /* Always red */
    text-align: center;
    display: block;
    margin-top: 4px;
}

/* ===== ORIENTATION-AWARE SIDEBAR DISPLAY ===== */

/* DESKTOP: Always show sidebar (>1024px) */
@media (min-width: 1025px) {
    .refer-strip-container {
        display: block !important;
    }
}

/* TABLETS & PHONES: Orientation-based display */

/* Tablet + Phone Landscape: Show sidebar (768px-1024px in landscape) */
/* NOTE: This includes phones (768-850px) - they get special caption hiding below */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: landscape) {
    .refer-strip-container {
        display: block !important;
    }
}

/* Tablet Portrait: Hide sidebar (iPad 10.2" portrait = ~820px) */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: portrait) {
    .refer-strip-container {
        display: none !important;
    }
}

/* MOBILE: Always hide sidebar (<768px) - phones in any orientation */
@media (max-width: 767px) {
    .refer-strip-container {
        display: none !important;
    }
}

/* ===== TABLET-SPECIFIC ADJUSTMENTS (8" & 10.2" iPad) ===== */
/* Reduce padding and width to prevent bottom border cutoff */
/* NOTE: Starts at 851px to avoid conflicting with phone landscape (768-850px) */
@media (min-width: 851px) and (max-width: 1024px) and (orientation: landscape) {
    /* Shift container slightly left to show full border */
    .refer-strip-container {
        right: -3px; /* Move 3px left */
    }

    /* Reduce button width and padding */
    .refer-strip-btn {
        width: 72px; /* Was 80px - saves 8px */
        padding: 10px 5px; /* Was 12px 8px - saves 6px horizontal */
    }

    /* Match caption width to button */
    .refer-caption {
        width: 72px; /* Was 80px */
        padding: 8px 5px; /* Was 10px 8px - saves 6px horizontal */
        top: calc(50% + 60px); /* Slightly closer - was 65px */
    }

    /* Slightly reduce text sizes for compact fit */
    .refer-strip-text {
        font-size: 9px; /* Was 10px */
    }

    .caption-main {
        font-size: 10px; /* Was 11px */
        line-height: 1.2; /* Was 1.3 - more compact */
    }

    .caption-thanks {
        font-size: 9px; /* Was 10px */
    }
}

/* ===== TRIAL COMPLETION LOGIC: GRADUAL SIDEBAR REMOVAL ===== */

/* AFTER TRIAL: Hide entire sidebar on phones and small tablets (8") */
/* User has referred enough people - referral no longer needed on small screens */
body.trial-completed.device-phone .refer-strip-container,
body.trial-completed.device-small-tablet .refer-strip-container {
    display: none !important;
}

/* AFTER TRIAL: Hide caption on ALL devices (desktop/tablets too) */
/* Caption "get 60 days" is no longer relevant - user already completed trial */
body.trial-completed .refer-caption {
    display: none !important;
}

/* AFTER TRIAL: Keep "Refer Highlights" button on desktop and large tablets (10.2"+) */
/* Users can still optionally refer friends - button stays for sharing highlights */
body.trial-completed.device-desktop .refer-strip-btn,
body.trial-completed.device-large-tablet .refer-strip-btn {
    display: block !important; /* Keep button visible */
}

/* Styling for the Telegram SVG icon inside the button 
.telegram-icon {
    width: 18px;
    height: 18px;
    display: block;
    vertical-align: middle;
}*/

/* Tooltip Styling for Share button */
.share-btn .tooltip {
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    background-color: #fdfdfc;
    color: #24A1DE;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 8px;
    font-weight: normal;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    border: 1px solid #e0e0e0;
}
 
.share-btn .tooltip::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #fdfdfc transparent transparent transparent;
}
 
.share-btn:hover .tooltip {
    opacity: 1;
    visibility: visible;
    bottom: 110%;
}

.highlight-red {
    color: #FF0000;
    font-weight: bold;
}
/*
    -------------------------
    Specific Tooltip for Vote Button
    -------------------------
*/
#voteBtn .tooltip {
    background-color: #F5F5DC; /* Off-white color (Beige) */
    color: #333; /* Dark text for contrast */
    border: 1px solid #ccc; /* Subtle border for definition */
}

/* Also, update the tooltip's arrow to match the new background color */
#voteBtn .tooltip::after {
    border-color: #F5F5DC transparent transparent transparent;
}

/*
    -------------------------
    Responsive Design for Buttons
    -------------------------
*/
/* Mobile Portrait: Clean 3+2 layout (Read|Vote|Summary, then Bookmark|Refer) */
@media (max-width: 600px) {
    .button-row {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem; /* Tighter gaps for mobile */
        padding: 0.5rem 0.25rem 0 0.25rem; /* Reduce side padding */
    }

    .button-row button,
    .button-row .mark-read-wrapper {
        flex: 0 1 31%; /* 3 buttons per row with tight spacing */
        min-width: unset;
        max-width: unset;
        font-size: 0.85rem; /* Readable but compact */
        padding: 9px 6px; /* Balanced padding */
        height: 40px; /* Touch-friendly height */
    }

    /* Make Bookmark and Refer Article buttons slightly wider on second row */
    .button-row button:nth-child(4),
    .button-row button:nth-child(5),
    .button-row .mark-read-wrapper:nth-child(4),
    .button-row .mark-read-wrapper:nth-child(5) {
        flex: 0 1 47%; /* 2 buttons on second row, centered */
    }

    /* Icon sizes for mobile */
    .read-icon,
    .action-btn svg,
    .telegram-icon {
        width: 15px;
        height: 15px;
    }
}

/* Tablet adjustments (landscape tablets and small laptops) */
@media (max-width: 768px) and (min-width: 601px) {
    .button-row {
        gap: 0.7rem;
    }

    .button-row button,
    .button-row .mark-read-wrapper {
        min-width: 110px;
        max-width: 145px;
        font-size: 0.95rem;
        height: 44px;
    }

    .read-icon,
    .action-btn svg,
    .telegram-icon {
        width: 17px;
        height: 17px;
    }
}

/*
    -------------------------
    Standalone Info Icon Component (REFINED)
    -------------------------
*/
.button-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Dialog System Styles */
.dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.3);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
}

.dialog-overlay.show {
    opacity: 1;
    visibility: visible;
}

.sg-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    z-index: 10000;
    width: 90%;
    max-width: 650px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
}

.sg-dialog.show {
    opacity: 1;
    visibility: visible;
}

.sg-dialog h2 {
    text-align: center;
}

.sg-dialog p {
    text-align: left;
}

.sg-dialog h2 strong.button-like {
    color:#fff;
    background:#d93025;
    padding:4px 10px;
    border-radius:8px;
    font-size:0.95em;
    font-weight:600;
    display:inline-block;
    box-shadow:0 2px 4px rgba(0,0,0,0.2);
    transform:translateY(1px);
    user-select:none;
}

.sg-dialog .keyword {
    font-style:italic;
    text-decoration:underline;
}

.sg-dialog .bold-italic {
    font-weight:bold;
    font-style:italic;
}

.sg-dialog .all-caps-bold {
    font-weight:bold;
    text-transform:uppercase;
}

.sg-dialog .bold-italic-underline {
    font-weight:bold;
    font-style:italic;
    text-decoration:underline;
}

.sg-dialog .arrow-bullet {
    display: block;
    margin-bottom: 8px;
}

.sg-dialog .arrow-bullet::before {
    content:'• ';
    font-weight:bold;
    color:#d93025;
}

.sg-dialog .btn {
    padding: 10px 24px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    margin: 12px auto 0;
    display: block;
}

.sg-dialog .btn.primary {
    background: #007bff;
    color: #fff;
    width: auto;
    min-width: 100px;
}

.sg-dialog .btn.primary:hover {
    background:#0056b3;
}

.info-container {
    position: relative;
    margin-top: 4px;                 /* Minimal gap below button */
    display: flex;
    justify-content: center;
    z-index: 1000;                   /* Bring above other content */
    min-height: 18px;                /* Fixed height prevents layout shifts */
}

/* Smaller, balanced blue info icon */
.info-icon {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background-color: white;
    border: 2px solid #0000FF;
    color:#0000FF;
    text-align: center;
    line-height: 15px;
    font-weight: 300;
    font-size: 8px;
    font-family: "Arial Black", "Segoe UI", sans-serif;
    cursor: pointer;
    user-select: none;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: transform 0.2s ease;
}

.info-icon:hover {
    transform: scale(1.1);
}

/* Info icon tooltips removed - using proper dialogs instead */

/* Responsive Dialog Width Optimization */
/* Mobile phones - narrower with safe padding */
@media (max-width: 480px) {
    .sg-dialog {
        width: 92%;
        max-width: 100%;
        padding: 20px;
    }

    .info-icon {
        width: 16px;
        height: 16px;
        font-size: 11px;
        line-height: 13px;
        border-width: 2px;
    }
}

/* Tablets - moderate width */
@media (min-width: 481px) and (max-width: 768px) {
    .sg-dialog {
        width: 85%;
        max-width: 550px;
    }

    .info-icon {
        width: 16px;
        height: 16px;
        font-size: 11px;
        line-height: 13px;
        border-width: 2px;
    }
}

/* Small laptops - good reading width */
@media (min-width: 769px) and (max-width: 1024px) {
    .sg-dialog {
        width: 80%;
        max-width: 650px;
    }
}

/* Large desktops - wider for better readability */
@media (min-width: 1025px) {
    .sg-dialog {
        width: 70%;
        max-width: 750px;
    }
}

/* =============================================
   SOCIAL PROOF - Inside Button Wrapper
   Community engagement metrics below each button
   ============================================= */

/* Proof item inside button-wrapper - hidden by default */
.button-wrapper .proof-item {
    display: none; /* Hidden until tile is expanded */
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 4px;
    padding: 2px 0;
}

/* Show proof items when tile is expanded */
.article-tile.expanded .button-wrapper .proof-item {
    display: flex;
}

/* Proof icon styling */
.proof-icon {
    width: 14px;
    height: 14px;
    stroke: #64748b;
    stroke-width: 1.5;
    fill: none;
    flex-shrink: 0;
}

/* Count number - prominent */
.proof-count {
    font-size: 0.8rem;
    font-weight: 600;
    color: #374151;
    line-height: 1;
}

/* Label text - subtle */
.proof-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: #9ca3af;
    text-transform: capitalize;
}

/* Text-only proof item (for "Editorials are not voted") */
.proof-item.proof-text-only {
    justify-content: center;
}

.proof-label-muted {
    font-size: 0.7rem;
    font-weight: 400;
    color: #b0b0b0;
    font-style: italic;
    text-align: center;
    white-space: nowrap;
}

body.dark-mode .proof-label-muted {
    color: #6b7280;
}

/* Hover effect on proof items */
.proof-item:not(.proof-spacer):not(.proof-hidden):hover .proof-icon {
    stroke: #6366f1;
    transform: scale(1.1);
    transition: all 0.2s ease;
}

.proof-item:not(.proof-spacer):not(.proof-hidden):hover .proof-count {
    color: #6366f1;
    transition: color 0.2s ease;
}

/* =============================================
   SOCIAL PROOF - DARK MODE
   ============================================= */

/* Dark mode social proof - inherits base styles */

body.dark-mode .proof-icon {
    stroke: #9ca3af;
}

body.dark-mode .proof-count {
    color: #e5e7eb;
}

body.dark-mode .proof-label {
    color: #6b7280;
}

body.dark-mode .proof-item:hover .proof-icon {
    stroke: #818cf8;
}

body.dark-mode .proof-item:hover .proof-count {
    color: #818cf8;
}

/* =============================================
   SOCIAL PROOF - RESPONSIVE
   ============================================= */

@media (max-width: 768px) {
    .button-wrapper .proof-item {
        gap: 3px;
    }

    .proof-icon {
        width: 12px;
        height: 12px;
    }

    .proof-count {
        font-size: 0.7rem;
    }

    .proof-label {
        font-size: 0.65rem;
    }
}

@media (max-width: 480px) {
    .button-wrapper .proof-item {
        gap: 2px;
    }

    .proof-icon {
        width: 11px;
        height: 11px;
    }

    .proof-count {
        font-size: 0.65rem;
    }

    .proof-label {
        font-size: 0.6rem;
    }

    .proof-label-muted {
        font-size: 0.55rem;
    }
}