/* Brand Colors */
:root {
    --brand-primary: #CD202C;
    --brand-secondary: #747678;
    --brand-bg: #FFFFFF;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--brand-bg);
    color: var(--brand-secondary);
    line-height: 1.6;
}

.container {
    max-width: 95%;
    margin: 0 auto;
    padding: 0 1rem;
}

@media (min-width: 1920px) {
    .container {
        max-width: 1800px;
    }
}

/* Header */
header {
    background: white;
    border-bottom: 1px solid rgba(116, 118, 120, 0.2);
    padding: 1rem 0;
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.logo img {
    height: 50px;
    width: auto;
    max-width: 180px;
    display: block;
}

nav {
    display: flex;
    gap: 2rem;
    align-items: center;
}

nav a {
    color: var(--brand-secondary);
    text-decoration: none;
    transition: color 0.2s;
}

nav a:hover {
    color: var(--brand-primary);
}

/* Language Switcher */
.lang-switcher {
    display: flex;
    gap: 0.5rem;
}

.lang-btn {
    padding: 0.5rem 1rem;
    border: 1px solid rgba(116, 118, 120, 0.2);
    background: white;
    color: var(--brand-secondary);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.lang-btn.active {
    background: var(--brand-primary);
    color: white;
    border-color: var(--brand-primary);
}

/* Buttons */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    background: var(--brand-primary);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.2s;
    text-decoration: none;
}

.btn-primary:hover {
    opacity: 0.9;
}

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

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    background: var(--brand-secondary);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.2s;
    text-decoration: none;
}

.btn-secondary:hover {
    opacity: 0.9;
}

.btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.2s;
    text-decoration: none;
}

.btn-danger:hover {
    opacity: 0.9;
}

/* Card */
.card {
    background: white;
    border: 1px solid rgba(116, 118, 120, 0.2);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* Search Bar */
.search-bar {
    width: 100%;
    max-width: 40rem;
    margin: 0 auto;
}

.search-bar input {
    width: 100%;
    padding: 1rem 1.5rem;
    font-size: 1.125rem;
    border: 2px solid rgba(116, 118, 120, 0.2);
    border-radius: 0.75rem;
    transition: border-color 0.2s;
}

.search-bar input:focus {
    outline: none;
    border-color: var(--brand-primary);
}

/* Product Grid */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.product-card {
    background: white;
    border: 1px solid rgba(116, 118, 120, 0.2);
    border-radius: 1rem;
    padding: 1.5rem;
    transition: box-shadow 0.2s;
}

.product-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.product-card h3 {
    font-size: 1.125rem;
    color: var(--brand-secondary);
    margin-bottom: 0.5rem;
}

.product-meta {
    font-size: 0.875rem;
    color: rgba(116, 118, 120, 0.6);
    margin-bottom: 0.75rem;
}

.product-description {
    font-size: 0.875rem;
    color: rgba(116, 118, 120, 0.8);
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-success {
    background: #d4edda;
    color: #155724;
}

.badge-danger {
    background: #f8d7da;
    color: #721c24;
}

/* Table */
table {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto;
}

table thead {
    border-bottom: 1px solid rgba(116, 118, 120, 0.2);
}

table th {
    text-align: left;
    padding: 0.75rem 1rem;
    font-weight: 500;
    color: var(--brand-secondary);
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(116, 118, 120, 0.1);
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: none;
}

table input[type="number"] {
    width: 5rem;
    padding: 0.5rem;
    border: 1px solid rgba(116, 118, 120, 0.2);
    border-radius: 0.375rem;
}

/* Form */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--brand-secondary);
}

.form-input,
.form-textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid rgba(116, 118, 120, 0.2);
    border-radius: 0.5rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--brand-primary);
}

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

.form-error {
    color: #dc3545;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.checkbox-group {
    display: flex;
    align-items: start;
    gap: 0.75rem;
}

.checkbox-group input[type="checkbox"] {
    margin-top: 0.25rem;
}

/* Footer */
footer {
    margin-top: 4rem;
    padding: 2rem 0;
    border-top: 1px solid rgba(116, 118, 120, 0.2);
    background: white;
    text-align: center;
    color: rgba(116, 118, 120, 0.6);
}

/* Chat Assistant */
.chat-widget {
    position: fixed;
    bottom: 80px;
    right: 20px;
    z-index: 9999;
}

.chat-button {
    width: 60px;
    height: 60px;
    background: var(--brand-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    font-size: 1.5rem;
    transition: transform 0.2s;
}

.chat-button:hover {
    transform: scale(1.1);
}

.chat-window {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(0,0,0,0.1);
    visibility: hidden; /* Firefox Fix */
}

.chat-window.active {
    display: flex;
    visibility: visible; /* Firefox Fix */
}

.chat-header {
    background: var(--brand-primary);
    color: white;
    padding: 1rem;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-messages {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.message {
    padding: 0.75rem;
    border-radius: 8px;
    max-width: 85%;
    font-size: 0.875rem;
    line-height: 1.4;
}

.message-user {
    background: #f0f0f0;
    align-self: flex-end;
    color: var(--brand-secondary);
}

.message-ai {
    background: rgba(205, 32, 44, 0.1);
    align-self: flex-start;
    color: var(--brand-secondary);
    border: 1px solid rgba(205, 32, 44, 0.1);
}

.chat-input-area {
    padding: 1rem;
    border-top: 1px solid #f0f0f0;
    display: flex;
    gap: 0.5rem;
}

.chat-input {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    outline: none;
}

.chat-send {
    background: var(--brand-primary);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
}

@media (max-width: 480px) {
    .chat-window {
        width: calc(100vw - 40px);
        height: 400px;
    }
}

/* Basket Drawer */
.basket-drawer {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--brand-primary);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 2rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: opacity 0.2s;
}

.basket-drawer:hover {
    opacity: 0.9;
}

.basket-counter {
    background: white;
    color: var(--brand-primary);
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-weight: bold;
    margin-left: 0.5rem;
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.mt-4 {
    margin-top: 2rem;
}

.mb-4 {
    margin-bottom: 2rem;
}

.py-12 {
    padding-top: 3rem;
    padding-bottom: 3rem;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.link-primary {
    color: var(--brand-primary);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.link-primary:hover {
    opacity: 0.9;
}

/* Loading Spinner */
.spinner {
    border: 3px solid rgba(116, 118, 120, 0.1);
    border-top: 3px solid var(--brand-primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 2rem auto;
}

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

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Responsive */
@media (max-width: 768px) {
    nav {
        flex-direction: column;
        gap: 1rem;
    }

    .product-grid {
        grid-template-columns: 1fr;
    }

    .basket-drawer {
        bottom: 1rem;
        right: 1rem;
        padding: 0.75rem 1rem;
    }

    table {
        font-size: 0.875rem;
    }

    table th,
    table td {
        padding: 0.5rem;
    }
    
    /* Überschriften auf mobilen Geräten anpassen */
    h1 {
        font-size: 1.75rem !important;
        overflow-wrap: anywhere;
        word-break: break-all;
        hyphens: auto;
        -webkit-hyphens: auto;
        -ms-hyphens: auto;
    }
}
