/* File: css/styles.css */

/* ------------------------- */
/*        CSS Variables      */
/* ------------------------- */
:root {
    --font-primary: 'Roboto', Arial, sans-serif;
    --color-primary: #bc360a;
    --color-secondary: #f3f2f1;
    --color-success: #28a745;
    --color-error: #dc3545;
    --color-highlight: #ffff99;
    --text-color-primary: #0b0c0c;
    --text-color-secondary: #6c757d;
    --transition-speed: 0.3s;
    --border-radius: 4px;
    --border-radius-lg: 8px;
    --box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* ------------------------- */
/*        Global Styles      */
/* ------------------------- */
body {
    font-family: var(--font-primary);
    color: var(--text-color-primary);
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* Utility Classes */
.text-center {
    text-align: center;
}
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }

/* ------------------------- */
/*       Container Styles    */
/* ------------------------- */
.icc-comment-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

/* Form and Share Menu */
.icc-comment-form, .icc-share-menu {
    background: #ffffff;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--box-shadow);
    animation: fadeIn var(--transition-speed) ease-in-out;
    padding: 20px 30px;
    width: 90%;
    max-width: 500px;
}

/* ------------------------- */
/*        Button Styles      */
/* ------------------------- */
.button {
    padding: 8px 12px;
    font-size: 16px;
    cursor: pointer;
    border: none;
    border-radius: var(--border-radius);
    transition: background-color var(--transition-speed), box-shadow var(--transition-speed);
}

.icc-submit-button, .button-primary {
    background-color: var(--color-primary);
    color: #fff;
    box-shadow: 0 2px 0 #842607;
}

.icc-cancel-button, .button-secondary {
    background-color: var(--color-secondary);
    box-shadow: 0 2px 0 #929191;
    color: var(--text-color-primary);
}

.button-primary:hover, .icc-submit-button:hover {
    background-color: #842607;
}

.button-secondary:hover, .icc-cancel-button:hover {
    background-color: #dbdad9;
}

.button:disabled, .icc-submit-button:disabled, .icc-cancel-button:disabled {
    opacity: 0.5;
    cursor: default;
}

.button-warning {
    background-color: #d4351c;
    color: #fff;
    box-shadow: 0 2px 0 #55150b;
}

.button-warning:hover {
    background-color: #aa2a16;
}

/* ------------------------- */
/*     Flash Messages        */
/* ------------------------- */
.icc-flash-message {
    font-family: var(--font-primary);
    font-size: 16px;
    line-height: 1.25;
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 20px;
    border-radius: var(--border-radius-lg);
    z-index: 10000;
    box-shadow: var(--box-shadow);
    display: block;
    animation: fadein 0.5s, fadeout 0.5s 4.5s;
    margin-bottom: 15px;
}

.icc-flash-success { background-color: var(--color-success); color: #fff; }
.icc-flash-error { background-color: var(--color-error); color: #fff; }

@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeout { from { opacity: 1; } to { opacity: 0; } }

/* ------------------------- */
/*    Text Area Styling      */
/* ------------------------- */
textarea, .icc-textarea, .icc-form-group textarea {
    font-family: var(--font-primary);
    font-size: 16px;
    line-height: 1.25;
    width: 100%;
    min-height: 40px;
    margin-bottom: 20px;
    padding: 5px;
    resize: vertical;
    border: 2px solid var(--text-color-primary);
    border-radius: 0;
    transition: border-color var(--transition-speed);
    box-sizing: border-box;
}

textarea:focus, .icc-textarea:focus {
    outline: 3px solid #fd0;
    border-color: var(--text-color-primary);
}

.icc-textarea--error {
    border-color: #d4351c;
}

.icc-textarea--error:focus {
    border-color: var(--text-color-primary);
}

/* ------------------------- */
/*    reCAPTCHA Styling      */
/* ------------------------- */
.icc-recaptcha {
    margin-bottom: 15px;
}

/* ------------------------- */
/*   Context Menu Styling    */
/* ------------------------- */
#icc-context-menu {
    background: #fff;
    border: 1px solid #ddd;
    padding: 10px;
    z-index: 9999;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    position: absolute;
    display: flex;
    gap: 8px;
}

.icc-context-menu-button {
    padding: 6px 12px;
    font-size: 14px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
}

#icc-toggle-comment { background-color: #0073aa; color: #fff; }
#icc-share-text { background-color: #f1f1f1; color: #333; }

/* ------------------------- */
/*     Share Menu Styling    */
/* ------------------------- */
#icc-share-menu ul { list-style: none; padding: 0; margin: 0; }
.icc-share-link { padding: 8px 0; color: #333; text-decoration: none; }
.icc-share-link:hover { color: #0073aa; }

/* ------------------------- */
/*        Comments           */
/* ------------------------- */
.icc-comments-section { margin-top: 30px; padding: 0 20px; }
.icc-comments-section h3 { margin-bottom: 20px; color: #333; }

.icc-comment {
    border: 1px solid #e2e2e2;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 15px;
    background-color: #f9f9f9;
}

.icc-comment-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
}

.icc-comment-author { font-weight: 600; color: #0073aa; }
.icc-comment-date { font-size: 12px; color: #777; }

.icc-reply-button {
    background: none;
    border: none;
    color: #0073aa;
    cursor: pointer;
    font-size: 14px;
    padding: 0;
    transition: color var(--transition-speed);
}

.icc-reply-button:hover { color: #005177; }

.icc-reply-form {
    margin-top: 10px;
    background: #f9f9f9;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
}

.icc-highlight {
    background-color: var(--color-highlight);
    transition: background-color 0.3s ease;
}

/* ------------------------- */
/*   Responsive and Dark     */
/* ------------------------- */
@media (max-width: 600px) {
    .icc-comment-form { padding: 15px 20px; }
    #icc-context-menu { flex-direction: column; gap: 5px; }
    .icc-context-menu-button { width: 100%; }
}

@media (prefers-color-scheme: dark) {
    .icc-comment-container { background: rgba(0,0,0,0.8); }
    .icc-comment-form { background: #2c2c2c; color: #fff; box-shadow: 0 4px 12px rgba(0,0,0,0.5); }
    .icc-form-group label, .icc-comment-author, .icc-comment-date { color: #f1f1f1; }
    .icc-textarea { background: #3c3c3c; border-color: #555; color: #f1f1f1; }
    .icc-submit-button { background-color: #1a73e8; }
    .icc-cancel-button { background-color: #555; color: #fff; }
    #icc-share-text { background-color: #555; color: #fff; }
}

/* Share Menu Styling */
#icc-share-menu {
    position: absolute;
    top: 0; /* Adjusted dynamically via JS */
    left: 0; /* Adjusted dynamically via JS */
    background: #fff;
    border: 1px solid #ddd;
    padding: 15px;
    z-index: 10000;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transform: scale(0.9);
    transition: transform 0.2s ease, opacity 0.3s ease-in-out;
    opacity: 0;
}


/* ---------------------------------- */
/*       Side Panel Styling           */
/* ---------------------------------- */
.icc-side-panel {
    position: fixed;
    top: 0;
    right: -360px; /* Start off-screen, adjust width as needed */
    width: 350px; /* Panel width */
    height: 100%;
    background-color: #ffffff;
    box-shadow: -3px 0 10px rgba(0,0,0,0.1);
    transition: right 0.3s ease-in-out;
    z-index: 10001; /* Above most content, below modals if any */
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.icc-side-panel.open {
    right: 0;
}

.icc-side-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background-color: #f7f7f7;
    border-bottom: 1px solid #dddddd;
}

.icc-side-panel-header h3 {
    margin: 0;
    font-size: 1.2em;
    color: var(--text-color-primary);
}

/* Using existing .icc-close-button from share popup for consistency,
   but can be specific if needed: #icc-close-side-panel */
#icc-close-side-panel { /* More specific if needed */
    background: none;
    border: none;
    font-size: 1.6em;
    color: #777777;
    cursor: pointer;
    padding: 0 5px;
    line-height: 1;
}
#icc-close-side-panel:hover {
    color: #333333;
}

#icc-side-panel-content {
    padding: 15px;
    flex-grow: 1; /* Allows content to take available space */
    overflow-y: auto; /* Scroll content area if it overflows */
}

.icc-side-panel-comment-item {
    padding: 10px 0;
    border-bottom: 1px solid #eeeeee;
}
.icc-side-panel-comment-item:last-child {
    border-bottom: none;
}

.icc-side-panel-comment-header {
    margin-bottom: 5px;
}

.icc-side-panel-comment-author {
    font-weight: bold;
    color: var(--text-color-primary);
    margin-right: 8px;
}

.icc-side-panel-comment-date {
    font-size: 0.85em;
    color: var(--text-color-secondary);
}

.icc-side-panel-comment-body {
    font-size: 0.95em;
    line-height: 1.5;
    color: #333333;
    margin-bottom: 8px;
    word-wrap: break-word;
}

.icc-side-panel-comment-context {
    font-size: 0.9em;
    color: #555555;
    margin-bottom: 8px;
    padding-left: 10px;
    border-left: 3px solid #dddddd;
}
.icc-side-panel-comment-context em {
    font-style: normal;
    font-weight: 500;
}

.icc-side-panel-comment-actions {
    font-size: 0.9em;
}

.icc-side-panel-comment-actions .icc-reply-to-comment-button,
.icc-side-panel-comment-actions .icc-report-comment-button {
    background: none;
    border: none;
    color: var(--color-primary);
    cursor: pointer;
    padding: 2px 5px;
    margin-right: 8px;
    font-size: 0.9em;
}
.icc-side-panel-comment-actions .icc-reply-to-comment-button:hover,
.icc-side-panel-comment-actions .icc-report-comment-button:hover {
    text-decoration: underline;
}

.icc-side-panel-replies {
    margin-top: 10px;
    /* Indentation handled by margin-left in renderCommentForPanel JS function */
}

/* Reply form within side panel (if js/reply.js adds it) */
.icc-side-panel .icc-reply-form-container {
    padding: 10px; /* Add some padding if form is directly in replies div */
    margin-top: 5px;
    background-color: #f9f9f9; /* Slightly different background for form */
    border-radius: var(--border-radius);
}
.icc-side-panel .icc-reply-form textarea {
    min-height: 60px;
    font-size: 0.9em;
}
.icc-side-panel .icc-reply-form-actions button {
    font-size: 0.9em;
    padding: 6px 10px;
}

#icc-share-menu.show {
    transform: scale(1);
    opacity: 1;
}

#icc-share-menu h4 {
    margin: 0 0 10px;
}

#icc-share-menu ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

#icc-share-menu ul li {
    margin-bottom: 8px;
}
#icc-share-menu ul li:last-child {
    margin-bottom: 0;
}

#icc-share-menu ul li a {
    font-size: 16px;
    font-weight: 500;
    text-decoration: none;
    color: inherit;
    display: flex;
    align-items: center;
    padding: 8px 0;
}

#icc-share-menu ul li a i {
    margin-right: 10px;
}

#icc-share-menu ul li a:hover {
    text-decoration: underline;
}

/* Facebook */
.facebook-icon {
    color: #3b5998; /* Facebook Blue */
}

/* BlueSky */
.bluesky-icon {
    color: #1d9bf0; /* BlueSky color, similar to Twitter blue */
}

/* Mastodon */
.mastodon-icon {
    color: #6364ff; /* Mastodon Blue */
}

/* LinkedIn */
.linkedin-icon {
    color: #0077b5; /* LinkedIn Blue */
}

/* Email (Generic) */
.email-icon {
    color: #dd4b39; /* Gmail Red or similar for email */
}

/* Copy Link */
.copy-icon {
    color: #555; /* A neutral gray color for Copy Link */
}

/* Additional Styling for Hover Effects */
#icc-share-menu ul li a:hover i {
    filter: brightness(1.2); /* Slightly brighten icon on hover */
}

/* Blur Effect Styling */
.blurred {
    filter: blur(4px);
    pointer-events: none; /* Prevent interactions while loading */
}

    /* CSS for loading spinner */
    .icc-loading-spinner { /* Changed to class selector used in JS */
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        border: 8px solid #f3f3f3;
        border-top: 8px solid #3498db;
        border-radius: 50%;
        width: 60px;
        height: 60px;
        animation: spin 1s linear infinite;
        z-index: 10001; /* Higher than the blurred background */
    }

    @keyframes spin {
        0% { transform: rotate(0deg); }
        100% { transform: rotate(360deg); }
    }

/* ------------------------- */
/* Comment Indicator Styling */
/* ------------------------- */
.icc-indicator-icon {
    color: #ffc107; /* Using a warning-like color, can be adjusted */
    margin-left: 5px;
    margin-right: 2px; /* Added some right margin for spacing */
    font-size: 0.8em;
    cursor: pointer;
    display: inline-block; /* Ensures it behaves well with surrounding text */
}

.icc-indicator-icon:hover {
    color: #e0a800; /* Darken color on hover */
}

/* ---------------------------------- */
/* Dynamic Share Popup Menu Styling   */
/* ---------------------------------- */
#icc-share-popup-menu {
    background-color: #ffffff;
    border: 1px solid #cccccc;
    box-shadow: 0 5px 15px rgba(0,0,0,0.15);
    padding: 15px;
    border-radius: var(--border-radius-lg, 8px);
    z-index: 10002; /* Higher than context menu and loading spinner */
    min-width: 280px;
    max-width: 350px;
    position: absolute; /* Positioned by JS */
    display: none; /* Initially hidden, shown by JS */
}

.icc-share-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eeeeee;
}

.icc-share-popup-header h4 {
    margin: 0;
    font-size: 1.1em; /* Slightly smaller than h3 */
    color: var(--text-color-primary, #0b0c0c);
    font-weight: 600;
}

#icc-close-share-popup {
    background: none;
    border: none;
    font-size: 1.5em;
    color: #888888;
    cursor: pointer;
    padding: 0 5px;
    line-height: 1;
}
#icc-close-share-popup:hover {
    color: #555555;
}

.icc-share-popup-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column; /* Stack items vertically */
    gap: 8px; /* Space between list items */
}

.icc-share-popup-list li a,
.icc-share-popup-list li button#icc-copy-share-link { /* Target button specifically if it's a button */
    display: flex; /* Use flex for icon and text alignment */
    align-items: center;
    padding: 10px 12px;
    background-color: #f7f7f7;
    color: var(--text-color-primary, #333);
    text-decoration: none;
    border-radius: var(--border-radius, 4px);
    transition: background-color 0.2s ease, color 0.2s ease;
    border: 1px solid #dddddd;
    font-size: 0.95em;
    text-align: left; /* Ensure button text is left aligned */
    width: 100%; /* Make buttons full width of popup */
    cursor: pointer;
}

.icc-share-popup-list li button#icc-copy-share-link {
    font-family: var(--font-primary); /* Ensure button inherits font */
}


.icc-share-popup-list li a:hover,
.icc-share-popup-list li button#icc-copy-share-link:hover {
    background-color: #e9e9e9;
    color: #000;
}

.icc-share-popup-list li a i {
    margin-right: 10px; /* Space between icon and text */
    font-size: 1.1em; /* Slightly larger icons */
    width: 20px; /* Fixed width for icon alignment */
    text-align: center;
}

/* Specific icon colors - can reuse from existing #icc-share-menu if desired */
.icc-share-popup-list li a i.fa-facebook { color: #3b5998; }
.icc-share-popup-list li a i.fa-twitter { color: #1da1f2; }
.icc-share-popup-list li a i.fa-linkedin { color: #0077b5; }
.icc-share-popup-list li a i.fa-envelope { color: #dd4b39; }
.icc-share-popup-list li button#icc-copy-share-link i.fa-copy { color: #555555; }


/* Ensure the hidden input for copy-paste remains completely hidden but functional */
#icc-permalink-to-copy {
    position: absolute;
    left: -9999px;
    top: auto;
    width: 1px;
    height: 1px;
    opacity: 0;
}