/* 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: rgba(0, 0, 0, 0.03); /* Much lighter background */
    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: 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: 3em;
    color: #ff5722; /* Vibrant orange */
    margin-bottom: 15px;
    text-align: center;
    position: relative;
}

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

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

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

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

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

/* Post Body */
.post-body {
    font-size: 1.2em;
    color: #555555;
    line-height: 1.8;
    text-align: justify;
}

/* ========================= */
/*      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 10px 20px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.video-container iframe:hover {
    transform: scale(1.05);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
}

/* ========================= */
/*    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;
    }
}