/**
 * Sakurato Changelog - Frontend Styles
 * Modern, clean changelog display
 *
 * @package Sakurato_Changelog
 */

/* ==========================================================================
   Base Container
   ========================================================================== */

.sakurato-changelog {
    max-width: 800px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 1rem;
    line-height: 1.6;
}

/* ==========================================================================
   Version Block
   ========================================================================== */

.changelog-version-block {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.changelog-version-block:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

/* ==========================================================================
   Version Header
   ========================================================================== */

.changelog-version-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.changelog-version-number {
    font-size: 1.4rem;
    font-weight: 700;
    color: #1f2937;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.changelog-version-date {
    font-size: 0.9rem;
    color: #6b7280;
    background: #f3f4f6;
    padding: 0.1875rem 0.625rem;
    border-radius: 9999px;
}

/* ==========================================================================
   Entries Container
   ========================================================================== */

.changelog-entries {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* ==========================================================================
   Single Entry
   ========================================================================== */

.changelog-entry {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem;
    background: #fafafa;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.changelog-entry:hover {
    background: #f3f4f6;
    transform: translateX(4px);
}

/* ==========================================================================
   Badge
   ========================================================================== */

.changelog-badge {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: #fff;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    white-space: nowrap;
}

/* Badge Colors */
.changelog-badge-new {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.changelog-badge-improved {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.changelog-badge-fixed {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.changelog-badge-removed {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.changelog-badge-security {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
}

.changelog-badge-deprecated {
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
}

/* ==========================================================================
   Entry Content
   ========================================================================== */

.changelog-entry-content {
    flex: 1;
    min-width: 0;
}

.changelog-entry-title {
    display: block;
    font-size: 1.3rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.125rem;
    line-height: 1.5;
}

.changelog-entry-description {
    font-size: 1.2rem;
    color: #6b7280;
    line-height: 1.5;
    margin: 0;
}

.changelog-entry-description p {
    margin: 0;
}

/* ==========================================================================
   Search Highlighting
   ========================================================================== */

.changelog-highlight {
    background-color: #fef08a;
    padding: 0.0625rem 0.1875rem;
    border-radius: 2px;
    font-weight: 600;
}

/* ==========================================================================
   No Results Message
   ========================================================================== */

.changelog-no-results {
    text-align: center;
    padding: 2rem 1rem;
    color: #9ca3af;
    font-style: italic;
    font-size: 0.9375rem;
}

/* ==========================================================================
   Collapsible Functionality
   ========================================================================== */

.changelog-collapsible .changelog-version-header {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease;
    padding: 0.625rem;
    margin: -0.625rem;
    margin-bottom: 0.375rem;
    border-radius: 8px;
    position: relative;
}

.changelog-collapsible .changelog-version-header:hover {
    background-color: #f9fafb;
}

.changelog-collapsible .changelog-version-header:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Toggle Icon */
.changelog-toggle-icon {
    display: inline-block;
    margin-left: 0.5rem;
    transition: transform 0.3s ease;
    font-size: 0.75rem;
    color: #6b7280;
}

.changelog-version-header[aria-expanded="false"] .changelog-toggle-icon {
    transform: rotate(-90deg);
}

/* Collapsible Entries */
.changelog-entries-collapsible {
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.changelog-entries-collapsible.collapsed {
    max-height: 0 !important;
}

/* Collapsed State */
.changelog-version-block.is-collapsed {
    margin-bottom: 0.75rem;
    padding-bottom: 0;
}

/* ==========================================================================
   Toggle All Buttons
   ========================================================================== */

.changelog-toggle-all-container {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.changelog-toggle-all-btn {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #667eea;
    background: white;
    border: 2px solid #667eea;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.changelog-toggle-all-btn:hover {
    background: #667eea;
    color: white;
}

.changelog-toggle-all-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}

/* ==========================================================================
   Accessibility - Reduced Motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .changelog-entries-collapsible,
    .changelog-toggle-icon,
    .changelog-entry,
    .changelog-collapsible .changelog-version-header {
        transition: none;
    }
    
    .changelog-entry:hover {
        transform: none;
    }
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 640px) {
    .sakurato-changelog {
        font-size: 0.9375rem;
    }
    
    .changelog-version-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .changelog-version-number {
        font-size: 1.125rem;
    }
    
    .changelog-entry {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .changelog-badge {
        font-size: 0.625rem;
    }
    
    .changelog-entry-title {
        font-size: 0.875rem;
    }
    
    .changelog-entry-description {
        font-size: 0.8125rem;
    }
}

/* ============================================
   PHASE 1: Search & Collapsible Functionality
   ============================================ */

/* Search Container */
.changelog-search-container {
    position: relative;
    margin-bottom: 2rem;
    max-width: 500px;
}

.changelog-search-input {
    width: 100%;
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    font-size: 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    transition: all 0.3s ease;
    font-family: inherit;
}

.changelog-search-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.changelog-search-icon {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    opacity: 0.5;
}

/* Search Highlighting */
.changelog-highlight {
    background-color: #fef08a;
    padding: 0.125rem 0.25rem;
    border-radius: 3px;
    font-weight: 600;
}

/* No Results Message */
.changelog-no-results {
    text-align: center;
    padding: 3rem 1rem;
    color: #9ca3af;
    font-style: italic;
    font-size: 1.1rem;
}

/* Collapsible Header */
.changelog-collapsible .changelog-version-header {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease;
    padding: 0.75rem;
    margin: 0.75rem;
    border-radius: 8px;
    position: relative;
}

.changelog-collapsible .changelog-version-header:hover {
    background-color: #f9fafb;
}

.changelog-collapsible .changelog-version-header:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Toggle Icon */
.changelog-toggle-icon {
    display: inline-block;
    margin-left: 0.5rem;
    transition: transform 0.3s ease;
    font-size: 0.875rem;
    color: #6b7280;
}

.changelog-version-header[aria-expanded="false"] .changelog-toggle-icon {
    transform: rotate(-90deg);
}

/* Collapsible Entries */
.changelog-entries-collapsible {
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.changelog-entries-collapsible.collapsed {
    max-height: 0 !important;
}

/* Collapsed State */
.changelog-version-block.is-collapsed {
    margin-bottom: 1rem;
    padding-bottom: 0;
}

/* Toggle All Buttons */
.changelog-toggle-all-container {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.changelog-toggle-all-btn {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #667eea;
    background: white;
    border: 2px solid #667eea;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.changelog-toggle-all-btn:hover {
    background: #667eea;
    color: white;
}

.changelog-toggle-all-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    .changelog-entries-collapsible,
    .changelog-toggle-icon,
    .changelog-search-input {
        transition: none;
    }
}

/* Mobile Responsive */
@media (max-width: 640px) {
    .changelog-search-container {
        max-width: 100%;
    }
    
    .changelog-toggle-all-container {
        justify-content: center;
    }
    
    .changelog-toggle-all-btn {
        flex: 1;
        min-width: 120px;
    }
}

/**
 * Documentation Page Styles
 */

.sakurato-changelog-docs {
    max-width: 1200px;
}

.sakurato-docs-container {
    background: #fff;
    margin-top: 20px;
}

.sakurato-docs-section {
    background: #fff;
    padding: 30px;
    margin-bottom: 20px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.sakurato-docs-section h2 {
    margin-top: 0;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
    color: #1d2327;
}

.sakurato-docs-section h3 {
    color: #2271b1;
    margin-top: 0;
    margin-bottom: 10px;
}

/* Code Blocks */
.sakurato-code-block {
    position: relative;
    background: #f6f7f7;
    border: 1px solid #ddd;
    border-left: 3px solid #2271b1;
    padding: 15px 100px 15px 15px;
    margin: 15px 0;
    border-radius: 3px;
    font-family: Consolas, Monaco, monospace;
    overflow-x: auto;
}

.sakurato-code-block code {
    background: none;
    padding: 0;
    color: #1d2327;
    font-size: 14px;
}

.sakurato-copy-btn {
    position: absolute;
	margin-top: 10px !important;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    padding: 6px 12px;
    background: #2271b1;
    color: #fff;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.sakurato-copy-btn:hover {
    background: #135e96;
}

.sakurato-copy-btn:active {
    transform: translateY(-50%) scale(0.95);
}

/* Examples */
.sakurato-example {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #f0f0f0;
}

.sakurato-example:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.sakurato-example .description {
    color: #646970;
    font-style: italic;
    margin-top: 10px;
}

/* Tips List */
.sakurato-tips-list {
    list-style: none;
    padding-left: 0;
}

.sakurato-tips-list li {
    padding: 12px 15px;
    margin-bottom: 10px;
    background: #f6f7f7;
    border-left: 3px solid #2271b1;
    border-radius: 3px;
}

.sakurato-tips-list li strong {
    color: #2271b1;
}

/* Change Types Reference */
.sakurato-change-types {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.sakurato-change-type-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: #f6f7f7;
    border-radius: 4px;
}

.sakurato-change-type-item .badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    color: #fff;
    border-radius: 3px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.sakurato-change-type-item code {
    background: #fff;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
    color: #50575e;
}

/* Support Section */
.sakurato-support-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
}

.sakurato-support-section h2 {
    color: #fff;
    border-bottom-color: rgba(255,255,255,0.2);
}

.sakurato-support-section p,
.sakurato-support-section li {
    color: #fff;
}

.sakurato-support-section a {
    color: #fff;
    text-decoration: underline;
    font-weight: 600;
}

.sakurato-support-section a:hover {
    color: #fef08a;
}

/* Table Styling */
.sakurato-docs-section table {
    margin-top: 20px;
}

.sakurato-docs-section table th {
    font-weight: 600;
    background: #f6f7f7;
}

.sakurato-docs-section table code {
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 13px;
    color: #d63638;
}

/* Responsive */
@media (max-width: 782px) {
    .sakurato-docs-section {
        padding: 20px 15px;
    }
    
    .sakurato-code-block {
        padding-right: 15px;
        padding-bottom: 50px;
    }
    
    .sakurato-copy-btn {
        top: auto;
        bottom: 10px;
        transform: none;
    }
    
    .sakurato-change-types {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   LEGEND COMPONENT
   ============================================ */

.changelog-legend {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
}

.legend-title {
    font-size: 0.975rem;
    font-weight: 600;
    color: #6b7280;
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.legend-items {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.legend-badge {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    color: #fff;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.legend-label {
    font-size: 1.1rem;
    color: #4b5563;
    font-weight: 500;
}

/* Compact style for timeline and cards */
.changelog-legend-timeline,
.changelog-legend-cards {
    background: transparent;
    border: none;
    padding: 0 0 1rem 0;
}

.changelog-legend-timeline .legend-items,
.changelog-legend-cards .legend-items {
    gap: 0.75rem;
}

.changelog-legend-timeline .legend-label,
.changelog-legend-cards .legend-label {
    font-size: 1.1rem;
}

.changelog-legend-timeline .legend-badge,
.changelog-legend-cards .legend-badge {
    width: 20px;
    height: 20px;
    font-size: 1.1rem;
}

/* Mobile responsive */
@media (max-width: 640px) {
    .legend-items {
        gap: 0.75rem;
    }
    
    .legend-item {
        gap: 0.4rem;
    }
    
    .legend-badge {
        width: 20px;
        height: 20px;
        font-size: 0.75rem;
    }
    
    .legend-label {
        font-size: 0.8rem;
    }
}



.changelog-entry:nth-child(1) { animation-delay: 0.05s; }
.changelog-entry:nth-child(2) { animation-delay: 0.1s; }
.changelog-entry:nth-child(3) { animation-delay: 0.15s; }
.changelog-entry:nth-child(4) { animation-delay: 0.2s; }
.changelog-entry:nth-child(5) { animation-delay: 0.25s; }