/* ========================================
   Custom Comment Form Styles
   วาง CSS นี้ใน style.css ของ theme หรือใน Customizer
   ======================================== */

/* Comments Section Container */
#comments-section {
    max-width: 100%;
    margin: 0px auto;
    padding: 0;
}

.commentx h3 {
    color: #000;
} 
/* ========================================
   COMMENT FORM STYLES
   ======================================== */

#custom-comment-form-wrapper {
    background: #ffffff;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    margin-bottom: 40px;
    border: 1px solid #e8e8e8;
}

.comment-form-title {
    font-size: 24px;
    font-weight: 700;
    color: #2c3e50;
    margin: 0 0 25px 0;
    padding-bottom: 15px;
    border-bottom: 3px solid #3498db;
}

/* Form Fields */
.comment-form-field {
    margin-bottom: 20px;
}

.comment-form-field label {
    display: block;
    font-weight: 600;
    color: #34495e;
    margin-bottom: 8px;
    font-size: 14px;
}

.comment-form-field .required {
    color: #e74c3c;
    font-weight: bold;
}

.comment-form-field input[type="text"],
.comment-form-field input[type="email"],
.comment-form-field input[type="number"],
.comment-form-field textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Sarabun', sans-serif;
    transition: all 0.3s ease;
    background: #fafafa;
    color: #000 !important;
}

.comment-form-field input:focus,
.comment-form-field textarea:focus {
    outline: none;
    border-color: #3498db;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.comment-form-field textarea {
    resize: vertical;
    min-height: 120px;
    line-height: 1.6;
}

.form-hint {
    display: block;
    margin-top: 6px;
    color: #7f8c8d;
    font-size: 13px;
    font-style: italic;
}

/* Logged In Message */
.logged-in-as {
    background: #f0f8ff;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #3498db;
    margin-bottom: 20px;
    font-size: 14px;
    color: #2c3e50;
}

.logged-in-as strong {
    color: #3498db;
    font-weight: 600;
}

.logged-in-as a {
    color: #e74c3c;
    text-decoration: none;
    margin-left: 10px;
    font-weight: 500;
}

.logged-in-as a:hover {
    text-decoration: underline;
}

/* Guest Welcome Message */
.guest-welcome {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    padding: 15px 20px;
    border-radius: 8px;
    border-left: 4px solid #4caf50;
    margin-bottom: 20px;
    font-size: 14px;
    color: #2e7d32;
    text-align: center;
}

.guest-welcome strong {
    color: #1b5e20;
    font-weight: 700;
}

/* Math CAPTCHA Styles */
.captcha-field {
    background: #fff9e6;
    padding: 20px;
    border-radius: 8px;
    border: 2px solid #f39c12;
}

.math-captcha {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 10px;
}

.math-question {
    background: #ffffff;
    padding: 12px 20px;
    border-radius: 6px;
    font-size: 20px;
    font-weight: 700;
    color: #2c3e50;
    border: 2px solid #f39c12;
    min-width: 120px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(243, 156, 18, 0.2);
}

.math-captcha input[type="number"] {
    width: 150px;
    padding: 12px;
    text-align: center;
    font-size: 18px;
    font-weight: 600;
    border: 2px solid #f39c12;
}

/* Submit Button */
.comment-form-submit {
    margin-top: 25px;
}

.submit-comment-btn {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: #ffffff;
    border: none;
    padding: 14px 32px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.submit-comment-btn:hover {
    background: linear-gradient(135deg, #2980b9 0%, #21618c 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(52, 152, 219, 0.4);
}

.submit-comment-btn:active {
    transform: translateY(0);
}

.submit-comment-btn svg {
    transition: transform 0.3s ease;
}

.submit-comment-btn:hover svg {
    transform: translateX(3px);
}

/* Comment Policy */
.comment-policy {
    margin-top: 20px;
    padding: 15px;
    background: #e8f5e9;
    border-radius: 6px;
    border-left: 4px solid #4caf50;
}

.comment-policy small {
    color: #2e7d32;
    font-size: 13px;
    line-height: 1.5;
}

/* ========================================
   COMMENTS LIST STYLES
   ======================================== */

.comments-list-wrapper {
    margin-bottom: 15px;
}

.comments-title {
    font-size: 22px;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 25px;
    padding-bottom: 12px;
    border-bottom: 2px solid #ecf0f1;
}

.no-comments {
    text-align: center;
    padding: 40px 20px;
    background: #f8f9fa;
    border-radius: 8px;
    color: #7f8c8d;
    font-size: 15px;
    font-style: italic;
}

.comments-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.comment-item {
    display: flex;
    gap: 15px;
    padding: 20px;
    background: #ffffff;
    border-radius: 10px;
    margin-bottom: 5px;
    border: 1px solid #e8e8e8;
    transition: all 0.3s ease;
}

.comment-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border-color: #3498db;
}

.comment-avatar {
    flex-shrink: 0;
}

.comment-avatar img {
    border-radius: 50%;
    border: 3px solid #ecf0f1;
}

.comment-content-wrap {
    flex-grow: 1;
}

.comment-meta {
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.comment-author {
    font-weight: 700;
    color: #2c3e50;
    font-size: 15px;
}

.comment-date {
    color: #95a5a6;
    font-size: 13px;
}

.comment-date::before {
    content: "•";
    margin-right: 8px;
}

.comment-text {
    color: #34495e;
    line-height: 1.7;
    font-size: 15px;
}

.comment-text p {
    margin: 0 0 10px 0;
}

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

/* Closed Comments */
.comments-closed {
    text-align: center;
    padding: 30px;
    background: #fff3cd;
    border: 2px solid #ffc107;
    border-radius: 8px;
    color: #856404;
    font-weight: 600;
}

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

@media screen and (max-width: 768px) {
    #custom-comment-form-wrapper {
        padding: 20px;
    }
    
    .comment-form-title {
        font-size: 20px;
    }
    
    .math-captcha {
        flex-direction: column;
        align-items: stretch;
    }
    
    .math-question {
        text-align: center;
    }
    
    .math-captcha input[type="number"] {
        width: 100%;
    }
    
    .submit-comment-btn {
        width: 100%;
        justify-content: center;
    }
    
    .comment-item {
        flex-direction: column;
    }
    
    .comment-avatar {
        align-self: flex-start;
    }
}

@media screen and (max-width: 480px) {
    #comments-section {
        padding: 0 15px;
    }
    
    #custom-comment-form-wrapper {
        padding: 15px;
    }
    
    .comment-form-field input,
    .comment-form-field textarea {
        font-size: 16px; /* ป้องกัน zoom บน iOS */
    }
}

/* ========================================
   ANIMATIONS
   ======================================== */

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.comment-item {
    animation: slideIn 0.4s ease-out;
}

/* Dark Mode Support (Optional) */
@media (prefers-color-scheme: dark) {
    #custom-comment-form-wrapper,
    .comment-item {
        background: #2c3e50;
        border-color: #34495e;
    }
    
    .comment-form-title,
    .comments-title,
    .comment-author {
        color: #ecf0f1;
    }
    
    .comment-form-field input,
    .comment-form-field textarea {
        background: #34495e;
        border-color: #4a5f7f;
        color: #ecf0f1;
    }
    
    .comment-text {
        color: #bdc3c7;
    }
    
    .comment-date {
        color: #7f8c8d;
    }
}


/* Avatar กลม + Shadow */
.cartoon-avatar,
.initial-avatar,
.robohash-avatar,
.multiavatar {
    border-radius: 50% !important;
    border: 3px solid #ffffff !important;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2) !important;
    object-fit: cover !important;
    background: #f0f0f0 !important;
}

/* Hover Effect - ขยายเล็กน้อย */
.comment-avatar img {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.comment-avatar img:hover {
    transform: scale(1.15) rotate(5deg) !important;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3) !important;
}

/* Avatar ใหญ่ขึ้นเล็กน้อย */
.comment-item .comment-avatar img {
    width: 60px !important;
    height: 60px !important;
}

/* Border สีสันสดใส */
.comment-item:nth-child(1) .comment-avatar img { border-color: #3498db !important; }
.comment-item:nth-child(2) .comment-avatar img { border-color: #e74c3c !important; }
.comment-item:nth-child(3) .comment-avatar img { border-color: #2ecc71 !important; }
.comment-item:nth-child(4) .comment-avatar img { border-color: #f39c12 !important; }
.comment-item:nth-child(5) .comment-avatar img { border-color: #9b59b6 !important; }

/* Animation เมื่อโหลด */
@keyframes avatarPop {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.comment-avatar img {
    animation: avatarPop 0.5s ease-out;
}