/**
 * NC Blocks - Nextcloud Style Frontend
 *
 * Wichtig: Benutzerdefinierte inline-styles haben Vorrang vor Dark Mode
 */

:root {
    --ncb-primary: #32373c;
    --ncb-accent: #fd5b56;
    --ncb-success: #4caf50;
    --ncb-info: #2196f3;
    --ncb-warning: #ff9800;
    --ncb-purple: #9c27b0;
    --ncb-gray: #607d8b;
    --ncb-border: #e0e0e0;
    --ncb-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --ncb-shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.12);
    --ncb-radius: 8px;
    --ncb-gap: 24px;
    --ncb-columns: 3;
    --ncb-padding: 24px;
}

/* ============================================
   Group / Container
   ============================================ */
.ncb-group {
    width: 100%;
}

/* ============================================
   Stack Layout
   ============================================ */
.ncb-stack {
    display: flex;
    flex-direction: column;
    gap: var(--ncb-gap);
}

/* ============================================
   Grid Layout
   ============================================ */
.ncb-grid {
    display: grid;
    grid-template-columns: repeat(var(--ncb-columns), 1fr);
    gap: var(--ncb-gap);
    width: 100%;
}

@media (max-width: 1024px) {
    .ncb-grid {
        --ncb-columns: 2;
    }
}

@media (max-width: 767px) {
    .ncb-grid {
        --ncb-columns: 1;
    }
}

/* ============================================
   Block Base
   ============================================ */
.ncb-block {
    border-radius: var(--ncb-radius);
    overflow: hidden;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    padding: var(--ncb-padding);
}

.ncb-block.ncb-shadow {
    box-shadow: var(--ncb-shadow);
}

.ncb-block.ncb-shadow:hover {
    box-shadow: var(--ncb-shadow-hover);
}

/* Text Alignment */
.ncb-block.ncb-align-left { text-align: left; }
.ncb-block.ncb-align-center { text-align: center; }
.ncb-block.ncb-align-right { text-align: right; }

/* ============================================
   Card Style
   ============================================ */
.ncb-style-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ============================================
   Hero Style
   ============================================ */
.ncb-style-hero {
    position: relative;
    min-height: 400px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 60px var(--ncb-padding);
}

.ncb-style-hero .ncb-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.ncb-style-hero .ncb-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ncb-style-hero .ncb-image::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(50, 55, 60, 0.6);
}

.ncb-style-hero > *:not(.ncb-image) {
    position: relative;
    z-index: 1;
    max-width: 800px;
}

.ncb-style-hero .ncb-heading {
    font-size: 42px;
    margin-bottom: 16px;
}

/* ============================================
   Feature Style
   ============================================ */
.ncb-style-feature {
    display: flex;
    align-items: flex-start;
    gap: 20px;
}

.ncb-style-feature .ncb-icon {
    flex: 0 0 60px;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(253, 91, 86, 0.1);
    border-radius: 12px;
}

/* ============================================
   Minimal Style
   ============================================ */
.ncb-style-minimal {
    padding: 16px 0;
    border-bottom: 1px solid var(--ncb-border);
}

.ncb-style-minimal:last-child {
    border-bottom: none;
}

/* ============================================
   Element: Heading
   ============================================ */
.ncb-heading {
    font-weight: 700;
    line-height: 1.3;
    margin: 0 0 8px;
}

h1.ncb-heading { font-size: 42px; }
h2.ncb-heading { font-size: 32px; }
h3.ncb-heading { font-size: 24px; }
h4.ncb-heading { font-size: 20px; }
h5.ncb-heading { font-size: 18px; }
h6.ncb-heading { font-size: 16px; }

/* ============================================
   Element: Text
   ============================================ */
.ncb-text {
    font-size: 16px;
    line-height: 1.6;
}

.ncb-text p:first-child {
    margin-top: 0;
}

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

/* Lists inside text */
.ncb-text ul,
.ncb-text ol {
    margin: 12px 0;
    padding-left: 24px;
}

.ncb-text ul {
    list-style-type: disc;
}

.ncb-text ol {
    list-style-type: decimal;
}

.ncb-text li {
    margin: 6px 0;
    line-height: 1.6;
}

/* ============================================
   Element: Image
   ============================================ */
.ncb-image {
    display: block;
}

.ncb-image img {
    width: 100%;
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: var(--ncb-radius);
}

/* ============================================
   Element: Icon
   ============================================ */
.ncb-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.ncb-icon .dashicons {
    font-size: var(--ncb-icon-size, 32px);
    width: var(--ncb-icon-size, 32px);
    height: var(--ncb-icon-size, 32px);
    color: var(--ncb-icon-color, var(--ncb-accent));
}

/* ============================================
   Element: Button (Elementor-Style)
   ============================================ */
.ncb-button-wrap {
    margin-top: 12px;
}

.ncb-button {
    display: inline-block;
    font-family: "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 16px;
    font-weight: 700;
    line-height: 26px;
    text-decoration: none;
    border-radius: 28px;
    padding: 7px 20px;
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
}

.ncb-button-primary,
.ncb-button-primary:link,
.ncb-button-primary:visited,
.ncb-button-primary:active {
    background-color: #0082C9 !important;
    color: #fff !important;
}

.ncb-button-primary:hover {
    background-color: #006ba1 !important;
    color: #fff !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 130, 201, 0.3);
}

.ncb-button-secondary,
.ncb-button-secondary:link,
.ncb-button-secondary:visited,
.ncb-button-secondary:active {
    background-color: #0082C9 !important;
    color: #fff !important;
}

.ncb-button-secondary:hover {
    background-color: #006ba1 !important;
    color: #fff !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 130, 201, 0.3);
}

.ncb-button-outline,
.ncb-button-outline:link,
.ncb-button-outline:visited,
.ncb-button-outline:active {
    background-color: transparent !important;
    color: #0082C9 !important;
    border: 2px solid #0082C9;
    padding: 5px 18px;
}

.ncb-button-outline:hover {
    background-color: #0082C9 !important;
    color: #fff !important;
}

.ncb-button-link,
.ncb-button-link:link,
.ncb-button-link:visited,
.ncb-button-link:active {
    background: transparent !important;
    color: #0082C9 !important;
    padding: 0;
    border-radius: 0;
    font-weight: 600;
}

.ncb-button-link:hover {
    text-decoration: underline;
    color: #006ba1 !important;
}

/* ============================================
   Element: Spacer
   ============================================ */
.ncb-spacer {
    display: block;
}

/* ============================================
   Element: Divider
   ============================================ */
.ncb-divider {
    border: none;
    border-top-width: 1px;
    margin: 16px 0;
}

/* ============================================
   Element: List
   ============================================ */
.ncb-list {
    margin: 12px 0;
}

.ncb-list ul,
.ncb-list ol {
    margin: 8px 0;
    padding-left: 24px;
    list-style-position: outside;
}

.ncb-list ul {
    list-style-type: disc;
}

.ncb-list ol {
    list-style-type: decimal;
}

.ncb-list li {
    margin: 6px 0;
    line-height: 1.6;
    padding-left: 4px;
}

/* Direct list (not wrapped) */
ul.ncb-list,
ol.ncb-list {
    padding-left: 24px;
}

ul.ncb-list {
    list-style-type: disc;
}

ol.ncb-list {
    list-style-type: decimal;
}

/* Checkmark style */
.ncb-list-check,
.ncb-list-check ul {
    list-style: none !important;
    padding-left: 0 !important;
}

.ncb-list-check li {
    position: relative;
    padding-left: 28px;
}

.ncb-list-check li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--ncb-success);
    font-weight: bold;
    font-size: 14px;
}

/* ============================================
   Element: Expandable
   ============================================ */
.ncb-expandable {
    border: 1px solid var(--ncb-border);
    border-radius: var(--ncb-radius);
    overflow: hidden;
}

.ncb-expandable-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #f9f9f9;
    cursor: pointer;
    user-select: none;
}

.ncb-expandable-header:hover {
    background: #f0f0f0;
}

.ncb-expandable-title {
    font-weight: 600;
}

.ncb-expandable-icon {
    transition: transform 0.2s ease;
}

.ncb-expandable.ncb-expanded .ncb-expandable-icon {
    transform: rotate(180deg);
}

.ncb-expandable-content {
    display: none;
    padding: 16px;
    border-top: 1px solid var(--ncb-border);
}

.ncb-expandable.ncb-expanded .ncb-expandable-content {
    display: block;
}

/* ============================================
   Tags
   ============================================ */
.ncb-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.ncb-tag {
    display: inline-block;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    text-transform: lowercase;
    border-radius: 4px;
    color: #fff;
}

/* ============================================
   Release Notes (Legacy)
   ============================================ */
.ncb-release-notes {
    max-width: 800px;
    margin: 0 auto;
}

.ncb-release-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* ============================================
   Release Notes (NC-Blocks Style)
   ============================================ */
.ncb-releases {
    max-width: 800px;
    margin: 0 auto;
}

.ncb-releases-toolbar {
    display: flex;
    gap: 8px;
    margin-bottom: var(--ncb-gap);
}

.ncb-releases-toolbar button {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    background: #f5f5f5;
    border: 1px solid var(--ncb-border);
    border-radius: var(--ncb-radius);
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--ncb-primary);
}

.ncb-releases-toolbar button:hover {
    background: var(--ncb-info);
    border-color: var(--ncb-info);
    color: #fff;
}

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

.ncb-release-item {
    background: #fff;
    border: 1px solid var(--ncb-border);
    border-radius: var(--ncb-radius);
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

.ncb-release-item:hover {
    box-shadow: var(--ncb-shadow);
}

.ncb-release-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: var(--ncb-padding);
    background: #fafafa;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s ease;
}

.ncb-release-header:hover {
    background: #f5f5f5;
}

.ncb-release-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 80px;
}

.ncb-release-status {
    display: inline-block;
    padding: 3px 10px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    border-radius: 4px;
    color: #fff;
}

.ncb-release-category {
    font-size: 12px;
    color: #666;
}

.ncb-release-title-wrap {
    flex: 1;
    min-width: 0;
}

.ncb-release-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    color: var(--ncb-primary);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.ncb-release-version {
    display: inline-block;
    padding: 3px 10px;
    font-size: 13px;
    font-weight: 700;
    background: var(--ncb-info);
    color: #fff;
    border-radius: 4px;
}

.ncb-release-date {
    font-size: 13px;
    color: #888;
    margin-top: 4px;
}

.ncb-release-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    color: #999;
    transition: color 0.2s ease;
}

.ncb-release-toggle svg {
    width: 18px;
    height: 18px;
}

.ncb-release-toggle .ncb-icon-minus {
    display: none;
}

.ncb-release-header:hover .ncb-release-toggle {
    color: var(--ncb-info);
}

.ncb-release-item.ncb-expanded .ncb-release-toggle .ncb-icon-plus {
    display: none;
}

.ncb-release-item.ncb-expanded .ncb-release-toggle .ncb-icon-minus {
    display: block;
}

.ncb-release-body {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.25s ease;
}

.ncb-release-body-inner {
    overflow: hidden;
}

.ncb-release-item.ncb-expanded .ncb-release-body {
    grid-template-rows: 1fr;
}

.ncb-release-item.ncb-expanded .ncb-release-body-inner {
    padding: var(--ncb-padding);
    padding-top: 0;
    border-top: 1px solid var(--ncb-border);
}

.ncb-release-description {
    font-size: 15px;
    color: #555;
    margin: 16px 0;
    line-height: 1.6;
}

.ncb-release-changes {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ncb-change-section h4 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    margin: 0 0 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ncb-change-icon {
    font-size: 14px;
}

.ncb-change-section ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.ncb-change-section li {
    position: relative;
    padding: 6px 0 6px 20px;
    font-size: 14px;
    line-height: 1.5;
    color: #444;
}

.ncb-change-section li::before {
    content: '•';
    position: absolute;
    left: 6px;
    color: inherit;
}

.ncb-change-added h4 { color: var(--ncb-success); }
.ncb-change-added li::before { color: var(--ncb-success); }

.ncb-change-improved h4 { color: var(--ncb-info); }
.ncb-change-improved li::before { color: var(--ncb-info); }

.ncb-change-fixed h4 { color: var(--ncb-warning); }
.ncb-change-fixed li::before { color: var(--ncb-warning); }

.ncb-change-removed h4 { color: var(--ncb-gray); }
.ncb-change-removed li::before { color: var(--ncb-gray); }

.ncb-change-security h4 { color: var(--ncb-accent); }
.ncb-change-security li::before { color: var(--ncb-accent); }

.ncb-change-breaking {
    background: #fff5f5;
    margin: 0 calc(-1 * var(--ncb-padding));
    padding: 12px var(--ncb-padding);
    border-left: 3px solid var(--ncb-accent);
}

.ncb-change-breaking h4 { color: var(--ncb-accent); }

.ncb-no-releases {
    text-align: center;
    padding: 40px 20px;
    color: #888;
    font-style: italic;
}

/* Responsive */
@media (max-width: 767px) {
    .ncb-release-header {
        flex-wrap: wrap;
        gap: 12px;
    }

    .ncb-release-meta {
        flex-direction: row;
        gap: 8px;
        min-width: auto;
    }

    .ncb-release-title {
        font-size: 16px;
    }

    .ncb-release-version {
        font-size: 12px;
    }

    .ncb-change-breaking {
        margin: 0 -16px;
        padding: 12px 16px;
    }
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 767px) {
    .ncb-style-hero {
        min-height: 300px;
        padding: 40px 20px;
    }

    .ncb-style-hero .ncb-heading {
        font-size: 28px;
    }

    h1.ncb-heading { font-size: 32px; }
    h2.ncb-heading { font-size: 26px; }

    .ncb-style-feature {
        flex-direction: column;
    }
}

/* ============================================
   Print
   ============================================ */
@media print {
    .ncb-block {
        box-shadow: none !important;
        border: 1px solid #ccc;
    }

    .ncb-expandable-content,
    .ncb-release-body {
        display: block !important;
    }
}
