/*
*********************************************************************************************
* File: post-actions.css
* Author: Madhurima Rawat
* Date: November 02, 2026
* Description: Stylesheet for the post interaction components of the "Madhurima Mindscape" blog.
*              It provides styling for post action buttons, comment panels, reading information,
*              and Read Aloud functionality.
* Version: 1.0
* GitHub Repository: https://github.com/madhurimarawat/Madhurima-Mindscape
* Issues/Bugs: For any issues or bugs, please visit the GitHub repository issues section.
* Comments:
*   - Styles post action buttons, including hover, focus, and saved states.
*   - Provides responsive layouts and styling for the comment panel and form.
*   - Includes mobile-friendly comment dropdown and input elements.
*   - Displays post status messages and reading-time information.
*   - Highlights spoken words during Read Aloud and styles its active button state.
* Dependencies:
*   - Font Awesome 5.15.4: Provides icons for post action buttons.
*   - Custom JavaScript (post-actions.js): Handles post interactions and Read Aloud functionality.
*********************************************************************************************
*/

/* =========================================
   POST ACTIONS
========================================= */

/* Center the action buttons and reduce excess top spacing */
.post-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    margin: 8px 0 20px;
    padding: 4px 0;
    border: none;
    background: transparent;
    margin-bottom: 40px;
}

/* Preserve each button item's centered layout */
.post-action-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Create smaller glossy-outline buttons with transparent fill */
.post-action-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    margin: 0;
    padding: 9px 16px;
    border: 1px solid rgba(255, 224, 184, 0.8);
    border-radius: 30px;
    background: transparent;
    background-color: transparent;
    color: inherit;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    cursor: pointer;
    box-shadow:
        0 0 8px rgba(255, 224, 184, 0.08),
        inset 0 1px 2px rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    transition:
        border-color 0.3s ease,
        color 0.3s ease,
        box-shadow 0.3s ease,
        transform 0.3s ease;
}

/* Remove the glossy overlay to keep the button unfilled */
.post-action-btn::before {
    display: none;
}

/* Highlight the outline on hover without filling the button */
.post-action-btn:hover {
    background: transparent;
    background-color: transparent;
    border-color: rgba(255, 224, 184, 1);
    color: #ffe0b8;
    transform: translateY(-2px);
    box-shadow:
        0 0 10px rgba(255, 224, 184, 0.2),
        0 0 18px rgba(255, 224, 184, 0.08),
        inset 0 1px 2px rgba(255, 255, 255, 0.2);
}

/* Add a subtle pressed-button animation */
.post-action-btn:active {
    transform: translateY(0) scale(0.97);
}

/* Keep keyboard focus clearly visible */
.post-action-btn:focus-visible,
.comment-send-btn:focus-visible {
    outline: 2px solid #ffe0b8;
    outline-offset: 3px;
}

/* Keep icons neatly sized without borders */
.post-action-btn i {
    position: relative;
    z-index: 1;
    border: none;
    font-size: 14px;
    transition:
        color 0.3s ease,
        filter 0.3s ease,
        transform 0.3s ease;
}

/* Keep button labels above decorative layers */
.post-action-btn span {
    position: relative;
    z-index: 1;
}

/* Add a gentle glow to icons on hover */
.post-action-btn:hover i {
    transform: scale(1.08);
}

/* Highlight saved posts with a glowing outline and no fill */
.post-action-btn.is-saved {
    background: transparent;
    background-color: transparent;
    box-shadow:
        0 0 10px rgba(255, 224, 184, 0.16),
        inset 0 1px 2px rgba(255, 255, 255, 0.15);
    text-align: center;
}

/* Highlight the saved icon */
.post-action-btn.is-saved i {
    filter: drop-shadow(0 0 4px rgba(255, 224, 184, 0.4));
}

/* =========================================
   POST ACTION STATUS MESSAGES
========================================= */

.post-action-status {
    margin: 12px 0 0;
    padding: 0;
    border: none;
    background: none;
    border-radius: 0;
    box-shadow: none;

    text-align: center;
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.5;
    color: #6b5b73;

    opacity: 1;
    transition: opacity 0.8s ease;
}

/* Hide when there is no message */
.post-action-status:empty {
    display: none;
}

/* Fade-out effect */
.post-action-status.fade-out {
    opacity: 0;
}

/* Style the comment panel container */
.comment-panel {
    max-width: 620px;
    margin: 24px auto;
    padding: 28px;
    border: 1px solid;
    border-radius: 18px;
    box-shadow: 0 8px 24px rgba(91, 55, 112, 0.08);
    animation: commentPanelIn 0.35s ease;
}

/* Hide the panel when the hidden attribute is present */
.comment-panel[hidden] {
    display: none;
}

/* Style the comment panel heading */
.comment-panel h3 {
    margin: 0 0 10px;
    font-size: 1.45rem;
    font-weight: 700;
    line-height: 1.4;
    text-align: center;
}

/* Style the introductory paragraph */
.comment-panel>p {
    margin: 0 0 22px;
    font-size: 0.95rem;
    line-height: 1.7;
}

/* Arrange the form fields vertically */
#post-comment-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Style form labels */
#post-comment-form label {
    margin-top: 8px;
    font-size: 0.92rem;
    font-weight: 600;
}

/* Style the comment dropdown and name input */
#comment-template,
#comment-name {
    width: 100%;
    min-height: 46px;
    padding: 12px 14px;
    border: 1px solid #dfd0eb;
    border-radius: 10px;
    background: #ffffff;
    font: inherit;
    font-size: 0.94rem;
    outline: none;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
    box-sizing: border-box;
}

/* Give the dropdown a comfortable height */
#comment-template {
    cursor: pointer;
}

/* Highlight fields when selected */
#comment-template:focus,
#comment-name:focus {
    border-color: #a779c5;
    box-shadow: 0 0 0 3px rgba(167, 121, 197, 0.16);
}

/* Style the email submission button */
.comment-send-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    width: 100%;
    min-height: 48px;
    margin-top: 14px;
    padding: 13px 18px;
    border: none;
    border-radius: 11px;
    font: inherit;
    font-size: 0.96rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 5px 12px rgba(112, 69, 138, 0.18);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

/* Add a subtle hover effect to the button */
.comment-send-btn:hover {
    box-shadow: 0 8px 18px rgba(112, 69, 138, 0.25);
    transform: translateY(-2px);
}

/* Show a visible keyboard focus indicator */
.comment-send-btn:focus-visible {
    outline: 3px solid #c9a8df;
    outline-offset: 3px;
}

/* Give the button a pressed effect */
.comment-send-btn:active {
    transform: translateY(0);
    box-shadow: 0 3px 8px rgba(112, 69, 138, 0.18);
}

/* Style the email helper note */
.comment-panel .post-action-note {
    margin: 16px 0 0;
    font-size: 0.82rem;
    line-height: 1.6;
    text-align: center;
}

#custom-comment {
    width: 100%;
    box-sizing: border-box;
    padding: 10px;
    border: 1px solid var(--comment-box-color);
    border-radius: 8px;
    background-color: transparent;
    font: inherit;
    resize: vertical;
}

#custom-comment::placeholder {
    opacity: 1;
}

#custom-comment-container[hidden] {
    display: none;
}

/* Animate the comment panel as it appears */
@keyframes commentPanelIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Respect visitors who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {

    .comment-panel,
    .comment-send-btn,
    #comment-template,
    #comment-name {
        animation: none;
        transition: none;
    }
}

/* Make action buttons smaller on mobile screens */
@media (max-width: 576px) {
    .post-actions {
        gap: 8px;
        margin-top: 25px;
        padding-top: 2px;
    }

    .post-action-btn {
        gap: 6px;
        padding: 8px 12px;
        font-size: 12px;
    }

    .post-action-btn i {
        font-size: 13px;
    }
}

/* Respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {

    .post-action-btn,
    .post-action-btn i,
    .comment-send-btn {
        transition: none;
    }
}

/* =========================================
   MOBILE COMMENT PANEL
========================================= */
@media screen and (max-width: 600px) {

    /* Small, centered comment panel */
    .comment-panel {
        width: 280px;
        max-width: calc(100% - 24px);
        margin: 14px auto;
        padding: 12px;
        border-radius: 12px;
        box-sizing: border-box;
    }

    /* Compact heading */
    .comment-panel h3 {
        margin: 0 0 8px;
        font-size: 18px;
        line-height: 1.4;
    }

    /* Compact introductory text */
    .comment-panel>p {
        margin: 0 0 10px;
        font-size: 13px;
        line-height: 1.5;
    }

    /* Form spacing */
    #post-comment-form {
        display: flex;
        flex-direction: column;
        gap: 6px;
        min-width: 0;
    }

    /* Labels */
    #post-comment-form label {
        margin-top: 3px;
        font-size: 13px;
    }

    /* Dropdown and name input */
    #comment-template,
    #comment-name {
        width: 100%;
        min-width: 0;
        min-height: 38px;
        padding: 8px;
        font-size: 16px;
        border-radius: 7px;
        box-sizing: border-box;
    }

    /* Comment textarea */
    #custom-comment {
        display: block;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        min-height: 80px;
        padding: 8px;
        font-size: 16px;
        border-radius: 7px;
        box-sizing: border-box;
        resize: vertical;
    }

    /* Send button */
    .comment-send-btn {
        width: 100%;
        min-height: 40px;
        margin-top: 6px;
        padding: 8px;
        font-size: 13px;
        border-radius: 8px;
        box-sizing: border-box;
    }

    /* Helper note */
    .comment-panel .post-action-note {
        margin: 8px 0 0;
        font-size: 12px;
        line-height: 1.4;
        text-align: center;
    }

    /* Keep the dropdown inside the comment panel */
    #comment-template {
        display: block;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        font-size: 0.7em;
        padding: 8px 6px;
        box-sizing: border-box;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    #comment-template option {
        font-size: 0.8em;
        padding: 6px;
        white-space: normal;
    }

    #post-comment-form {
        width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }

    #post-comment-form select#comment-template {
        display: block;
        width: 100%;
        min-width: 0;
        max-width: 100%;
        margin: 0;
        padding: 8px 22px 8px 6px;
        font-size: 13px;
        box-sizing: border-box;
    }

    /* Custom mobile-safe comment dropdown */
    .comment-select-wrap {
        position: relative;
        width: 100%;
        min-width: 0;
    }

    .comment-select-wrap .comment-native-select {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip-path: inset(50%);
        white-space: nowrap;
        border: 0;
    }

    .comment-select-button {
        display: block;
        width: 100%;
        min-width: 0;
        min-height: 42px;
        padding: 10px 36px 10px 12px;
        border: 1px solid #dfd0eb;
        border-radius: 8px;
        background: #fff;
        color: #222;
        font: inherit;
        font-size: 16px;
        text-align: left;
        overflow-wrap: anywhere;
        cursor: pointer;
        position: relative;
    }

    .comment-select-button::after {
        content: "▾";
        position: absolute;
        right: 12px;
        top: 50%;
        transform: translateY(-50%);
    }

    .comment-select-menu {
        position: fixed;
        z-index: 999999;
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
        box-sizing: border-box;
        padding: 5px;
        border: 1px solid #dfd0eb;
        border-radius: 10px;
        background: #fff;
        color: #222;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
    }

    .comment-select-menu[hidden] {
        display: none;
    }

    .comment-select-option {
        display: block;
        width: 100%;
        min-width: 0;
        padding: 11px 10px;
        border: 0;
        border-radius: 6px;
        background: #fff;
        color: #222;
        font: inherit;
        font-size: 15px;
        line-height: 1.4;
        text-align: left;
        white-space: normal;
        overflow-wrap: anywhere;
        cursor: pointer;
    }

    .comment-select-option:hover,
    .comment-select-option:focus {
        background: #f5eafa;
        outline: none;
    }

    /* Your name input font size */
    #comment-name {
        font-size: 0.8em;
    }
}

/* Center and bold the reading information */
.reading-info {
    text-align: center;
    font-weight: bold;
}

/* Style the reading time */
.reading-time {
    color: var(--h2-color);
    font-size: 14px;
    margin-left: 0.3em;
}

/* Add spacing between the clock icon and reading time */
.reading-time i {
    margin-right: 5px;
}

/* Adjust reading time spacing on mobile devices */
@media (max-width: 768px) {

    /* Reduce the left margin on mobile */
    .reading-time {
        margin-left: 0.05em;
    }
}

/* Read Aloud: currently spoken word */
::highlight(read-aloud-highlight) {
    background-color: var(--h2-color);
    color: var(--post-action-color);
    text-decoration: underline;
    text-decoration-color: #d69b20;
    text-decoration-thickness: 2px;
}

/* Active Read Aloud button */
#read-aloud-btn[aria-pressed="true"] {
    background-color: var(--h2-color);
    color: var(--post-action-color);
}

/* Keep the icon and text the same color */
#read-aloud-btn[aria-pressed="true"] i,
#read-aloud-btn[aria-pressed="true"] span {
    color: var(--post-action-color);
}