/**
 * Vinkeln Modern Comments System
 * Mobile-first responsive design
 */

/* ============================================
   VARIABLES & RESET
   ============================================ */
:root {
    --comment-spacing: 20px;
    --comment-border-radius: 8px;
    --comment-avatar-size: 48px;
    --comment-font-size: 1rem;
    --comment-line-height: 1.6;
}

/* ============================================
   COMMENTS CONTAINER
   ============================================ */
.vinkeln-comments-container {
    margin-top: 40px;
    padding: 0;
}

.comments-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border-light, #e0e0e0);
}

.comments-header h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-headings, #1a1a1a);
}

.comments-count {
    background: var(--primary-color, #d00000);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 600;
}

/* ============================================
   COMMENT FORM
   ============================================ */
.comments-form-container {
    margin-bottom: 32px;
}

.vinkeln-comment-form {
    background: var(--background-light, #f9f9f9);
    border: 1px solid var(--border-light, #e0e0e0);
    border-radius: var(--comment-border-radius);
    padding: 24px;
}

.comment-form-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.comment-form-fields input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-light, #ddd);
    border-radius: 6px;
    font-size: 1rem;
    background: white;
}

.vinkeln-comment-form textarea {
    width: 100%;
    min-height: 120px;
    padding: 16px;
    border: 1px solid var(--border-light, #ddd);
    border-radius: 6px;
    font-size: 1rem;
    line-height: 1.5;
    resize: vertical;
    background: white;
    margin-bottom: 16px;
}

.vinkeln-comment-form textarea:focus,
.comment-form-fields input:focus {
    outline: none;
    border-color: var(--primary-color, #d00000);
    box-shadow: 0 0 0 3px rgba(208, 0, 0, 0.1);
}

.comment-submit-btn {
    background: var(--primary-color, #d00000);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.comment-submit-btn:hover {
    background: var(--secondary-color, #a00000);
    transform: translateY(-1px);
}

.comment-submit-btn:disabled {
    background: var(--text-secondary, #666);
    cursor: not-allowed;
    transform: none;
}

.btn-loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-loading::after {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   COMMENTS LIST
   ============================================ */
.comments-list-container {
    margin-top: 32px;
}

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

/* ============================================
   INDIVIDUAL COMMENT
   ============================================ */
.vinkeln-comment {
    display: flex;
    gap: 16px;
    padding: 20px;
    background: white;
    border: 1px solid var(--border-light, #e0e0e0);
    border-radius: var(--comment-border-radius);
    transition: all 0.2s ease;
}

.vinkeln-comment:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.comment-avatar img {
    width: var(--comment-avatar-size);
    height: var(--comment-avatar-size);
    border-radius: 50%;
    object-fit: cover;
}

.comment-content-wrapper {
    flex: 1;
    min-width: 0;
}

.comment-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.comment-author {
    font-weight: 600;
    color: var(--text-headings, #1a1a1a);
}

.comment-date {
    font-size: 0.875rem;
    color: var(--text-secondary, #666);
}

.comment-text {
    font-size: var(--comment-font-size);
    line-height: var(--comment-line-height);
    color: var(--text-main, #333);
    margin-bottom: 12px;
}

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

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

.comment-actions {
    display: flex;
    gap: 12px;
}

.comment-reply-btn {
    background: none;
    border: 1px solid var(--border-light, #ddd);
    color: var(--text-secondary, #666);
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.comment-reply-btn:hover {
    background: var(--primary-color, #d00000);
    color: white;
    border-color: var(--primary-color, #d00000);
}

/* ============================================
   NESTED COMMENTS
   ============================================ */
.vinkeln-comment .vinkeln-comment {
    margin-left: 64px;
    margin-top: 16px;
    background: var(--background-off-white, #f5f5f5);
}

/* ============================================
   ERROR & LOADING STATES
   ============================================ */
.comments-closed {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary, #666);
    font-style: italic;
}

.comment-error {
    background: #fee;
    color: #c00;
    padding: 16px;
    border-radius: 6px;
    margin: 16px 0;
}

.comment-loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary, #666);
}

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

/* Tablet (768px - 992px) */
@media (max-width: 992px) {
    .vinkeln-comments-container {
        margin-top: 32px;
    }
    
    .comments-header h3 {
        font-size: 1.4rem;
    }
}

/* Mobile (max-width: 767px) */
@media (max-width: 767px) {
    .vinkeln-comments-container {
        margin-top: 24px;
        padding: 0 16px;
    }
    
    .comments-header {
        margin-bottom: 20px;
    }
    
    .comments-header h3 {
        font-size: 1.3rem;
    }
    
    .vinkeln-comment-form {
        padding: 20px;
    }
    
    .comment-form-fields {
        grid-template-columns: 1fr;
    }
    
    .vinkeln-comment {
        padding: 16px;
        gap: 12px;
    }
    
    .comment-avatar img {
        width: 40px;
        height: 40px;
    }
    
    .vinkeln-comment .vinkeln-comment {
        margin-left: 52px;
    }
}

/* Small mobile (max-width: 480px) */
@media (max-width: 480px) {
    .vinkeln-comments-container {
        padding: 0 12px;
    }
    
    .vinkeln-comment-form {
        padding: 16px;
    }
    
    .comment-submit-btn {
        width: 100%;
    }
}

/* ============================================
   DARK MODE SUPPORT
   ============================================ */
.dark-mode .vinkeln-comments-container {
    --background-light: #222;
    --background-off-white: #2a2a2a;
    --border-light: #444;
    --text-main: #eee;
    --text-secondary: #aaa;
    --text-headings: #fff;
}

.dark-mode .vinkeln-comment {
    background: var(--background-light);
    border-color: var(--border-light);
}

.dark-mode .vinkeln-comment-form {
    background: var(--background-off-white);
    border-color: var(--border-light);
}

.dark-mode .vinkeln-comment-form textarea,
.dark-mode .comment-form-fields input {
    background: var(--background-light);
    border-color: var(--border-light);
    color: var(--text-main);
}

.dark-mode .vinkeln-comment .vinkeln-comment {
    background: var(--background-off-white);
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes commentSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.vinkeln-comment.new {
    animation: commentSlideIn 0.3s ease-out;
}

/* ============================================
   LOGIN REQUIRED SECTION
   ============================================ */
.comment-login-required {
    background: var(--background-light, #f9f9f9);
    border: 1px solid var(--border-light, #e0e0e0);
    border-radius: var(--comment-border-radius);
    padding: 32px;
    text-align: center;
    margin-bottom: 32px;
}

.comment-login-required p {
    font-size: 1.1rem;
    color: var(--text-main, #333);
    margin-bottom: 20px;
}

.login-popup-trigger {
    background: var(--primary-color, #d00000);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.login-popup-trigger:hover {
    background: var(--secondary-color, #a00000);
    transform: translateY(-1px);
}

.dark-mode .comment-login-required {
    background: var(--background-off-white, #2a2a2a);
    border-color: var(--border-light, #444);
}