/* 
 * Format Styles for Multi-Format Note Generation (Phase 4)
 * Styles for format badges, selectors, thread viewers, and filters
 */

/* ============================================================================
   Format Badges
   ============================================================================ */

.format-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-right: 8px;
    vertical-align: middle;
}

.format-badge-substack {
    background-color: #4A90E2;
    color: white;
}

.format-badge-linkedin {
    background-color: #0A66C2;
    color: white;
}

.format-badge-thread {
    background-color: #7B68EE;
    color: white;
}

.format-badge-icon {
    margin-right: 4px;
}

/* ============================================================================
   Format Selector (Segmented Control)
   ============================================================================ */

.format-selector-container {
    margin: 15px 0;
}

.format-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 12px;
}

.segmented-control {
    display: flex;
    width: 100%;
    background: #f3f4f6;
    border-radius: 8px;
    padding: 4px;
    gap: 4px;
}

.segment {
    flex: 1;
    padding: 8px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease-out;
    border: none;
    background: transparent;
    color: #6b7280;
    white-space: nowrap;
    text-align: center;
}

.segment:hover:not(:disabled) {
    color: #111827;
}

.segment.active {
    background: white;
    color: #7c3aed;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.segment:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.format-description {
    display: block;
    font-size: 13px;
    color: #6b7280;
    margin-top: 8px;
    line-height: 1.5;
}

/* ============================================================================
   AI Format Suggestion
   ============================================================================ */

.format-suggestion {
    margin: 15px 0;
    padding: 12px 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.format-suggestion-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.format-suggestion-icon {
    font-size: 20px;
}

.format-suggestion-text {
    flex: 1;
}

.format-suggestion-main {
    font-weight: 600;
    font-size: 14px;
}

.format-suggestion-reason {
    font-size: 12px;
    opacity: 0.9;
    margin-top: 3px;
}

.format-suggestion-confidence {
    font-size: 11px;
    opacity: 0.8;
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 8px;
}

.format-suggestion-button {
    background: white;
    color: #667eea;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
}

.format-suggestion-button:hover {
    transform: scale(1.05);
}

/* ============================================================================
   Thread Viewer
   ============================================================================ */

.thread-viewer {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    margin: 15px 0;
}

.thread-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #dee2e6;
}

.thread-title {
    font-size: 16px;
    font-weight: 600;
    color: #7B68EE;
    display: flex;
    align-items: center;
    gap: 8px;
}

.thread-actions {
    display: flex;
    gap: 8px;
}

.thread-action-btn {
    background: white;
    border: 1px solid #dee2e6;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.thread-action-btn:hover {
    background: #7B68EE;
    color: white;
    border-color: #7B68EE;
}

.thread-parts {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.thread-part {
    background: white;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
    position: relative;
    transition: border-color 0.2s;
}

.thread-part:hover {
    border-color: #7B68EE;
}

.thread-part-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.thread-part-number {
    background: #7B68EE;
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.thread-part-chars {
    font-size: 11px;
    color: #6c757d;
}

.thread-part-content {
    font-size: 14px;
    line-height: 1.6;
    color: #333;
    white-space: pre-wrap;
}

/* ============================================================================
   Format Filter Tabs
   ============================================================================ */

.format-filters {
    display: flex;
    gap: 10px;
    margin: 20px 0;
    border-bottom: 2px solid #dee2e6;
    padding-bottom: 0;
}

.format-filter-tab {
    padding: 10px 20px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 14px;
    font-weight: 600;
    color: #6c757d;
    cursor: pointer;
    transition: all 0.2s;
}

.format-filter-tab:hover {
    color: #333;
    background: rgba(0, 0, 0, 0.02);
}

.format-filter-tab.active {
    color: #4A90E2;
    border-bottom-color: #4A90E2;
}

.format-filter-tab-count {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 8px;
    background: #e9ecef;
    border-radius: 10px;
    font-size: 11px;
}

.format-filter-tab.active .format-filter-tab-count {
    background: #4A90E2;
    color: white;
}

/* ============================================================================
   Generate Additional Format Buttons
   ============================================================================ */

.generate-format-buttons {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.generate-format-btn {
    flex: 1;
    padding: 8px 12px;
    border: 2px solid #dee2e6;
    background: white;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.generate-format-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.generate-format-btn.linkedin {
    border-color: #0A66C2;
    color: #0A66C2;
}

.generate-format-btn.linkedin:hover {
    background: #0A66C2;
    color: white;
}

.generate-format-btn.thread {
    border-color: #7B68EE;
    color: #7B68EE;
}

.generate-format-btn.thread:hover {
    background: #7B68EE;
    color: white;
}

.generate-format-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.generate-format-btn:disabled:hover {
    transform: none;
    box-shadow: none;
}

/* ============================================================================
   Note Card Enhancements
   ============================================================================ */

.note-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.note-card-meta {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ============================================================================
   Responsive Design
   ============================================================================ */

@media (max-width: 768px) {
    .format-filters {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .format-filter-tab {
        flex-shrink: 0;
    }
    
    .generate-format-buttons {
        flex-direction: column;
    }
    
    .thread-viewer {
        padding: 15px;
    }
    
    .format-suggestion {
        flex-direction: column;
        gap: 12px;
    }
    
    .format-suggestion-button {
        width: 100%;
    }
}

/* ============================================================================
   Loading States
   ============================================================================ */

.format-loading {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #4A90E2;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ============================================================================
   Toast Notification System
   ============================================================================ */

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 320px;
    max-width: 420px;
    padding: 16px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
    pointer-events: all;
    cursor: pointer;
    transform: translateX(400px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.toast-visible {
    transform: translateX(0);
    opacity: 1;
}

.toast-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 14px;
    font-weight: 700;
}

.toast-message {
    flex: 1;
    font-size: 14px;
    line-height: 1.5;
    color: #374151;
}

.toast-close {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: #9ca3af;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: color 0.15s ease;
}

.toast-close:hover {
    color: #374151;
}

/* Toast Types */
.toast-success {
    border-left: 4px solid #10b981;
}

.toast-success .toast-icon {
    background: #d1fae5;
    color: #059669;
}

.toast-error {
    border-left: 4px solid #ef4444;
}

.toast-error .toast-icon {
    background: #fee2e2;
    color: #dc2626;
}

.toast-warning {
    border-left: 4px solid #f59e0b;
}

.toast-warning .toast-icon {
    background: #fef3c7;
    color: #d97706;
}

.toast-info {
    border-left: 4px solid #3b82f6;
}

.toast-info .toast-icon {
    background: #dbeafe;
    color: #2563eb;
}

/* Toast Animations */
.toast-slide-enter-active,
.toast-slide-leave-active {
    transition: all 0.3s ease;
}

.toast-slide-enter {
    transform: translateX(400px);
    opacity: 0;
}

.toast-slide-leave-to {
    transform: translateX(400px);
    opacity: 0;
}

/* Mobile responsive */
@media (max-width: 640px) {
    .toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
    }
    
    .toast {
        min-width: auto;
        max-width: none;
    }
}

/* ============================================================================
   Sidebar Layout (Phase 5)
   ============================================================================ */

.sidebar-layout-container {
    display: flex;
    gap: 0;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0;
    align-items: flex-start;
}

.generation-sidebar {
    position: sticky;
    top: 30px;
    overflow: visible;
    overflow-x: hidden;
    min-width: 200px;
    max-width: 500px;
    background: white;
    border-radius: 12px;
    padding: 20px;
    padding-bottom: 32px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: width 0.2s ease, padding 0.2s ease, transform 0.2s ease;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

/* Sidebar Toggle Button - STAYS INSIDE sidebar with absolute positioning */
.sidebar-toggle {
    position: absolute;
    right: 12px;
    top: 12px;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    color: #6b7280;
    transition: left 0.3s ease,
                right 0.3s ease,
                transform 0.3s ease,
                background 0.3s ease,
                color 0.3s ease,
                border-color 0.3s ease;
    z-index: 10;
}

.sidebar-toggle:hover {
    background: #f9fafb;
    border-color: #7c3aed;
    color: #7c3aed;
}

/* Collapsed Sidebar State - Minimal clean bar */
.generation-sidebar.collapsed {
    width: 56px;
    padding: 16px 8px;
    overflow: hidden;
}

/* When collapsed, center toggle button */
.generation-sidebar.collapsed .sidebar-toggle {
    left: 50%;
    right: auto;
    top: 12px;
    transform: translateX(-50%);
    width: 36px;
    height: 36px;
    border-radius: 6px;
    font-size: 18px;
}

/* Hide ALL content sections when collapsed */
.generation-sidebar.collapsed .sidebar-section {
    display: none !important;
}

/* Show only credits badge in minimal form */
.generation-sidebar.collapsed .credits-display {
    display: flex !important;
    align-items: center;
    justify-content: center;
    padding: 4px 0;
    margin-bottom: 12px;
    margin-top: 52px;
}

.generation-sidebar.collapsed .credits-link {
    display: none;
}

.generation-sidebar.collapsed .credits-display {
    font-size: 12px;
    text-align: center;
    color: #7c3aed;
}

/* Resize Handle - Between sidebar and main content */
.resize-handle {
    width: 6px;
    background: #e5e7eb;
    cursor: col-resize;
    flex-shrink: 0;
    position: relative;
    transition: background 0.2s ease;
    align-self: stretch;
    margin: 30px 0;
    border-radius: 3px;
    min-height: 200px;
}

.resize-handle:hover {
    background: #7c3aed;
}

.resize-handle::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    transform: translateX(-50%);
    width: 2px;
    height: 100%;
    background: #9ca3af;
    border-radius: 1px;
}

.resize-handle:hover::before {
    background: #7c3aed;
    width: 3px;
}

.resize-handle.dragging {
    background: #7c3aed;
}

.resize-handle.dragging::before {
    background: #7c3aed;
    width: 3px;
}

/* Hide resize handle when sidebar is collapsed */
.generation-sidebar.collapsed + .resize-handle {
    display: none;
}

/* Main content area */
.articles-main {
    flex: 1;
    min-width: 0;
    padding-left: 32px;
}

.sidebar-layout-container.sidebar-collapsed .articles-main {
    padding-left: 0;
}

.sidebar-section {
    margin-bottom: 24px;
}

.sidebar-section:last-child {
    margin-bottom: 0;
}

.sidebar-title {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Credits Display in Sidebar - Compact Single Line, Subtle */
.credits-display {
    background: transparent;
    color: #7c3aed;
    padding: 4px 0;
    margin-bottom: 12px;
    font-size: 11px;
    line-height: 1.5;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.credits-link {
    color: #6b7280;
    font-size: 10px;
    text-decoration: underline;
    margin-left: 8px;
    white-space: nowrap;
    text-transform: none;
}

.credits-link:hover {
    color: #7c3aed;
}

/* Note Length Selector */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Enhanced Radio Buttons with Clear Visual Feedback */
.radio-option {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 10px 12px;
    border-radius: 6px;
    border: 2px solid #e5e7eb;
    transition: all 0.2s ease;
    background: white;
}

.radio-option:hover {
    border-color: #c4b5fd;
    background: #faf5ff;
}

.radio-option:has(input:checked) {
    border-color: #7c3aed;
    background: #f3e8ff;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.radio-option input[type="radio"] {
    /* Hide the actual radio button - the box itself is the visual indicator */
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
    pointer-events: none;
}

.radio-label {
    font-size: 14px;
    color: #374151;
    flex: 1;
}

.radio-description {
    font-size: 12px;
    color: #9ca3af;
}

/* Note Categories - 2 columns for compact layout */
.checkbox-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

/* Enhanced Checkboxes with Clear Visual Feedback - Compact */
.checkbox-option {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    border: 2px solid #e5e7eb;
    transition: all 0.2s ease;
    background: white;
}

.checkbox-option:hover {
    border-color: #c4b5fd;
    background: #faf5ff;
}

.checkbox-option:has(input:checked) {
    border-color: #7c3aed;
    background: #f3e8ff;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.checkbox-option input[type="checkbox"] {
    /* Hide the actual checkbox - the box itself is the visual indicator */
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
    pointer-events: none;
}

.checkbox-label {
    font-size: 13px;
    color: #374151;
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar-layout-container {
        flex-direction: column;
    }
    
    .generation-sidebar {
        position: fixed;
        left: 0;
        top: 80px;
        height: calc(100vh - 80px);
        z-index: 100;
        box-shadow: 4px 0 12px rgba(0, 0, 0, 0.1);
        margin-bottom: 0;
        transition: transform 0.3s ease, width 0.3s ease, padding 0.3s ease;
    }
    
    .generation-sidebar.collapsed {
        width: 56px;
        padding: 16px 8px;
    }
    
    .resize-handle {
        display: none; /* Disable resize on mobile */
    }
    
    /* Mobile: Give main content proper margin when sidebar is expanded */
    .sidebar-layout-container:not(.sidebar-collapsed) .articles-main {
        margin-left: 0;
        padding-left: 0;
        padding-top: 32px;
    }
    
    .sidebar-layout-container.sidebar-collapsed .articles-main {
        margin-left: 0;
        padding-left: 0;
        padding-top: 32px;
    }
    
    /* Mobile: toggle button stays in same position */
    .sidebar-toggle {
        right: 12px;
        top: 12px;
    }
    
    .generation-sidebar.collapsed .sidebar-toggle {
        left: 50%;
        right: auto;
        top: 12px;
        transform: translateX(-50%);
        width: 36px;
        height: 36px;
    }
}

/* Extra small screens - full overlay sidebar */
@media (max-width: 640px) {
    .sidebar-layout-container:not(.sidebar-collapsed) .articles-main {
        margin-left: 0;
    }
    
    .sidebar-layout-container.sidebar-collapsed .articles-main {
        margin-left: 0;
        padding-left: 60px;
    }
}

/* ============================================================================
   Utility Classes
   ============================================================================ */

.fade-in {
    animation: fadeIn 0.3s ease-in;
}

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

