/* Keep only essential styles that aren't covered by TailwindCSS */

/* Table styles for admin pages that still use Bootstrap tables */
.table {
    width: 80%;
    background-color: #FFFFFF;
    border-radius: 10px;
    box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    margin: 20px 0;
}

.table th {
    padding: 10px 0px 10px 10px;
    text-align: left;
    font-size: 16px;
    background-color: #F8F8F8;
}

.table tr:hover {
    background-color: #E7E7E7;
}

.table td {
    padding: 10px;  
    text-align: left;
    font-size: 14px;
}

/* Placeholder styles for loading states */
.plh {
    display: inline-block;
    width: 80px;
    height: 1.2em;
    background-color: #d3d3d3;
    border-radius: 4px;
}

/* Google Maps specific styling */
.gm-style-iw {
    font-family: inherit;
}

/* Ensure proper Google Maps controls styling */
.gm-bundled-control {
    font-family: inherit;
}

/* Fix for Google Maps in TailwindCSS reset */
#map img {
    max-width: none !important;
}

#map label {
    width: auto;
    display: inline;
}

/* ============================================================================
   MODERN BUTTON STYLES - Refined, Professional Design
   ============================================================================ */

/* Primary Action Buttons - Soft Teal (Start, Resume) */
.btn-action-primary {
    background: linear-gradient(135deg, #0d9488 0%, #14b8a6 100%);
    color: white;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(13, 148, 136, 0.15);
}

.btn-action-primary:hover {
    background: linear-gradient(135deg, #0f766e 0%, #0d9488 100%);
    box-shadow: 0 4px 8px rgba(13, 148, 136, 0.25);
    transform: translateY(-1px);
}

/* Secondary Action Buttons - Neutral Slate (Pause, General) */
.btn-action-secondary {
    background: linear-gradient(135deg, #64748b 0%, #475569 100%);
    color: white;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(100, 116, 139, 0.15);
}

.btn-action-secondary:hover {
    background: linear-gradient(135deg, #475569 0%, #334155 100%);
    box-shadow: 0 4px 8px rgba(100, 116, 139, 0.25);
    transform: translateY(-1px);
}

/* Destructive Action Buttons - Muted Red (Stop, Delete) */
.btn-action-danger {
    background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
    color: white;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(220, 38, 38, 0.15);
}

.btn-action-danger:hover {
    background: linear-gradient(135deg, #b91c1c 0%, #dc2626 100%);
    box-shadow: 0 4px 8px rgba(220, 38, 38, 0.25);
    transform: translateY(-1px);
}

/* Info/Analysis Buttons - Modern Indigo (Analysis, Reports) */
.btn-action-info {
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
    color: white;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(79, 70, 229, 0.15);
}

.btn-action-info:hover {
    background: linear-gradient(135deg, #4338ca 0%, #4f46e5 100%);
    box-shadow: 0 4px 8px rgba(79, 70, 229, 0.25);
    transform: translateY(-1px);
}

/* Warning/Retry Buttons - Soft Amber (Retry, Warning) */
.btn-action-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
    color: white;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(245, 158, 11, 0.15);
}

.btn-action-warning:hover {
    background: linear-gradient(135deg, #d97706 0%, #f59e0b 100%);
    box-shadow: 0 4px 8px rgba(245, 158, 11, 0.25);
    transform: translateY(-1px);
}

/* Neutral Buttons - Light Gray (Cancel, Settings) */
.btn-action-neutral {
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    color: #374151;
    transition: all 0.2s ease;
    border: 1px solid #d1d5db;
}

.btn-action-neutral:hover {
    background: linear-gradient(135deg, #e5e7eb 0%, #d1d5db 100%);
    transform: translateY(-1px);
}

/* Loading/Starting State - Soft Purple */
.btn-action-loading {
    background: linear-gradient(135deg, #a78bfa 0%, #c4b5fd 100%);
    color: white;
    cursor: not-allowed;
    opacity: 0.85;
}

/* Status Badges - Softer, More Professional Colors */
.status-running {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.status-completed {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: #1e40af;
    border: 1px solid #93c5fd;
}

.status-failed {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.status-paused {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #92400e;
    border: 1px solid #fcd34d;
}

.status-queued {
    background: linear-gradient(135deg, #e9d5ff 0%, #d8b4fe 100%);
    color: #581c87;
    border: 1px solid #c084fc;
}

.status-action-required {
    background: linear-gradient(135deg, #fed7aa 0%, #fdba74 100%);
    color: #7c2d12;
    border: 1px solid #fb923c;
}

/* Disabled button state */
.btn-action-primary:disabled,
.btn-action-secondary:disabled,
.btn-action-danger:disabled,
.btn-action-info:disabled,
.btn-action-warning:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* ============================================================================
   TAB GROUP NAVIGATION STYLES

   Two-level tab structure for organized report navigation:
   - Top level: Tab groups (Overview, Technical, SEO, Performance)
   - Second level: Individual tabs within each group
   ============================================================================ */

/* Tab Group Active State */
.tab-group-active {
    background-color: #ffffff;
    color: #2563eb;
    border-bottom: 2px solid #2563eb;
    transition: all 0.2s ease;
}

/* Tab Group Inactive State */
.tab-group-inactive {
    background-color: transparent;
    color: #6b7280;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

.tab-group-inactive:hover {
    background-color: #f3f4f6;
    color: #374151;
}

/* ============================================================================
   UNIFORM ALERT BOX SYSTEM

   Design Philosophy:
   - All alert boxes share the same neutral base styling
   - Only the icon color indicates the alert type (success/warning/error/info)
   - Creates visual consistency and reduces visual noise
   - Emphasizes content over decoration
   ============================================================================ */

/* Base Alert Box - Uniform for all types */
.alert-box {
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1.5rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Alert Box with Header */
.alert-box-header {
    background-color: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem 0.5rem 0 0;
    border-bottom: 1px solid #e5e7eb;
    padding: 1rem 1.5rem;
}

.alert-box-body {
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-top: none;
    border-radius: 0 0 0.5rem 0.5rem;
    padding: 1.5rem;
}

/* Icon Colors - Only place where color differentiation occurs */
.alert-icon-success {
    color: #10b981;
}

.alert-icon-warning {
    color: #f59e0b;
}

.alert-icon-error {
    color: #ef4444;
}

.alert-icon-info {
    color: #3b82f6;
}

.alert-icon-purple {
    color: #a855f7;
}

.alert-icon-indigo {
    color: #6366f1;
}

/* Text Styling - Uniform across all alert types */
.alert-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #111827;
}

.alert-subtitle {
    font-size: 0.875rem;
    color: #6b7280;
    margin-top: 0.25rem;
}

.alert-description {
    font-size: 0.75rem;
    color: #9ca3af;
    margin-top: 0.25rem;
}

/* Count Badge - Uniform styling with icon-colored text */
.alert-count-success {
    font-size: 1.5rem;
    font-weight: 700;
    color: #10b981;
}

.alert-count-warning {
    font-size: 1.5rem;
    font-weight: 700;
    color: #f59e0b;
}

.alert-count-error {
    font-size: 1.5rem;
    font-weight: 700;
    color: #ef4444;
}

/* ============================================================================
   HEALTH INDICATORS

   Badge-style health status indicators with labels for better visibility
   ============================================================================ */

.health-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.625rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.health-indicator::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.health-excellent {
    background-color: #d1fae5;
    color: #065f46;
}

.health-excellent::before {
    background-color: #10b981;
}

.health-good {
    background-color: #dbeafe;
    color: #1e3a8a;
}

.health-good::before {
    background-color: #3b82f6;
}

.health-warning {
    background-color: #fef3c7;
    color: #78350f;
}

.health-warning::before {
    background-color: #f59e0b;
}

.health-error {
    background-color: #fee2e2;
    color: #7f1d1d;
}

.health-error::before {
    background-color: #ef4444;
}

/* Health Badge (for detail panel) */
.health-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 600;
}

.health-badge.health-excellent {
    background-color: #d1fae5;
    color: #065f46;
}

.health-badge.health-good {
    background-color: #dbeafe;
    color: #1e40af;
}

.health-badge.health-warning {
    background-color: #fef3c7;
    color: #92400e;
}

.health-badge.health-error {
    background-color: #fee2e2;
    color: #991b1b;
}

/* ============================================================================
   TREE VIEW STYLES

   Hierarchical tree structure for pages and resources
   ============================================================================ */

.tree-container {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.tree-node {
    position: relative;
}

.tree-node-content {
    transition: background-color 0.15s ease;
}

.tree-node-content:hover {
    background-color: #f9fafb;
}

.tree-node-toggle {
    cursor: pointer;
    transition: transform 0.2s ease;
}

.tree-node-toggle.rotate-90 {
    transform: rotate(90deg);
}

.tree-node-children {
    border-left: 1px solid #e5e7eb;
    margin-left: 10px;
}

.tree-node-children.hidden {
    display: none;
}

/* ============================================================================
   DETAIL PANEL (SLIDE-UP)

   Bottom sheet component for displaying comprehensive resource details
   ============================================================================ */

/* Overlay */
.detail-panel-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.detail-panel-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Panel */
.detail-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 80vh;
    background-color: #ffffff;
    border-radius: 1rem 1rem 0 0;
    box-shadow: 0 -10px 25px rgba(0, 0, 0, 0.1);
    z-index: 9999;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.detail-panel.active {
    transform: translateY(0);
}

/* Panel Header */
.detail-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.detail-panel-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #111827;
    margin: 0;
}

.detail-panel-close {
    background: none;
    border: none;
    color: #6b7280;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.375rem;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.detail-panel-close:hover {
    background-color: #f3f4f6;
    color: #111827;
}

/* Compact Sticky Header - Page/Resource info with close button */
.detail-panel-page-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: white;
    border-bottom: 2px solid #e5e7eb;
    padding: 0.75rem 1rem;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* Panel Content */
.detail-panel-content {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

/* Detail Sections */
.detail-section {
    padding: 1rem;
    background-color: #f9fafb;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
}

.detail-section-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

/* Button Styles for Detail Panel */
.btn-secondary {
    background-color: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.btn-secondary:hover {
    background-color: #e5e7eb;
    border-color: #9ca3af;
}

/* Responsive: Desktop */
@media (min-width: 768px) {
    .detail-panel {
        left: auto;
        right: 0;
        width: 600px;
        max-height: 100vh;
        border-radius: 1rem 0 0 1rem;
        transform: translateX(100%);
    }

    .detail-panel.active {
        transform: translateX(0);
    }

    .detail-panel.comment-mode {
        width: 65vw;
        max-width: 65vw;
    }
}

/* ============================================================================
   SMART URL CELL DISPLAY - Domain/Path Separation with Truncation
   ============================================================================ */

/* URL Cell Container */
.url-cell-container {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 250px;
    max-width: 400px;
    padding: 0.5rem 0;
}

.url-cell-container.compact {
    min-width: 200px;
    max-width: 300px;
}

.url-cell-container.readonly {
    cursor: default;
}

/* Domain Display - Bold, Prominent */
.url-cell-domain {
    font-size: 0.875rem;
    font-weight: 600;
    color: #1f2937;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.url-cell-domain.inline {
    display: inline;
    font-size: 0.8125rem;
}

/* Path Display - Smaller, Gray */
.url-cell-path {
    font-size: 0.75rem;
    color: #6b7280;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
    max-width: 100%;
}

.url-cell-path.inline {
    display: inline;
    margin-left: 0.25rem;
}

/* Action Buttons Container */
.url-cell-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

/* Constrain action buttons in table cells */
td .url-cell-actions {
    flex-wrap: wrap;
    max-width: 100%;
}

/* Copy Button */
.url-copy-btn {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    color: #6b7280;
    background-color: transparent;
    border: 1px solid #d1d5db;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.url-copy-btn:hover {
    color: #2563eb;
    border-color: #2563eb;
    background-color: #eff6ff;
}

.url-copy-btn:active {
    transform: scale(0.95);
}

/* Visit Link */
.url-visit-link {
    display: inline-flex;
    align-items: center;
    font-size: 0.75rem;
    color: #2563eb;
    text-decoration: none;
    transition: color 0.15s ease;
}

.url-visit-link:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

/* Tooltip Enhancement */
.url-cell-container[data-full-url]:hover .url-cell-path {
    color: #374151;
}

/* Table Column Width Control */
td .url-cell-container,
th .url-cell-container {
    width: 100% !important;
    min-width: 0 !important;        /* Remove fixed min-width constraint */
    max-width: 100% !important;     /* Constrain to column width */
}

/* =============================================================================
   Compact URL Cell for Redirect Tables
   ============================================================================= */

.url-cell-redirect {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;                  /* 2px gap between lines */
    min-width: 0;
    max-width: 200px;
}

.url-redirect-domain {
    font-size: 0.8125rem;           /* 13px */
    font-weight: 600;
    color: #1f2937;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.url-redirect-path {
    font-size: 0.6875rem;           /* 11px */
    color: #6b7280;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
}

.url-copy-btn-sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.125rem 0.375rem;     /* 2px 6px */
    font-size: 0.625rem;            /* 10px */
    color: #9ca3af;
    background-color: transparent;
    border: 1px solid #e5e7eb;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: all 0.15s ease;
    margin-top: 0.25rem;
    width: fit-content;
}

.url-copy-btn-sm:hover {
    color: #2563eb;
    border-color: #2563eb;
    background-color: #eff6ff;
}

/* Icon badge for folder counts in tree view */
.icon-with-badge {
    position: relative;
    display: inline-block;
    margin-right: 0.5rem;
}

.icon-count-badge {
    position: absolute;
    top: -6px;
    right: -8px;
    background-color: #3b82f6;  /* Blue background */
    color: white;
    font-size: 10px;
    font-weight: 600;
    line-height: 1;
    padding: 2px 4px;
    border-radius: 8px;
    min-width: 16px;
    text-align: center;
    border: 1px solid white;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Smaller badge for large counts (3+ digits) */
.icon-count-badge.large-count {
    font-size: 9px;
    padding: 2px 3px;
}

/* Responsive: Mobile */
@media (max-width: 768px) {
    .url-cell-container {
        min-width: 180px;
        max-width: 280px;
    }

    .url-cell-domain {
        font-size: 0.8125rem;
    }

    .url-cell-path {
        font-size: 0.6875rem;
    }

    .url-cell-actions {
        flex-wrap: wrap;
    }
}

/* =============================================================================
   Anchor Link Styling for Clickable Alert Boxes
   ============================================================================= */

/* Alert box as clickable link - remove default link styling */
a.alert-box {
    text-decoration: none;
    color: inherit;
}

a.alert-box:hover {
    text-decoration: none;
}

/* Smooth scroll behavior for anchor navigation */
html {
    scroll-behavior: smooth;
}

/* =============================================================================
   URL Comments System Styles
   ============================================================================= */

/* Comment icon badge (purple gradient for consistency with share badges) */
.comment-count-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: linear-gradient(135deg, #a855f7 0%, #c084fc 100%);
    color: white;
    font-size: 10px;
    font-weight: 600;
    line-height: 1;
    padding: 2px 5px;
    border-radius: 8px;
    min-width: 14px;
    text-align: center;
    border: 1px solid white;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
    pointer-events: none;
}

/* Comment button positioning for badge */
.url-comment-btn {
    position: relative;
}


/* Base layout for detail panel container and main content */
.detail-panel-container {
    display: flex;
    flex-direction: row;
    width: 100%;
    max-width: 60vw;  /* Normal width when comments closed */
    height: 100%;
    overflow: hidden;
}

.detail-panel-main {
    flex: 1;  /* Take all available space when comments closed */
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
/* Detail panel in comment mode - wider layout */
.detail-panel.comment-mode .detail-panel-container {
    max-width: 65vw;
    width: 65vw;
}

.detail-panel.comment-mode .detail-panel-main {
    flex: none;  /* Override flex: 1 to use fixed width */
    width: 67%;
    border-right: 1px solid #e5e7eb;
    transition: width 0.3s ease;
}

.detail-panel.comment-mode .detail-panel-comments {
    display: flex !important;
    width: 33%;
    transition: width 0.3s ease;
}

/* Comment toggle button in detail panel header */
.btn-comment-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: linear-gradient(135deg, #a855f7 0%, #c084fc 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-comment-toggle:hover {
    background: linear-gradient(135deg, #9333ea 0%, #a855f7 100%);
    box-shadow: 0 2px 4px rgba(168, 85, 247, 0.3);
}

.btn-comment-toggle .comment-count {
    background: rgba(255, 255, 255, 0.3);
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 11px;
    min-width: 20px;
    text-align: center;
}

/* Comments section container */
.detail-panel-comments {
    display: none;
    flex-direction: column;
    background: #f9fafb;
    overflow: hidden;
}

/* Comments header */
.comments-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
    background: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.comments-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    margin: 0;
}

.btn-close-comments {
    background: none;
    border: none;
    font-size: 24px;
    color: #6b7280;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.btn-close-comments:hover {
    background: #f3f4f6;
    color: #111827;
}

/* Comments list */
.comments-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.comments-list:empty::before {
    content: "No comments yet. Be the first to add one!";
    display: block;
    text-align: center;
    color: #9ca3af;
    font-size: 14px;
    padding: 40px 20px;
}

/* Individual comment item */
.comment-item {
    background: white;
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.2s ease;
}

.comment-item:hover {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
    gap: 8px;
}

.comment-author {
    font-weight: 600;
    font-size: 14px;
    color: #0d9488; /* Teal brand color */
    flex-shrink: 0;
}

.comment-date {
    font-size: 11px;
    color: #9ca3af;
    flex-shrink: 0;
}

.comment-text {
    color: #374151;
    font-size: 14px;
    line-height: 1.6;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Markdown formatting in comments */
.comment-text p {
    margin: 0 0 8px 0;
}

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

.comment-text strong {
    font-weight: 600;
    color: #111827;
}

.comment-text em {
    font-style: italic;
}

.comment-text a {
    color: #0d9488;
    text-decoration: underline;
}

.comment-text a:hover {
    color: #0f766e;
}

.comment-text code {
    background: #f3f4f6;
    padding: 2px 5px;
    border-radius: 3px;
    font-size: 0.9em;
    font-family: 'Monaco', 'Courier New', monospace;
}

.comment-text pre {
    background: #f3f4f6;
    padding: 8px 10px;
    border-radius: 5px;
    overflow-x: auto;
    margin: 8px 0;
}

.comment-text ul,
.comment-text ol {
    margin: 8px 0;
    padding-left: 24px;
}

.comment-text li {
    margin: 4px 0;
}

/* Comment action buttons */
.comment-actions {
    margin-top: 10px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.comment-actions button {
    font-size: 12px;
    padding: 4px 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-comment-edit {
    background: #e0f2fe;
    color: #0369a1;
}

.btn-comment-edit:hover {
    background: #bae6fd;
}

.btn-comment-delete {
    background: #fee2e2;
    color: #dc2626;
}

.btn-comment-delete:hover {
    background: #fecaca;
}

.btn-comment-save {
    background: linear-gradient(135deg, #0d9488 0%, #14b8a6 100%);
    color: white;
}

.btn-comment-save:hover {
    background: linear-gradient(135deg, #0f766e 0%, #0d9488 100%);
}

.btn-comment-cancel {
    background: #f3f4f6;
    color: #6b7280;
}

.btn-comment-cancel:hover {
    background: #e5e7eb;
    color: #374151;
}

/* Comment edit textarea */
.comment-edit-textarea {
    width: 100%;
    min-height: 80px;
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
    margin-bottom: 8px;
}

.comment-edit-textarea:focus {
    outline: none;
    border-color: #0d9488;
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.1);
}

/* Comments form (add new comment) */
.comments-form {
    padding: 16px 20px;
    background: white;
    border-top: 1px solid #e5e7eb;
}

/* Markdown toolbar */
.markdown-toolbar {
    display: flex;
    gap: 4px;
    margin-bottom: 10px;
    padding: 8px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px 6px 0 0;
}

.markdown-btn {
    padding: 6px 10px;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
    color: #374151;
}

.markdown-btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
    color: #111827;
}

.markdown-btn i {
    font-size: 12px;
}

.comments-form.disabled {
    background: #f9fafb;
    pointer-events: none;
    opacity: 0.6;
}

.comments-form-permission-message {
    text-align: center;
    color: #6b7280;
    font-size: 13px;
    padding: 12px;
}

.comments-form textarea {
    width: 100%;
    min-height: 80px;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.comments-form textarea:focus {
    outline: none;
    border-color: #0d9488;
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.1);
}

.comments-form textarea::placeholder {
    color: #9ca3af;
}

.comments-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 10px;
}

.comments-form-actions button {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-cancel {
    background: #f3f4f6;
    color: #6b7280;
}

.btn-cancel:hover {
    background: #e5e7eb;
    color: #374151;
}

.btn-submit {
    background: linear-gradient(135deg, #0d9488 0%, #14b8a6 100%);
    color: white;
}

.btn-submit:hover {
    background: linear-gradient(135deg, #0f766e 0%, #0d9488 100%);
    box-shadow: 0 2px 4px rgba(13, 148, 136, 0.3);
}

.btn-submit:disabled {
    background: #d1d5db;
    cursor: not-allowed;
}

/* Loading state */
.comments-loading {
    text-align: center;
    padding: 40px 20px;
    color: #6b7280;
}

.comments-loading i {
    font-size: 24px;
    animation: spin 1s linear infinite;
}

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

/* Error state */
.comments-error {
    background: #fee2e2;
    color: #dc2626;
    padding: 12px 16px;
    border-radius: 6px;
    margin: 16px;
    font-size: 14px;
}

/* Mobile responsive adjustments */
@media (max-width: 1024px) {
    .detail-panel.comment-mode .detail-panel-container {
        max-width: 65vw;
        width: 65vw;
    }

    .detail-panel.comment-mode .detail-panel-main {
        width: 60%;
    }

    .detail-panel.comment-mode .detail-panel-comments {
        width: 40%;
    }
}

@media (max-width: 768px) {
    /* Stack vertically on mobile */
    .detail-panel.comment-mode .detail-panel-container {
        flex-direction: column;
    }

    .detail-panel.comment-mode .detail-panel-main {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #e5e7eb;
        max-height: 50vh;
        overflow-y: auto;
    }

    .detail-panel.comment-mode .detail-panel-comments {
        width: 100%;
        max-height: 50vh;
    }

    .comment-count-badge {
        font-size: 9px;
        padding: 1px 4px;
    }
}

/* Active state for comment toggle button */
.btn-comment-toggle.active {
    background: linear-gradient(135deg, #7c3aed 0%, #9333ea 100%);
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.4);
}

.btn-comment-toggle.active i.fa-comment::before {
    content: "\f075"; /* filled comment icon */
}