/* FastTube Design System + Custom Styles */

/* ── Page Layout ── */

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f2937;
    line-height: 1.2;
}

.page-subtitle {
    font-size: 0.875rem;
    color: #6b7280;
    margin-top: 0.25rem;
}

/* ── Card ── */

.ft-card {
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.04), 0 1px 2px -1px rgb(0 0 0 / 0.04);
    border: 1px solid #f3f4f6;
}

/* ── Tab Navigation ── */

.tab-nav {
    display: flex;
    gap: 1.5rem;
    border-bottom: 2px solid #e5e7eb;
}

.tab-item {
    padding: 0.75rem 0.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #6b7280;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
    text-decoration: none;
}

.tab-item:hover {
    color: #374151;
}

.tab-item.active {
    color: #1e3a8a;
    border-bottom-color: #1e3a8a;
}

/* ── Badges ── */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 9999px;
    white-space: nowrap;
}

.badge-blue   { background: #dbeafe; color: #1d4ed8; }
.badge-green  { background: #dcfce7; color: #15803d; }
.badge-yellow { background: #fef3c7; color: #92400e; }
.badge-red    { background: #fee2e2; color: #b91c1c; }
.badge-gray   { background: #f3f4f6; color: #6b7280; }
.badge-purple { background: #f3e8ff; color: #7c3aed; }

/* ── Status Dots ── */

.status-dot {
    display: inline-block;
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 9999px;
}

.status-dot-green  { background-color: #22c55e; }
.status-dot-red    { background-color: #ef4444; }
.status-dot-yellow { background-color: #eab308; }

/* ── Tables ── */

.ft-table {
    width: 100%;
    font-size: 0.875rem;
    border-collapse: separate;
    border-spacing: 0;
}

.ft-table thead {
    background-color: #fafafa;
}

.ft-table thead th {
    padding: 0.75rem 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid #e5e7eb;
    border-right: 1px solid #f3f4f6;
    white-space: nowrap;
    user-select: none;
}

.ft-table thead th:last-child {
    border-right: none;
}

.ft-table tbody td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f3f4f6;
    border-right: 1px solid #f3f4f6;
    color: #374151;
}

.ft-table tbody td:last-child {
    border-right: none;
}

.ft-table tbody tr:last-child td {
    border-bottom: none;
}

.ft-table tbody tr:hover {
    background-color: #f9fafb;
}

.ft-table th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
}

.ft-table th.sortable:hover {
    color: #374151;
}

.ft-table th.sortable::after {
    content: '⇅';
    margin-left: 0.375rem;
    opacity: 0.25;
    font-size: 0.625rem;
    vertical-align: middle;
}

.ft-table th.sortable:hover::after {
    opacity: 0.5;
}

.ft-table th.sortable.sort-asc::after {
    content: '↑';
    opacity: 1;
    color: #1e3a8a;
}

.ft-table th.sortable.sort-desc::after {
    content: '↓';
    opacity: 1;
    color: #1e3a8a;
}

/* ── Filter Chips ── */

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 500;
    border-radius: 9999px;
    border: 1px solid #e5e7eb;
    background: white;
    color: #374151;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
}

.filter-chip:hover {
    border-color: #d1d5db;
    background: #f9fafb;
}

.filter-chip.active {
    border-color: #1e3a8a;
    background: #eff6ff;
    color: #1e3a8a;
}

.filter-chip .chip-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 0.25rem;
    font-size: 0.6875rem;
    font-weight: 600;
    border-radius: 9999px;
    background: #e5e7eb;
    color: #6b7280;
}

.filter-chip.active .chip-count {
    background: #1e3a8a;
    color: white;
}

.filter-chip.filter-chip-mine {
    border-color: #c084fc;
    color: #7c3aed;
    background: #faf5ff;
}

.filter-chip.filter-chip-mine:hover {
    border-color: #a855f7;
    background: #f3e8ff;
}

.filter-chip.filter-chip-mine.active {
    border-color: #7c3aed;
    background: #ede9fe;
    color: #6d28d9;
    font-weight: 600;
}

/* ── Pagination ── */

.ft-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-top: 1px solid #f3f4f6;
    font-size: 0.8125rem;
    color: #6b7280;
}

.page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    padding: 0 0.5rem;
    border-radius: 0.375rem;
    border: 1px solid #e5e7eb;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #374151;
    background: white;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
}

.page-btn:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

.page-btn.active {
    background: #1e3a8a;
    border-color: #1e3a8a;
    color: white;
}

.page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ── Form Elements ── */

.ft-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    color: #1f2937;
    background: white;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.ft-input:focus {
    outline: none;
    border-color: #1e3a8a;
    box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.1);
}

.ft-input::placeholder {
    color: #9ca3af;
}

.ft-btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: white;
    background: #1e3a8a;
    border-radius: 0.5rem;
    border: none;
    cursor: pointer;
    transition: background 0.15s;
}

.ft-btn-primary:hover {
    background: #172554;
}

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

.ft-btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.15s;
}

.ft-btn-secondary:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

/* ── Match Bar (Produktsuche) ── */

.match-bar {
    height: 8px;
    border-radius: 4px;
    background-color: #e5e7eb;
    overflow: hidden;
    min-width: 60px;
}

.match-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* ── Row Highlighting ── */

.row-exact-best {
    background-color: #dcfce7;
}

.row-exact {
    background-color: #f0fdf4;
}

.row-nearby {
    background-color: #ffffff;
}

/* ── Animations ── */

.cart-added {
    animation: cartPop 0.4s ease;
}

@keyframes cartPop {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); color: #16a34a; }
    100% { transform: scale(1); }
}

.step-section {
    animation: fadeIn 0.3s ease;
}

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

/* ── Cookie Consent ── */

.cookie-consent-enter {
    animation: cookieConsentIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.cookie-consent-exit {
    animation: cookieConsentOut 0.3s ease forwards;
}

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

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

/* ── Heidi Toast Notification ── */

.heidi-toast {
    position: fixed;
    top: 1.25rem;
    right: 1.25rem;
    z-index: 9999;
    width: 22rem;
    max-width: calc(100vw - 2.5rem);
    border-radius: 0.75rem;
    box-shadow: 0 10px 25px -5px rgb(0 0 0 / 0.15), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    overflow: hidden;
    animation: heidiSlideIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    padding: 1rem 1.125rem;
}

.heidi-toast-success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
}

.heidi-toast-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
}

.heidi-toast-icon {
    flex-shrink: 0;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.heidi-toast-icon-success {
    background: #dcfce7;
    color: #16a34a;
    animation: heidiIconPop 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.2s both;
}

.heidi-toast-icon-error {
    background: #fee2e2;
    color: #dc2626;
    animation: heidiIconPop 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.2s both;
}

.heidi-toast-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
    line-height: 1.3;
}

.heidi-toast-message {
    font-size: 0.75rem;
    color: #6b7280;
    margin: 0.125rem 0 0;
    line-height: 1.4;
}

.heidi-toast-close {
    flex-shrink: 0;
    background: none;
    border: none;
    font-size: 1.25rem;
    color: #9ca3af;
    cursor: pointer;
    padding: 0 0.25rem;
    line-height: 1;
    transition: color 0.15s;
}

.heidi-toast-close:hover {
    color: #6b7280;
}

.heidi-toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    border-radius: 0 0 0.75rem 0.75rem;
    animation: heidiProgress 5s linear forwards;
}

.heidi-toast-success .heidi-toast-progress {
    background: #22c55e;
}

.heidi-toast-error .heidi-toast-progress {
    background: #ef4444;
}

.heidi-toast-exit {
    animation: heidiSlideOut 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

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

@keyframes heidiIconPop {
    from { transform: scale(0); }
    50%  { transform: scale(1.2); }
    to   { transform: scale(1); }
}

@keyframes heidiProgress {
    from { width: 100%; }
    to   { width: 0%; }
}

/* ── Responsive ── */

@media (max-width: 640px) {
    .tab-nav {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .tab-item {
        white-space: nowrap;
    }
}

/* ══════════════════════════════════════════════
   Dark Mode (Admin)
   Aktiviert via class="dark" auf <html>
   ══════════════════════════════════════════════ */

/* ── Dark: Page Layout ── */

html.dark .page-title {
    color: #e2e8f0;
}

html.dark .page-subtitle {
    color: #94a3b8;
}

/* ── Dark: Card ── */

html.dark .ft-card {
    background: #1e293b;
    border-color: #334155;
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.2), 0 1px 2px -1px rgb(0 0 0 / 0.2);
}

/* ── Dark: Tab Navigation ── */

html.dark .tab-nav {
    border-bottom-color: #334155;
}

html.dark .tab-item {
    color: #94a3b8;
}

html.dark .tab-item:hover {
    color: #e2e8f0;
}

html.dark .tab-item.active {
    color: #60a5fa;
    border-bottom-color: #60a5fa;
}

/* ── Dark: Badges ── */

html.dark .badge-blue   { background: #1e3a5f; color: #93c5fd; }
html.dark .badge-green  { background: #14532d; color: #86efac; }
html.dark .badge-yellow { background: #422006; color: #fcd34d; }
html.dark .badge-red    { background: #450a0a; color: #fca5a5; }
html.dark .badge-gray   { background: #334155; color: #94a3b8; }
html.dark .badge-purple { background: #2e1065; color: #c4b5fd; }

/* ── Dark: Tables ── */

html.dark .ft-table thead {
    background-color: #0f172a;
}

html.dark .ft-table thead th {
    color: #94a3b8;
    border-bottom-color: #334155;
    border-right-color: #334155;
}

html.dark .ft-table tbody td {
    border-bottom-color: #1e293b;
    border-right-color: #1e293b;
    color: #cbd5e1;
}

html.dark .ft-table tbody tr:hover {
    background-color: #0f172a;
}

html.dark .ft-table th.sortable:hover {
    color: #e2e8f0;
}

html.dark .ft-table th.sortable.sort-asc::after,
html.dark .ft-table th.sortable.sort-desc::after {
    color: #60a5fa;
}

/* ── Dark: Filter Chips ── */

html.dark .filter-chip {
    border-color: #475569;
    background: #1e293b;
    color: #cbd5e1;
}

html.dark .filter-chip:hover {
    border-color: #64748b;
    background: #334155;
}

html.dark .filter-chip.active {
    border-color: #3b82f6;
    background: #1e3a5f;
    color: #93c5fd;
}

html.dark .filter-chip .chip-count {
    background: #475569;
    color: #94a3b8;
}

html.dark .filter-chip.active .chip-count {
    background: #3b82f6;
    color: white;
}

html.dark .filter-chip.filter-chip-mine {
    border-color: #7c3aed;
    background: #2e1065;
    color: #c4b5fd;
}

html.dark .filter-chip.filter-chip-mine:hover {
    border-color: #8b5cf6;
    background: #3b0764;
}

html.dark .filter-chip.filter-chip-mine.active {
    border-color: #a78bfa;
    background: #4c1d95;
    color: #ddd6fe;
}

/* ── Dark: Pagination ── */

html.dark .ft-pagination {
    border-top-color: #334155;
    color: #94a3b8;
}

html.dark .page-btn {
    border-color: #475569;
    color: #cbd5e1;
    background: #1e293b;
}

html.dark .page-btn:hover {
    background: #334155;
    border-color: #64748b;
}

html.dark .page-btn.active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: white;
}

/* ── Dark: Form Elements ── */

html.dark .ft-input {
    border-color: #475569;
    color: #e2e8f0;
    background: #0f172a;
}

html.dark .ft-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

html.dark .ft-input::placeholder {
    color: #64748b;
}

html.dark .ft-btn-primary {
    background: #3b82f6;
}

html.dark .ft-btn-primary:hover {
    background: #2563eb;
}

html.dark .ft-btn-secondary {
    color: #cbd5e1;
    background: #1e293b;
    border-color: #475569;
}

html.dark .ft-btn-secondary:hover {
    background: #334155;
    border-color: #64748b;
}

/* ── Dark: Select (dropdown) ── */

html.dark select.ft-input {
    color-scheme: dark;
}

/* ── Dark: Match Bar ── */

html.dark .match-bar {
    background-color: #334155;
}

/* ── Dark: Row Highlighting ── */

html.dark .row-exact-best {
    background-color: #14532d;
}

html.dark .row-exact {
    background-color: #052e16;
}

html.dark .row-nearby {
    background-color: #1e293b;
}

/* ── Dark: Heidi Toast ── */

html.dark .heidi-toast-success {
    background: #052e16;
    border-color: #14532d;
}

html.dark .heidi-toast-error {
    background: #450a0a;
    border-color: #7f1d1d;
}

html.dark .heidi-toast-icon-success {
    background: #14532d;
    color: #4ade80;
}

html.dark .heidi-toast-icon-error {
    background: #7f1d1d;
    color: #fca5a5;
}

html.dark .heidi-toast-title {
    color: #e2e8f0;
}

html.dark .heidi-toast-message {
    color: #94a3b8;
}

html.dark .heidi-toast-close {
    color: #64748b;
}

html.dark .heidi-toast-close:hover {
    color: #94a3b8;
}

/* ── Dark: Inline Tailwind Utility Overrides ──
   Überschreibt häufig in Admin-Seiten verwendete
   Tailwind-Klassen im Dark-Mode-Kontext.        */

/* Backgrounds */
html.dark .bg-white       { background-color: #1e293b !important; }
html.dark .bg-gray-50     { background-color: #0f172a !important; }
html.dark .bg-gray-100    { background-color: #1e293b !important; }
html.dark .bg-gray-200    { background-color: #334155 !important; }

/* Alert Backgrounds */
html.dark .bg-red-50      { background-color: #1c1917 !important; }
html.dark .bg-green-50    { background-color: #052e16 !important; }
html.dark .bg-blue-50     { background-color: #1e3a5f !important; }

/* Text Colors */
html.dark .text-gray-900  { color: #f1f5f9 !important; }
html.dark .text-gray-800  { color: #e2e8f0 !important; }
html.dark .text-gray-700  { color: #cbd5e1 !important; }
html.dark .text-gray-600  { color: #94a3b8 !important; }
html.dark .text-gray-500  { color: #94a3b8 !important; }
html.dark .text-gray-400  { color: #64748b !important; }

/* Alert Text */
html.dark .text-red-700   { color: #fca5a5 !important; }
html.dark .text-red-600   { color: #fca5a5 !important; }
html.dark .text-green-800 { color: #86efac !important; }
html.dark .text-green-600 { color: #4ade80 !important; }
html.dark .text-green-700 { color: #4ade80 !important; }
html.dark .text-yellow-600 { color: #fbbf24 !important; }

/* Link Colors */
html.dark .text-blue-600  { color: #60a5fa !important; }
html.dark .text-blue-700  { color: #93c5fd !important; }
html.dark .text-purple-600 { color: #a78bfa !important; }

/* Borders */
html.dark .border-gray-100 { border-color: #334155 !important; }
html.dark .border-gray-200 { border-color: #475569 !important; }
html.dark .border-gray-300 { border-color: #475569 !important; }
html.dark .border-red-200  { border-color: #7f1d1d !important; }
html.dark .border-green-200 { border-color: #14532d !important; }

/* Divide Colors */
html.dark .divide-gray-100 > * + * { border-color: #334155 !important; }
html.dark .divide-gray-200 > * + * { border-color: #475569 !important; }

/* Hover States */
html.dark .hover\:text-blue-600:hover  { color: #93c5fd !important; }
html.dark .hover\:text-blue-700:hover  { color: #93c5fd !important; }
html.dark .hover\:text-gray-700:hover  { color: #e2e8f0 !important; }
html.dark .hover\:bg-blue-100:hover    { background-color: #1e3a5f !important; }

/* File Input */
html.dark .file\:bg-blue-50 { background-color: #1e3a5f !important; }
html.dark .file\:text-blue-700 { color: #93c5fd !important; }

/* Checkbox */
html.dark .text-blue-600[type="checkbox"] { accent-color: #3b82f6; }
