/* ei-fach mache Community Stories - OPTIMIERT v4 FINAL */
:root {
    --ei-braun: #3A2620;
    --ei-dotter: #F2A55A;
    --ei-weiss: #FFFFFF;
    --ei-braun-light: #5A4640;
    --ei-dotter-dark: #D9924D;
    --ei-transition: 0.3s ease;
    --ei-error: #e74c3c;
}

/* ========================================
   STORIES GRID - RESPONSIVE & KOMPAKT
   ======================================== */
.ei-stories-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    position: relative;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 15px;
}

/* Tablet: 2 Spalten */
@media (min-width: 641px) {
    .ei-stories-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Desktop: 3 Spalten */
@media (min-width: 1025px) {
    .ei-stories-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Startseite: 2 gepinnte Stories zentriert */
@media (min-width: 641px) {
    .ei-stories-grid[data-story-count="2"] {
        grid-template-columns: repeat(2, 1fr);
        max-width: 800px;
        margin: 0 auto;
    }
}

.ei-stories-grid.loading { opacity: 0.5; }

.ei-no-stories {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: var(--ei-braun-light);
}

/* ========================================
   STORY CARD - QUADRATISCH & KOMPAKT
   ======================================== */
.ei-story-card {
    background: var(--ei-weiss);
    border: 1px solid rgba(58, 38, 32, 0.15);
    border-radius: 10px;
    padding: 12px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(58, 38, 32, 0.06);
    cursor: pointer;
    position: relative;
    display: flex;
    flex-direction: column;
    aspect-ratio: 1 / 1;
    min-height: 280px;
    overflow: hidden;
}

@media (max-width: 640px) {
    .ei-story-card {
        aspect-ratio: auto;
        min-height: 320px;
    }
}

@media (min-width: 641px) and (max-width: 1024px) {
    .ei-story-card {
        min-height: 300px;
    }
}

@media (min-width: 1025px) {
    .ei-story-card {
        min-height: 340px;
    }
}

.ei-story-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(58, 38, 32, 0.12);
    border-color: var(--ei-dotter);
}

.ei-story-card.pinned {
    border: 2px solid var(--ei-dotter);
}

/* EXPANDED STATE */
.ei-story-card.expanded {
    grid-column: 1 / -1;
    padding: 24px;
    box-shadow: 0 12px 40px rgba(58, 38, 32, 0.2);
    z-index: 10;
    cursor: default;
    transform: translateY(0);
    aspect-ratio: auto;
    min-height: auto;
    max-height: none;
    overflow: visible;
}

@media (min-width: 641px) {
    .ei-story-card.expanded {
        max-width: 800px;
        margin: 0 auto;
        width: 100%;
    }
}

/* ========================================
   STORY HEADER - BADGES
   ======================================== */
.ei-story-header {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
    margin-bottom: 8px;
    flex-shrink: 0;
}

.ei-label-pinned {
    padding: 2px 6px;
    background: var(--ei-dotter);
    color: var(--ei-braun);
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
}

.ei-label-fresh {
    padding: 2px 6px;
    background: linear-gradient(135deg, var(--ei-dotter), #FFD93D);
    color: var(--ei-braun);
    border-radius: 50px;
    font-size: 0.5rem;
    font-weight: 700;
    text-transform: uppercase;
    white-space: nowrap;
}

.ei-story-kategorie {
    padding: 2px 8px;
    border-radius: 50px;
    font-size: 0.65rem;
    font-weight: 600;
    background: var(--ei-braun);
    color: var(--ei-weiss);
    display: inline-flex;
    align-items: center;
    gap: 3px;
    white-space: nowrap;
}

/* ========================================
   STORY TAGS - SEHR KLEIN
   ======================================== */
.ei-story-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    margin-bottom: 8px;
    flex-shrink: 0;
}

.ei-story-tag {
    padding: 1px 4px !important;
    background: var(--ei-dotter);
    color: var(--ei-braun);
    border-radius: 50px;
    font-size: 0.35rem !important;
    font-weight: 400 !important;
    line-height: 1.1 !important;
    display: inline-block;
}

.ei-story-card.expanded .ei-story-tags {
    margin-bottom: 12px;
    gap: 5px;
}

.ei-story-card.expanded .ei-story-tag {
    padding: 3px 8px;
    font-size: 0.65rem;
}

/* ========================================
   STORY CONTENT
   ======================================== */
.ei-story-teaser {
    font-size: 1rem;
    font-weight: 700;
    color: var(--ei-braun);
    margin: 0 0 6px 0;
    text-align: left;
    line-height: 1.25;
    flex-shrink: 0;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.ei-story-card.expanded .ei-story-teaser {
    font-size: 1.3rem;
    margin-bottom: 12px;
    -webkit-line-clamp: unset;
}

.ei-story-text {
    font-size: 0.8rem;
    line-height: 1.4;
    color: var(--ei-braun);
    margin-bottom: 0;
    text-align: left;
    overflow: hidden;
    position: relative;
    word-wrap: break-word;
    overflow-wrap: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    flex: 1 1 auto;
}

.ei-story-text::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 25px;
    background: linear-gradient(to bottom, transparent, var(--ei-weiss));
    pointer-events: none;
}

.ei-story-card.expanded .ei-story-text {
    font-size: 0.95rem;
    line-height: 1.7;
    margin-bottom: 12px;
    display: block;
    -webkit-line-clamp: unset;
    flex: 0 0 auto;
}

.ei-story-card.expanded .ei-story-text::after {
    display: none;
}

/* ========================================
   STORY FOOTER - AUTOR
   ======================================== */
.ei-story-footer {
    text-align: left;
    margin-top: auto;
    margin-bottom: 6px;
    opacity: 0.7;
    flex-shrink: 0;
    padding-top: 6px;
}

.ei-story-card.expanded .ei-story-footer {
    margin-bottom: 10px;
    opacity: 1;
}

.ei-story-autor {
    font-size: 0.7rem;
    color: #5A4640;
    font-style: italic;
}

.ei-story-card.expanded .ei-story-autor {
    font-size: 0.88rem;
}

/* ========================================
   LIKE BUTTONS - KOMPAKT
   ======================================== */
.ei-like-section {
    display: flex;
    gap: 6px;
    justify-content: center;
    flex-shrink: 0;
    padding-top: 4px;
    margin-top: auto;
    border-top: 1px solid rgba(58, 38, 32, 0.08);
}

.ei-story-card.expanded .ei-like-section {
    gap: 12px;
    justify-content: center;
}

.ei-like-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 5px 10px;
    background: transparent;
    border: 2px solid rgba(58, 38, 32, 0.1);
    border-radius: 50px;
    cursor: pointer;
    transition: all var(--ei-transition);
    min-height: 32px;
    box-sizing: border-box;
}

.ei-story-card.expanded .ei-like-btn {
    padding: 8px 14px;
    gap: 6px;
    min-height: 48px;
}

.ei-like-btn:hover:not(:disabled) {
    background: rgba(242, 165, 90, 0.1);
    border-color: var(--ei-dotter);
}

.ei-like-btn.liked {
    background: rgba(242, 165, 90, 0.15);
    border-color: var(--ei-dotter);
}

.ei-like-emoji {
    font-size: 1.1rem;
    line-height: 1;
    display: inline-block;
}

.ei-story-card.expanded .ei-like-emoji {
    font-size: 1.68rem;
}

.ei-like-count {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--ei-braun);
    line-height: 1;
}

.ei-story-card.expanded .ei-like-count {
    font-size: 1.26rem;
}

/* ========================================
   TAGS FILTER
   ======================================== */
.ei-tags-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-bottom: 30px;
    padding: 20px;
    background: rgba(58, 38, 32, 0.03);
    border-radius: 16px;
}

.ei-tag-filter-btn {
    padding: 10px 18px;
    background: transparent;
    color: var(--ei-braun);
    border: 2px solid var(--ei-braun);
    border-radius: 50px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--ei-transition);
}

.ei-tag-filter-btn:hover {
    border-color: var(--ei-dotter);
    color: var(--ei-dotter);
}

.ei-tag-filter-btn.active {
    background: var(--ei-braun);
    color: var(--ei-weiss);
}

/* ========================================
   LOAD MORE
   ======================================== */
.ei-load-more-wrap { text-align: center; margin: 40px 0; }

.ei-load-more-btn {
    padding: 16px 40px;
    background: transparent;
    color: var(--ei-braun);
    border: 2px solid var(--ei-braun);
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--ei-transition);
}

.ei-load-more-btn:hover:not(:disabled) {
    background: var(--ei-braun);
    color: var(--ei-weiss);
}

/* ========================================
   FORM WRAPPER
   ======================================== */
.ei-form-wrapper {
    max-width: 600px;
    margin: 0 auto;
    padding: 0 15px;
}

.ei-form {
    background: var(--ei-weiss);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 4px 30px rgba(58, 38, 32, 0.08);
    border: 1px solid rgba(58, 38, 32, 0.08);
}

@media (max-width: 480px) {
    .ei-form { padding: 25px 20px; }
}

/* ========================================
   FORM STEPS
   ======================================== */
.ei-form-step { display: none; }
.ei-form-step.active { display: block; animation: fadeIn 0.3s ease; }

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

.ei-step-header {
    text-align: center;
    margin-bottom: 25px;
}

.ei-step-header h3 {
    color: var(--ei-braun);
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0 0 8px 0;
}

.ei-step-sub {
    color: var(--ei-braun-light);
    font-size: 1rem;
    font-weight: 400;
    margin: 0;
}

/* ========================================
   KATEGORIEN
   ======================================== */
.ei-categories {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

@media (max-width: 400px) {
    .ei-categories {
        gap: 10px;
    }
}

.ei-category {
    cursor: pointer;
    display: block;
}

.ei-category input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.ei-category-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 10px;
    background: transparent;
    border: 2px solid var(--ei-braun);
    border-radius: 16px;
    transition: all var(--ei-transition);
    text-align: center;
    min-height: 130px;
}

.ei-category-box:hover {
    border-color: var(--ei-dotter);
    background: rgba(242, 165, 90, 0.05);
}

.ei-category input:checked + .ei-category-box {
    border-color: var(--ei-dotter);
    background: rgba(242, 165, 90, 0.1);
    box-shadow: 0 4px 20px rgba(242, 165, 90, 0.2);
}

.ei-category-emojis {
    font-size: 1.6rem;
    margin-bottom: 10px;
    letter-spacing: 2px;
}

@media (max-width: 400px) {
    .ei-category-emojis { font-size: 1.3rem; }
}

.ei-category-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--ei-braun);
    display: block;
    margin-bottom: 4px;
}

@media (max-width: 400px) {
    .ei-category-title { font-size: 0.9rem; }
}

.ei-category-sub {
    font-size: 0.75rem;
    color: var(--ei-braun-light);
    font-weight: 400;
    display: block;
}

/* ========================================
   INPUT FIELDS
   ======================================== */
.ei-field {
    margin-bottom: 20px;
    text-align: center;
}

.ei-field label {
    display: block;
    color: var(--ei-braun);
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.ei-required { color: var(--ei-dotter); }
.ei-optional { color: var(--ei-braun-light); font-weight: 400; font-size: 0.85rem; }

.ei-field input[type="text"],
.ei-field textarea {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid rgba(58, 38, 32, 0.15);
    border-radius: 12px;
    font-size: 1rem;
    font-family: inherit;
    transition: all var(--ei-transition);
    box-sizing: border-box;
    text-align: left;
}

.ei-field input:focus,
.ei-field textarea:focus {
    outline: none;
    border-color: var(--ei-dotter);
    box-shadow: 0 0 0 4px rgba(242, 165, 90, 0.15);
}

.ei-field textarea {
    resize: vertical;
    min-height: 100px;
}

.ei-field-meta {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 0.75rem;
}

.ei-field-hint { color: var(--ei-braun-light); }
.ei-char-count { color: var(--ei-braun); font-weight: 500; }

/* ========================================
   TAGS - KOMPAKT
   ======================================== */
.ei-tags-compact {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-bottom: 15px;
}

.ei-tag-chip {
    cursor: pointer;
    display: inline-block;
}

.ei-tag-chip input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.ei-chip {
    display: inline-block;
    padding: 8px 14px;
    background: transparent;
    color: var(--ei-braun);
    border: 2px solid var(--ei-braun);
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all var(--ei-transition);
    white-space: nowrap;
}

.ei-chip:hover {
    border-color: var(--ei-dotter);
    color: var(--ei-dotter);
}

.ei-tag-chip input:checked + .ei-chip {
    background: var(--ei-dotter);
    border-color: var(--ei-dotter);
    color: var(--ei-braun);
}

.ei-tag-chip.disabled .ei-chip {
    opacity: 0.3;
    cursor: not-allowed;
}

.ei-tag-shake {
    animation: tagShake 0.5s ease;
}

@keyframes tagShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

.ei-tag-error .ei-chip {
    border-color: var(--ei-error) !important;
    color: var(--ei-error) !important;
}

.ei-tag-counter {
    text-align: center;
    font-size: 0.9rem;
    color: var(--ei-braun-light);
    margin-bottom: 10px;
}

/* ========================================
   CHECKBOXES
   ======================================== */
.ei-checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    margin-bottom: 15px;
    padding: 12px 15px;
    background: rgba(58, 38, 32, 0.03);
    border-radius: 12px;
    transition: all var(--ei-transition);
    text-align: left;
}

.ei-checkbox-label:hover {
    background: rgba(242, 165, 90, 0.08);
}

.ei-checkbox-label input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.ei-checkbox-box {
    width: 22px;
    height: 22px;
    min-width: 22px;
    border: 2px solid var(--ei-braun);
    border-radius: 6px;
    background: var(--ei-weiss);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--ei-transition);
}

.ei-checkbox-label input:checked + .ei-checkbox-box {
    background: var(--ei-dotter);
    border-color: var(--ei-dotter);
}

.ei-checkbox-label input:checked + .ei-checkbox-box::after {
    content: '✓';
    color: var(--ei-braun);
    font-weight: bold;
    font-size: 13px;
}

.ei-checkbox-text {
    font-size: 0.9rem;
    color: var(--ei-braun);
    line-height: 1.4;
}

.ei-consent-label {
    background: rgba(242, 165, 90, 0.08);
    border: 1px solid rgba(242, 165, 90, 0.2);
}

.ei-divider {
    border: none;
    border-top: 2px solid var(--ei-dotter);
    margin: 20px 0;
}

.ei-privacy-note {
    text-align: center;
    font-size: 0.8rem;
    margin-bottom: 15px;
}

.ei-privacy-note a { color: var(--ei-dotter); }
.ei-privacy-note a:hover { text-decoration: underline; }

/* ========================================
   ERROR MESSAGES
   ======================================== */
.ei-err {
    color: var(--ei-error);
    font-size: 0.85rem;
    margin-top: 8px;
    text-align: center;
    min-height: 18px;
}

/* ========================================
   BUTTONS
   ======================================== */
.ei-nav {
    display: flex;
    justify-content: center;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid rgba(58, 38, 32, 0.1);
}

.ei-nav-split {
    justify-content: space-between;
    gap: 12px;
}

.ei-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 14px 22px;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--ei-transition);
    font-family: inherit;
    min-height: 48px;
}

.ei-btn-next,
.ei-btn-back {
    background: transparent;
    color: var(--ei-braun);
    border: 2px solid var(--ei-braun);
}

.ei-btn-next:hover,
.ei-btn-back:hover {
    background: var(--ei-braun);
    color: var(--ei-weiss);
}

.ei-btn-next {
    border-color: var(--ei-dotter);
    color: var(--ei-dotter);
}

.ei-btn-next:hover {
    background: var(--ei-dotter);
    color: var(--ei-braun);
}

.ei-btn-submit {
    background: var(--ei-braun);
    color: var(--ei-weiss);
    border: 2px solid var(--ei-braun);
    padding: 14px 24px;
}

.ei-btn-submit:hover {
    background: var(--ei-braun-light);
    border-color: var(--ei-braun-light);
}

.ei-arrow {
    font-size: 1rem;
    transition: transform var(--ei-transition);
}

.ei-btn-next:hover .ei-arrow { transform: translateX(3px); }
.ei-btn-back:hover .ei-arrow { transform: translateX(-3px); }

@media (max-width: 480px) {
    .ei-nav-split {
        flex-direction: column-reverse;
    }

    .ei-btn {
        width: 100%;
        font-size: 0.85rem;
        padding: 12px 18px;
    }
}

/* ========================================
   SUCCESS MESSAGE
   ======================================== */
.ei-success {
    text-align: center;
    padding: 40px 25px;
    background: var(--ei-weiss);
    border-radius: 20px;
    box-shadow: 0 4px 30px rgba(58, 38, 32, 0.1);
}

.ei-success-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.ei-success h3 {
    color: var(--ei-braun);
    font-size: 1.8rem;
    margin: 0 0 15px 0;
}

.ei-success p {
    color: var(--ei-braun-light);
    font-size: 1rem;
    line-height: 1.5;
    margin: 0 0 8px 0;
}

.ei-success-hint {
    color: var(--ei-dotter) !important;
    font-style: italic;
}

.ei-success-sig {
    color: var(--ei-braun) !important;
    font-weight: 600;
    margin-top: 20px !important;
}

.ei-new-story { margin-top: 25px; }
