/* BLOG PAGE STYLES */

.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    padding: 40px 0;
}

.blog-card {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    overflow: hidden;
    transition: 0.3s;
    display: flex;
    flex-direction: column;
}

.blog-card:hover {
    border-color: var(--neon-blue);
    transform: translateY(-5px);
    box-shadow: 0 0 20px rgba(45, 91, 255, 0.15);
    /* Merged from style.css */
    background: var(--neon-blue) !important;
    border-color: var(--neon-blue) !important;
    box-shadow: 0 10px 25px rgba(37, 99, 235, 0.3) !important;
}

.blog-image {
    height: 200px;
    background: #111;
    position: relative;
    overflow: hidden;
}

.blog-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.8;
    transition: 0.5s;
}

.blog-card:hover .blog-image img {
    opacity: 1;
    transform: scale(1.1);
}

.blog-content {
    padding: 25px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.blog-date {
    color: var(--neon-cyan);
    font-size: 0.85rem;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.blog-title {
    color: var(--text-main);
    font-size: 1.4rem;
    margin-bottom: 15px;
    line-height: 1.3;
}

.blog-summary {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 20px;
    flex-grow: 1;
}

.read-more {
    color: var(--neon-yellow);
    text-transform: uppercase;
    font-weight: 700;
    font-size: 0.9rem;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: auto;
}

.read-more:hover {
    gap: 10px;
}

/* Hover text color overrides merged from style.css */
.blog-card:hover .blog-title,
.blog-card:hover .blog-summary,
.blog-card:hover .blog-date,
.blog-card:hover .read-more {
    color: white !important;
}

/* 11. COMMENTS SECTION - from style.css */
.comments-section {
    margin-top: 50px;
    border-top: 1px solid var(--glass-border);
    padding-top: 40px;
}

.comments-title {
    color: var(--text-main);
    font-size: 1.8rem;
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.comment-form-container {
    background: rgba(255, 255, 255, 0.03);
    padding: 30px;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    margin-bottom: 40px;
}

.comment-form-group {
    margin-bottom: 20px;
}

.comment-form-group label {
    display: block;
    color: var(--neon-cyan);
    margin-bottom: 8px;
    font-size: 0.9rem;
    font-weight: 600;
}

.comment-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    color: white;
    padding: 12px;
    border-radius: 8px;
    transition: 0.3s;
    font-family: 'Inter', sans-serif;
}

.comment-input:focus {
    border-color: var(--neon-blue);
    outline: none;
    box-shadow: 0 0 15px rgba(45, 91, 255, 0.1);
}

textarea.comment-input {
    min-height: 120px;
    resize: vertical;
}

.btn-comment {
    background: var(--neon-blue);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 6px;
    font-weight: 700;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: 0.3s;
}

.btn-comment:hover {
    background: var(--neon-cyan);
    color: black;
    box-shadow: 0 0 20px rgba(0, 243, 255, 0.4);
}

.comments-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.comment-card {
    background: rgba(13, 22, 35, 0.6);
    border: 1px solid var(--glass-border);
    padding: 20px;
    border-radius: 10px;
    display: flex;
    gap: 15px;
    transition: 0.3s;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.comment-card:hover {
    border-color: rgba(255, 255, 255, 0.2);
}

.comment-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(45deg, var(--neon-blue), var(--neon-cyan));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: black;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.comment-body {
    flex-grow: 1;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.comment-author {
    color: var(--neon-blue);
    font-weight: 700;
    font-size: 1.1rem;
}

.comment-date {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.comment-text {
    color: var(--text-main);
    line-height: 1.6;
    font-size: 0.95rem;
}

.no-comments {
    text-align: center;
    color: var(--text-muted);
    padding: 20px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
}

/* --- BLOG MOBILE RESPONSIVENESS --- */
@media (max-width: 768px) {

    /* Main Blog Page Grid */
    .blog-grid {
        grid-template-columns: 1fr;
        /* Force single column on mobile */
        gap: 20px;
        padding: 20px 0;
    }

    /* Blog Detail Pages (Overriding internal styles) */
    .blog-detail-section {
        padding: 30px 0 !important;
    }

    .blog-detail-content {
        padding: 20px !important;
        /* Reduce padding from 40px */
        border-radius: 8px !important;
    }

    .blog-detail-image {
        height: auto !important;
        /* Allow auto height */
        aspect-ratio: 16/9;
        /* Maintain aspect ratio */
        margin-bottom: 20px !important;
    }

    .blog-detail-content h2 {
        font-size: 1.5rem !important;
        /* Smaller title */
        line-height: 1.3;
    }

    .blog-detail-content h3 {
        font-size: 1.25rem !important;
        margin-top: 20px !important;
    }

    .blog-detail-content p,
    .blog-detail-content li {
        font-size: 0.95rem !important;
        line-height: 1.6 !important;
    }

    /* Fix Comments on Mobile */
    .comments-container {
        padding: 20px;
        /* Reduce padding */
    }

    .comments-header {
        font-size: 1.3rem;
    }

    #supabase-comment-form .input-row {
        flex-direction: column;
        /* Stack name input on mobile */
    }

    .comment-card {
        flex-direction: column;
        /* Stack avatar and content */
        align-items: flex-start;
        gap: 15px;
    }

    .comment-avatar {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
}

.comments-container {
    padding: 30px;
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid var(--neon-blue);
    margin-top: 40px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.comments-header {
    color: var(--neon-cyan);
    font-size: 1.5rem;
    margin-bottom: 25px;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

#supabase-comment-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 40px;
}

#supabase-comment-form .input-row {
    display: flex;
    gap: 15px;
}

#c-name,
#c-text {
    width: 100%;
    width: 100%;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    color: var(--text-main);
    padding: 15px;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    transition: 0.3s;
}

#c-name:focus,
#c-text:focus {
    outline: none;
    border-color: var(--neon-blue);
    background: rgba(45, 91, 255, 0.05);
    box-shadow: 0 0 15px rgba(45, 91, 255, 0.1);
}

#c-text {
    min-height: 100px;
    resize: vertical;
}

#c-submit {
    align-self: flex-start;
    background: var(--neon-blue);
    color: white;
    padding: 12px 30px;
    border: none;
    border-radius: 6px;
    font-weight: 700;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}

#c-submit:hover {
    background: var(--neon-cyan);
    color: black;
    box-shadow: 0 0 20px rgba(0, 243, 255, 0.4);
}

#c-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Comment List */
#supabase-comments-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Overriding and refining .comment-card */
.comment-card {
    background: #f1f5f9;
    /* Slate 100 */
    border: 1px solid var(--neon-blue);
    padding: 20px;
    border-radius: 10px;
    transition: 0.3s;
    animation: fadeIn 0.5s ease;
    display: block;
    /* Reset flex if needed */
}

.comment-card:hover {
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateX(5px);
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.comment-author {
    color: var(--neon-blue);
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.5px;
}

.comment-date {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.comment-body {
    color: var(--text-main);
    line-height: 1.6;
    font-size: 0.95rem;
    white-space: pre-wrap;
}

/* Ensure no-comments looks good */
.no-comments {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    padding: 20px;
    border: 1px dashed var(--glass-border);
}

/* === COMMENT SYSTEM STYLES === */

.comments-container {
    margin-top: 60px;
    padding-top: 40px;
    border-top: 2px solid var(--glass-border);
}

.comments-header {
    color: var(--neon-cyan);
    font-size: 1.5rem;
    margin-bottom: 25px;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

#supabase-comment-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 40px;
}

#supabase-comment-form .input-row {
    display: flex;
    gap: 15px;
}

#c-name,
#c-text {
    width: 100%;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    color: var(--text-main);
    padding: 15px;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    transition: 0.3s;
}

#c-name:focus,
#c-text:focus {
    outline: none;
    border-color: var(--neon-blue);
    background: rgba(45, 91, 255, 0.05);
    box-shadow: 0 0 10px rgba(45, 91, 255, 0.1);
}

#c-text {
    min-height: 120px;
    resize: vertical;
}

#c-submit {
    background: linear-gradient(135deg, var(--neon-blue) 0%, #5b8fff 100%);
    color: white;
    padding: 15px 40px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(45, 91, 255, 0.3);
    position: relative;
    overflow: hidden;
}

#c-submit:hover {
    background: linear-gradient(135deg, #5b8fff 0%, var(--neon-cyan) 100%);
    color: white;
    box-shadow: 0 6px 25px rgba(45, 91, 255, 0.5);
    transform: translateY(-3px) scale(1.02);
}

#c-submit::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: 0.5s;
}

#c-submit:hover::before {
    left: 100%;
}

#c-submit:disabled {
    background: linear-gradient(135deg, #94a3b8 0%, #cbd5e1 100%);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.6;
}

/* Comment List */
#supabase-comments-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.comment-card {
    background: rgba(45, 91, 255, 0.03);
    border: 1px solid var(--glass-border);
    padding: 20px;
    border-radius: 8px;
    transition: 0.3s;
}

.comment-card:hover {
    background: rgba(45, 91, 255, 0.06);
    border-color: var(--neon-blue);
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 10px;
}

.comment-author {
    color: var(--neon-blue);
    font-weight: 700;
    font-size: 1.05rem;
}

.comment-date {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.comment-body {
    color: var(--text-main);
    line-height: 1.6;
    word-wrap: break-word;
}

.no-comments {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    padding: 20px;
    border: 1px dashed var(--glass-border);
}

/* Responsive */
@media (max-width: 768px) {
    .comments-header {
        font-size: 1.3rem;
    }

    #supabase-comment-form .input-row {
        flex-direction: column;
    }
}

/* === REPLY FUNCTIONALITY === */

/* Reply Button */
.reply-btn {
    background: transparent;
    border: 1px solid var(--neon-blue);
    color: var(--neon-blue);
    padding: 6px 15px;
    border-radius: 5px;
    font-size: 0.85rem;
    cursor: pointer;
    margin-top: 10px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s;
    font-weight: 600;
}

.reply-btn:hover {
    background: var(--neon-blue);
    color: white;
    transform: translateX(3px);
}

.reply-btn i {
    font-size: 0.8rem;
}

/* Reply Form Container */
.reply-form-container {
    margin-top: 15px;
    padding-left: 15px;
    border-left: 2px solid var(--neon-cyan);
}

.reply-form {
    background: rgba(0, 243, 255, 0.05);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid rgba(0, 243, 255, 0.2);
}

.reply-to {
    color: var(--neon-cyan);
    font-size: 0.85rem;
    margin-bottom: 10px;
    font-style: italic;
}

.reply-to strong {
    color: var(--neon-blue);
}

.reply-input,
.reply-textarea {
    width: 100%;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    color: var(--text-main);
    padding: 10px;
    border-radius: 6px;
    font-family: 'Inter', sans-serif;
    margin-bottom: 10px;
    transition: 0.3s;
}

.reply-input:focus,
.reply-textarea:focus {
    outline: none;
    border-color: var(--neon-blue);
    background: rgba(45, 91, 255, 0.05);
    box-shadow: 0 0 10px rgba(45, 91, 255, 0.1);
}

.reply-textarea {
    min-height: 80px;
    resize: vertical;
}

.reply-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.reply-submit-btn,
.reply-cancel-btn {
    padding: 10px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.reply-submit-btn {
    background: linear-gradient(135deg, var(--neon-blue) 0%, #5b8fff 100%);
    color: white;
    box-shadow: 0 3px 12px rgba(45, 91, 255, 0.3);
}

.reply-submit-btn:hover {
    background: linear-gradient(135deg, #5b8fff 0%, var(--neon-cyan) 100%);
    color: white;
    box-shadow: 0 5px 20px rgba(45, 91, 255, 0.5);
    transform: translateY(-2px) scale(1.05);
}

.reply-cancel-btn {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    color: #475569;
    border: 1px solid #cbd5e1;
}

.reply-cancel-btn:hover {
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

/* Nested Comments - Responsive */
@media (max-width: 768px) {
    .comment-card {
        margin-left: 0 !important;
    }

    .comment-card[style*="margin-left"] {
        border-left: 2px solid var(--neon-cyan);
        padding-left: 12px;
    }

    .reply-form-container {
        padding-left: 10px;
    }
}