/* static/css/post_detail.css */

/* ========================= */
/*         GENERAL          */
/* ========================= */

/* Body Styles */
body {
    font-family: 'Poppins', sans-serif;
    background-color: #f4f6f9;
    color: #333333;
    line-height: 1.6;
    margin: 0;
    padding: 0;
}

/* Container for Post Details and Edit Comment */
.post-detail-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* ========================= */
/*        CAROUSEL          */
/* ========================= */

/* Carousel Container */
.carousel-container {
    position: relative;
    width: 100%;
    max-width: 1920px;
    margin: 0 auto 40px;
    background: transparent; /* Changed from rgba(0, 0, 0, 0.03) to transparent */
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transform-style: preserve-3d;
    backface-visibility: hidden;
}

.carousel-container::before {
    content: '';
    display: block;
    padding-top: 56.25%; /* Exact 1920x1080 ratio */
}

/* Carousel */
.carousel {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    perspective: 2000px;
    transform-style: preserve-3d;
}

/* Carousel Items */
.carousel-item {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    visibility: hidden;
    transform: translate3d(100%, 0, 0) scale(0.85);
    will-change: transform, opacity;
    transition: transform 0.7s cubic-bezier(0.645, 0.045, 0.355, 1),
                opacity 0.7s cubic-bezier(0.645, 0.045, 0.355, 1),
                visibility 0.7s cubic-bezier(0.645, 0.045, 0.355, 1);
    transform-style: preserve-3d;
}

.carousel-item.transitioning {
    opacity: 1;
    visibility: visible;
}

/* Image Wrapper */
.image-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translateZ(0);
    perspective: 1000px;
}

/* Active Carousel Item */
.carousel-item.active {
    opacity: 1;
    visibility: visible;
    transform: translate3d(0, 0, 0) scale(1) rotateY(0);
    z-index: 2;
    will-change: transform;
}

.carousel-item.active.transitioning {
    z-index: 1;
}

/* Previous Carousel Item */
.carousel-item.prev {
    transform: translateX(-100%) scale(0.8) rotateY(-45deg);
}

/* Carousel Images */
.carousel-item img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    transform-style: preserve-3d;
    backface-visibility: hidden;
    transform-origin: center center;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

.carousel-item.active img {
    transform: translateZ(20px);
}

/* Active Image Hover Effect */
.carousel-item.active:hover img {
    transform: scale(1.03) translateY(-5px);
}

/* Carousel Caption */
.carousel-caption {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(30px) translateZ(30px);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    z-index: 3;
    opacity: 0;
    backdrop-filter: blur(8px);
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.carousel-item.active .carousel-caption {
    transform: translateX(-50%) translateY(0) translateZ(30px);
    opacity: 1;
}

/* Hover effects */
.carousel-item.active:hover img {
    transform: scale(1.02);
}

/* Buttons */
.carousel-button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%) translateZ(50px);
    z-index: 10;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(4px);
    border: 2px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
    mix-blend-mode: difference;
}

.carousel-button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.4s ease-out, height 0.4s ease-out;
}

.carousel-button:hover {
    background: rgba(0, 0, 0, 0.7);
    transform: translateY(-50%) translateZ(50px) scale(1.1);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
}

.carousel-button:hover::before {
    width: 150%;
    height: 150%;
}

.carousel-button.prev {
    left: 20px;
    transform: translateY(-50%) translateX(-10px);
    opacity: 0.7;
}

.carousel-button.next {
    right: 20px;
    transform: translateY(-50%) translateX(10px);
    opacity: 0.7;
}

.carousel-container:hover .carousel-button {
    transform: translateY(-50%) translateX(0);
    opacity: 1;
}

/* Ripple Animation */
@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 0.5;
    }
    100% {
        transform: scale(4);
        opacity: 0;
    }
}

.ripple {
    position: absolute;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    pointer-events: none;
    transform: translate(-50%, -50%);
    animation: ripple 0.6s linear;
}

/* Enhanced button hover states */
.carousel-button i {
    position: relative;
    z-index: 2;
    transition: transform 0.3s ease;
}

.carousel-button:hover i {
    transform: scale(1.1);
}

.carousel-button:active i {
    transform: scale(0.95);
}

/* Media Queries */
@media (max-width: 992px) {
    .carousel-container {
        width: 100%;
    }

    .carousel-button {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
}

@media (max-width: 768px) {
    .carousel-button {
        width: 35px;
        height: 35px;
        font-size: 18px;
    }
}

/* ========================= */
/*      POST CONTENT        */
/* ========================= */

/* Post Content Container */
.post-content {
    background-color: #ffffff;
    padding: 36px 40px;
    border-radius: 20px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
    margin-bottom: 60px;
}

/* Post Title */
.post-content h1 {
    font-size: 1.9em;
    color: #ff5722;
    margin-bottom: 12px;
    text-align: center;
    position: relative;
    line-height: 1.3;
    font-weight: 700;
}

.post-content h1::after {
    content: '';
    width: 50px;
    height: 3px;
    background-color: #ff5722;
    display: block;
    margin: 8px auto 0;
    border-radius: 2px;
}

/* Post Meta Information */
.post-meta {
    font-size: 0.82em;
    color: #888888;
    margin-bottom: 6px;
    text-align: center;
}

/* Post Categories */
.post-categories {
    font-size: 0.82em;
    margin-bottom: 20px;
    text-align: center;
}

.post-categories a {
    color: #ff5722;
    text-decoration: none;
    margin-right: 8px;
    transition: color 0.3s ease;
}

.post-categories a:hover {
    color: #e64a19;
}

/* Post Body */
.post-body {
    font-size: 0.97em;
    color: #3d3d3d;
    line-height: 1.75;
    text-align: left;
}

/* Paragraphs */
.post-body p {
    margin-top: 0;
    margin-bottom: 1em;
}

/* Headings inside post body */
.post-body h1 {
    font-size: 1.55em;
    font-weight: 700;
    color: #1a1a1a;
    margin: 1.6em 0 0.5em;
    line-height: 1.3;
}

.post-body h2 {
    font-size: 1.3em;
    font-weight: 700;
    color: #1a1a1a;
    margin: 1.5em 0 0.45em;
    line-height: 1.3;
    border-left: 3px solid #ff5722;
    padding-left: 10px;
}

.post-body h3 {
    font-size: 1.1em;
    font-weight: 600;
    color: #2d2d2d;
    margin: 1.3em 0 0.4em;
    line-height: 1.35;
}

.post-body h4 {
    font-size: 1em;
    font-weight: 600;
    color: #444444;
    margin: 1.1em 0 0.35em;
}

/* Lists */
.post-body ul,
.post-body ol {
    margin: 0.5em 0 1em 1.4em;
    padding: 0;
}

.post-body li {
    margin-bottom: 0.3em;
    line-height: 1.65;
}

.post-body ul li {
    list-style-type: disc;
}

.post-body ol li {
    list-style-type: decimal;
}

/* Blockquote */
.post-body blockquote {
    border-left: 3px solid #ff5722;
    margin: 1.2em 0;
    padding: 0.5em 0 0.5em 1em;
    color: #666;
    font-style: italic;
    background: #fff8f6;
    border-radius: 0 6px 6px 0;
}

/* Links inside post */
.post-body a {
    color: #ff5722;
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 87, 34, 0.3);
    transition: border-color 0.2s;
}

.post-body a:hover {
    border-bottom-color: #ff5722;
}

/* Images inside post */
.post-body img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1em 0;
    display: block;
}

/* Horizontal rule */
.post-body hr {
    border: none;
    border-top: 1px solid #eeeeee;
    margin: 1.5em 0;
}

/* Table */
.post-body table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92em;
    margin: 1em 0;
    overflow-x: auto;
    display: block;
}

.post-body th {
    background: #ff5722;
    color: #fff;
    padding: 8px 12px;
    text-align: left;
    font-weight: 600;
}

.post-body td {
    padding: 7px 12px;
    border-bottom: 1px solid #eeeeee;
    vertical-align: top;
}

.post-body tr:nth-child(even) td {
    background: #fafafa;
}

/* ========================= */
/*      YOUTUBE VIDEO       */
/* ========================= */

/* Video Container */
.video-container {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    padding-top: 25px;
    height: 0;
    margin-top: 40px;
    margin-bottom: 40px;
}

/* Embedded YouTube Iframe */
.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease;
}

.video-container iframe:hover {
    transform: scale(1.01);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

/* ========================= */
/*    COMMENTS SECTION      */
/* ========================= */

/* Comments Section Container */
.comments-section {
    background-color: #ffffff;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
}

/* Comments Heading */
.comments-section h3,
.comments-section h4 {
    font-size: 2em;
    color: #ff5722;
    margin-bottom: 25px;
    text-align: center;
    position: relative;
}

.comments-section h3::after,
.comments-section h4::after {
    content: '';
    width: 80px;
    height: 4px;
    background-color: #ff5722;
    display: block;
    margin: 10px auto 0;
    border-radius: 2px;
}

/* Individual Comment */
.comment-item {
    display: flex;
    align-items: flex-start;
    margin-bottom: 20px;
}

.comment-item:last-child {
    margin-bottom: 0;
}

/* Comment Avatar */
.comment-avatar {
    flex-shrink: 0;
    width: 50px;
    height: 50px;
    background-color: #ffccbc; /* Light orange */
    border-radius: 50%;
    margin-right: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #ffffff;
    font-size: 1.2em;
}

.comment-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

/* Comment Content */
.comment-content {
    background-color: #ffe0b2; /* Light orange */
    padding: 15px 20px;
    border-radius: 15px;
    position: relative;
    max-width: 80%;
}

.comment-content::after {
    content: '';
    position: absolute;
    top: 15px;
    left: -10px;
    border-width: 10px;
    border-style: solid;
    border-color: transparent #ffe0b2 transparent transparent;
}

.comment-author {
    font-weight: 600;
    color: #ff5722;
    margin-bottom: 5px;
}

.comment-text {
    font-size: 1em;
    color: #333333;
    margin-bottom: 10px;
}

.comment-meta {
    font-size: 0.8em;
    color: #777777;
    text-align: right;
}

/* Reply Comment Styles */
.comment.reply {
    flex-direction: row-reverse;
}

.comment.reply .comment-avatar {
    margin-left: 15px;
    margin-right: 0;
    background-color: #80cbc4; /* Light teal */
}

.comment.reply .comment-content {
    background-color: #b2dfdb; /* Light teal */
}

.comment.reply .comment-content::after {
    left: auto;
    right: -10px;
    border-color: transparent transparent transparent #b2dfdb;
}

/* ========================= */
/*         BUTTONS          */
/* ========================= */

/* Common Button Styles */
.btn-edit-comment,
.btn-submit-comment,
.btn-primary,
.btn-secondary {
    background-color: #ff5722;
    color: #ffffff;
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.3s ease;
    text-decoration: none;
    display: inline-block;
    font-size: 1em;
}

/* Secondary Button Styles */
.btn-secondary {
    background-color: #cccccc;
    color: #333333;
}

/* Button Hover Effects */
.btn-edit-comment:hover,
.btn-submit-comment:hover,
.btn-primary:hover,
.btn-secondary:hover {
    background-color: #e64a19;
}

.btn-secondary:hover {
    background-color: #999999;
}

/* ========================= */
/*      COMMENT FORM        */
/* ========================= */

/* Comment Form Container */
.comment-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

.comment-form textarea {
    width: 100%;
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #ced4da;
    resize: vertical;
    min-height: 80px;
    font-size: 1em;
}

.btn-submit-comment {
    align-self: flex-end;
    background-color: #17a2b8;
    color: #ffffff;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
    font-size: 1em;
}

.btn-submit-comment:hover {
    background-color: #138496;
}

/* ========================= */
/*      RESPONSIVE DESIGN     */
/* ========================= */

/* Medium Screens */
@media (max-width: 992px) {
    .carousel-container {
        width: 100%;
        padding-bottom: 56.25%; /* Maintain ratio on smaller screens */
    }

    .carousel-item {
        width: 100%;
        height: 100%;
        transform: none !important;
        padding: 15px;
    }

    .carousel-button {
        padding: 12px;
        font-size: 22px;
    }

    .carousel-item .image-wrapper {
        padding: 10px;
    }
}
/* ========================= */
/*    CODE BLOCKS & COPY     */
/* ========================= */

/* Inline code */
.post-body code {
    background-color: #f4f4f5;
    color: #d73a49;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'SFMono-Regular', 'Consolas', 'Liberation Mono', 'Menlo', 'Courier', monospace;
    font-size: 0.9em;
    word-break: break-word;
}

/* Block code wrapper */
/* ── Code block wrapper ─────────────────────────────────────────────────── */
/* wrapper has NO background — label sits on white page, dark box is only the pre */
.code-block-wrapper {
    margin: 1.4em 0;
}

/* label + copy button row — transparent, appears on page background */
.code-block-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2px 4px 2px;
    background: transparent;
}

/* "bash" / "yaml" etc — small grey text floating above the dark box */
.code-lang-label {
    font-size: 0.7em;
    font-family: 'SFMono-Regular', 'Consolas', 'Liberation Mono', 'Menlo', monospace;
    color: #999999;
    text-transform: lowercase;
    user-select: none;
}

/* copy button — sits right of label, above the dark box */
.copy-code-btn {
    background: transparent;
    color: #aaaaaa;
    border: 1px solid #dddddd;
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 0.67em;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.copy-code-btn:hover {
    background: #ff5722;
    border-color: #ff5722;
    color: #ffffff;
}

.copy-code-btn:active {
    transform: scale(0.95);
}

.copy-code-btn.copied {
    background: #2ecc71;
    border-color: #27ae60;
    color: #ffffff;
}

/* the actual dark code box */
.post-body pre {
    background: #1e1e2e;
    color: #cdd6f4;
    padding: 16px 20px;
    margin: 0;
    overflow-x: auto;
    line-height: 1.6;
    font-family: 'SFMono-Regular', 'Consolas', 'Liberation Mono', 'Menlo', monospace;
    font-size: 0.9em;
    tab-size: 4;
    border-radius: 8px;
    border: 1px solid #2d2d44;
}

.post-body pre code {
    background: transparent;
    color: inherit;
    padding: 0;
    border-radius: 0;
    font-size: inherit;
    word-break: normal;
    white-space: pre;
}

/* output blocks — same label-above pattern, dimmer box */
.code-block-wrapper.code-block-output {
    margin-top: 0.2em;
    margin-bottom: 1em;
}

.code-block-wrapper.code-block-output .code-lang-label {
    color: #bbbbbb;
}

.code-block-wrapper.code-block-output pre {
    background: #16161f;
    color: #7878a0;
    font-size: 0.86em;
    padding: 10px 16px;
    border-color: #252535;
    border-left: 3px solid #3d3d5c;
}

/* Scrollbar styling for code blocks */
.post-body pre::-webkit-scrollbar {
    height: 8px;
}

.post-body pre::-webkit-scrollbar-track {
    background: #1e1e2e;
    border-radius: 0 0 10px 10px;
}

.post-body pre::-webkit-scrollbar-thumb {
    background: #3d3d5c;
    border-radius: 4px;
}

.post-body pre::-webkit-scrollbar-thumb:hover {
    background: #ff5722;
}

/* Firefox scrollbar */
.post-body pre {
    scrollbar-width: thin;
    scrollbar-color: #3d3d5c #1e1e2e;
}

/* Responsive: smaller padding on mobile */
/* ========================= */
/*   MOBILE RESPONSIVE      */
/* ========================= */

@media (max-width: 768px) {
    /* Post container */
    .post-content {
        padding: 20px 16px;
        border-radius: 12px;
        margin-bottom: 30px;
    }

    /* Title */
    .post-content h1 {
        font-size: 1.35em;
        line-height: 1.3;
    }

    /* Meta + categories */
    .post-meta,
    .post-categories {
        font-size: 0.78em;
    }

    /* Body text */
    .post-body {
        font-size: 0.93em;
        line-height: 1.7;
    }

    /* Headings inside body */
    .post-body h2 {
        font-size: 1.15em;
        margin: 1.2em 0 0.4em;
    }

    .post-body h3 {
        font-size: 1em;
        margin: 1em 0 0.35em;
    }

    .post-body h4 {
        font-size: 0.95em;
    }

    /* Lists */
    .post-body ul,
    .post-body ol {
        margin-left: 1.1em;
    }

    /* Code blocks */
    .post-body pre {
        padding: 14px 12px;
        font-size: 0.82em;
        border-radius: 8px;
    }

    /* Copy button always visible on touch */
    .copy-code-btn {
        opacity: 1;
        padding: 5px 9px;
        font-size: 0.72em;
    }

    /* Tables scroll horizontally */
    .post-body table {
        font-size: 0.85em;
    }
}

@media (max-width: 480px) {
    .post-content {
        padding: 16px 12px;
    }

    .post-content h1 {
        font-size: 1.2em;
    }

    .post-body {
        font-size: 0.91em;
        line-height: 1.68;
    }

    .post-body h2 {
        font-size: 1.08em;
    }

    .post-body h3 {
        font-size: 0.97em;
    }

    .post-body pre {
        font-size: 0.79em;
        padding: 12px 10px;
    }
}
