/* =========================================================================
   Cookie Consent – Standalone Styles
   Modular, projektübergreifend einsetzbar.
   ========================================================================= */

/* ----- Variables (override via :root) ----- */
:root {
    --cc-primary: #e64a19;
    --cc-primary-hover: #d4400f;
    --cc-dark: #1e1e1e;
    --cc-light: #fbfbfb;
    --cc-radius: 0.75rem;
    --cc-font: 'Inter', system-ui, -apple-system, sans-serif;
    --cc-z: 999999;
}

/* =========================================================================
   OVERLAY
   ========================================================================= */

.cc-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: var(--cc-z);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.cc-overlay.is-visible {
    opacity: 1;
    visibility: visible;
}

/* =========================================================================
   MODAL
   ========================================================================= */

.cc-modal {
    background: #fff;
    border-radius: var(--cc-radius);
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.15);
    max-width: 640px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(16px) scale(0.98);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: var(--cc-font);
}

.cc-overlay.is-visible .cc-modal {
    transform: translateY(0) scale(1);
}

/* ----- Header ----- */

.cc-header {
    padding: 1.5rem 1.5rem 0;
    text-align: center;
}

.cc-header-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.cc-header-logo img {
    height: 28px;
    width: auto;
}

.cc-header-logo span {
    font-size: 1.0625rem;
    font-weight: 700;
    color: var(--cc-dark);
}

.cc-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--cc-dark);
    margin: 0 0 0.5rem;
}

.cc-description {
    font-size: 0.875rem;
    line-height: 1.6;
    color: #6b7280;
    margin: 0;
}

.cc-description a {
    color: var(--cc-primary);
    text-decoration: none;
}

.cc-description a:hover {
    text-decoration: underline;
}

/* ----- Body (scrollable) ----- */

.cc-body {
    padding: 1.25rem 1.5rem;
    overflow-y: auto;
    flex: 1;
}

/* ----- Tabs ----- */

.cc-tabs {
    display: flex;
    border-bottom: 2px solid #f3f4f6;
    margin-bottom: 1rem;
    gap: 0;
}

.cc-tab {
    flex: 1;
    padding: 0.625rem 0.5rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #9ca3af;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
    font-family: inherit;
}

.cc-tab:hover {
    color: #6b7280;
}

.cc-tab.is-active {
    color: var(--cc-primary);
    border-bottom-color: var(--cc-primary);
}

.cc-tab-panel {
    display: none;
}

.cc-tab-panel.is-active {
    display: block;
}

/* ----- Category Cards ----- */

.cc-category {
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    margin-bottom: 0.75rem;
    overflow: hidden;
}

.cc-category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    cursor: pointer;
    user-select: none;
    gap: 0.75rem;
}

.cc-category-header:hover {
    background: #fafafa;
}

.cc-category-info {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    flex: 1;
    min-width: 0;
}

.cc-category-icon {
    width: 2.25rem;
    height: 2.25rem;
    padding: 0.4rem;
    border-radius: 0.375rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.875rem;
}

.cc-category-icon.cc-icon-essential   { background: #dcfce7; color: #16a34a; }
.cc-category-icon.cc-icon-functional  { background: #dbeafe; color: #2563eb; }
.cc-category-icon.cc-icon-statistics  { background: #fef3c7; color: #d97706; }
.cc-category-icon.cc-icon-marketing   { background: #fce7f3; color: #db2777; }
.cc-category-icon.cc-icon-external    { background: #e0e7ff; color: #4f46e5; }

.cc-category-text {
    min-width: 0;
}

.cc-category-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--cc-dark);
    margin: 0;
}

.cc-category-count {
    font-size: 0.75rem;
    color: #9ca3af;
    margin: 0;
}

.cc-category-chevron {
    width: 1.25rem;
    height: 1.25rem;
    color: #d1d5db;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.cc-category.is-open .cc-category-chevron {
    transform: rotate(180deg);
}

/* ----- Toggle Switch ----- */

.cc-toggle {
    position: relative;
    width: 2.75rem;
    height: 1.5rem;
    flex-shrink: 0;
}

.cc-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.cc-toggle-track {
    position: absolute;
    inset: 0;
    background: #d1d5db;
    border-radius: 9999px;
    cursor: pointer;
    transition: background 0.2s;
}

.cc-toggle input:checked + .cc-toggle-track {
    background: var(--cc-primary);
}

.cc-toggle-track::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 1.25rem;
    height: 1.25rem;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.cc-toggle input:checked + .cc-toggle-track::after {
    transform: translateX(1.25rem);
}

.cc-toggle input:disabled + .cc-toggle-track {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ----- Category Details ----- */

.cc-category-details {
    display: none;
    padding: 0 1rem 0.75rem;
    border-top: 1px solid #f3f4f6;
}

.cc-category.is-open .cc-category-details {
    display: block;
}

.cc-category-desc {
    font-size: 0.8125rem;
    color: #6b7280;
    line-height: 1.6;
    margin: 0.75rem 0;
}

.cc-cookie-table {
    width: 100%;
    font-size: 0.75rem;
    border-collapse: collapse;
}

.cc-cookie-table th {
    text-align: left;
    font-weight: 600;
    color: #6b7280;
    padding: 0.375rem 0.5rem;
    border-bottom: 1px solid #e5e7eb;
    white-space: nowrap;
}

.cc-cookie-table td {
    padding: 0.375rem 0.5rem;
    color: #374151;
    border-bottom: 1px solid #f3f4f6;
    word-break: break-word;
}

/* ----- Footer / Actions ----- */

.cc-footer {
    padding: 1rem 1.5rem 1.25rem;
    border-top: 1px solid #f3f4f6;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.cc-btn {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: inherit;
    border-radius: 0.5rem;
    border: none;
    cursor: pointer;
    text-align: center;
    transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
}

.cc-btn:active {
    transform: scale(0.98);
}

.cc-btn-accept {
    background: linear-gradient(135deg, var(--cc-primary), #eb6d10);
    color: #fff;
    box-shadow: 0 2px 8px rgba(230, 74, 25, 0.25);
}

.cc-btn-accept:hover {
    box-shadow: 0 4px 16px rgba(230, 74, 25, 0.35);
}

.cc-btn-save {
    background: #f3f4f6;
    color: var(--cc-dark);
}

.cc-btn-save:hover {
    background: #e5e7eb;
}

.cc-btn-row {
    display: flex;
    gap: 0.5rem;
}

.cc-btn-row .cc-btn {
    flex: 1;
}

.cc-essential-link {
    display: block;
    text-align: center;
    font-size: 0.8125rem;
    color: #9ca3af;
    cursor: pointer;
    padding: 0.25rem 0;
    background: none;
    border: none;
    font-family: inherit;
    transition: color 0.15s;
}

.cc-essential-link:hover {
    color: #6b7280;
}

/* =========================================================================
   IFRAME PLACEHOLDER
   ========================================================================= */

.cc-placeholder {
    background: #f9fafb;
    border: 1px dashed #d1d5db;
    border-radius: 0.5rem;
    padding: 2rem;
    text-align: center;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    font-family: var(--cc-font);
}

.cc-placeholder-icon {
    font-size: 2rem;
    color: #d1d5db;
}

.cc-placeholder-text {
    font-size: 0.875rem;
    color: #6b7280;
    line-height: 1.5;
    max-width: 320px;
}

.cc-placeholder-btn {
    display: inline-block;
    padding: 0.5rem 1.25rem;
    font-size: 0.8125rem;
    font-weight: 600;
    background: var(--cc-primary);
    color: #fff;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
}

.cc-placeholder-btn:hover {
    background: var(--cc-primary-hover);
}

/* =========================================================================
   SETTINGS TRIGGER (re-open button, bottom-left)
   ========================================================================= */

.cc-settings-trigger {
    position: fixed;
    bottom: 1rem;
    left: 1rem;
    z-index: calc(var(--cc-z) - 1);
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    background: var(--cc-dark);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
    transition: background 0.15s, transform 0.15s;
    font-size: 1.125rem;
}

.cc-settings-trigger:hover {
    background: var(--cc-primary);
    transform: scale(1.08);
}

.cc-settings-trigger svg {
    width: 1.125rem;
    height: 1.125rem;
}

/* =========================================================================
   RESPONSIVE
   ========================================================================= */

@media (max-width: 480px) {
    .cc-modal {
        max-height: 95vh;
        border-radius: 0.75rem 0.75rem 0 0;
        margin-top: auto;
    }

    .cc-overlay {
        align-items: flex-end;
        padding: 0;
    }

    .cc-header {
        padding: 1.25rem 1.25rem 0;
    }

    .cc-body {
        padding: 1rem 1.25rem;
    }

    .cc-footer {
        padding: 0.75rem 1.25rem 1rem;
    }

    .cc-btn-row {
        flex-direction: column;
    }
}
