/**
 * HerbsAssist Consent Banner - Compact Bottom Dock & RTL Styles
 * Compliant with Amendment 13 to the Israeli Privacy Protection Law
 * Non-intrusive, sleek, docked at the bottom of the viewport
 */

/* Main Bottom Dock */
.ha-consent-dock {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 999999;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    box-shadow: 0 -4px 25px rgba(0, 0, 0, 0.08);
    font-family: 'Assistant', 'Heebo', system-ui, -apple-system, sans-serif;
    color: #1e293b;
    direction: rtl;
    text-align: right;
    box-sizing: border-box;
    transform: translateY(100%);
    opacity: 0;
    visibility: hidden;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease, visibility 0.25s ease;
}

.ha-consent-dock.ha-show {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

.ha-consent-dock-inner {
    max-width: 1240px;
    margin: 0 auto;
    padding: 14px 24px;
    box-sizing: border-box;
}

/* Horizontal Main Bar */
.ha-consent-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.ha-consent-bar-content {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 1;
    min-width: 0;
}

.ha-consent-bar-icon {
    font-size: 2rem;
    line-height: 1;
    flex-shrink: 0;
}

.ha-consent-text-wrap {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.ha-consent-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ha-consent-heading {
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
}

.ha-consent-badge-legal {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    color: #047857;
    background: #d1fae5;
    padding: 1px 8px;
    border-radius: 9999px;
    flex-shrink: 0;
}

.ha-consent-short-desc {
    font-size: 0.88rem;
    line-height: 1.45;
    color: #475569;
    margin: 0;
}

.ha-consent-policy-link {
    color: #059669;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
    margin-right: 6px;
    white-space: nowrap;
}

.ha-consent-policy-link:hover {
    color: #047857;
}

/* Action Buttons */
.ha-consent-bar-buttons {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.ha-btn {
    padding: 9px 18px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
    border: none;
    font-family: inherit;
    transition: all 0.2s ease;
    box-sizing: border-box;
    white-space: nowrap;
}

.ha-btn-primary {
    background: #059669;
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(5, 150, 105, 0.2);
}

.ha-btn-primary:hover {
    background: #047857;
    box-shadow: 0 4px 8px rgba(5, 150, 105, 0.3);
}

.ha-btn-secondary {
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #cbd5e1;
}

.ha-btn-secondary:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.ha-btn-outline {
    background: transparent;
    color: #475569;
    border: 1px solid #cbd5e1;
}

.ha-btn-outline:hover {
    background: #f8fafc;
    color: #059669;
    border-color: #059669;
}

/* Expandable Drawer (Upwards above the bar) */
.ha-consent-drawer {
    border-bottom: 1px solid #e2e8f0;
    margin-bottom: 14px;
    padding-bottom: 16px;
    animation: haDrawerSlideUp 0.25s ease-out;
}

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

.ha-drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.ha-drawer-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
}

.ha-drawer-sub {
    font-size: 0.84rem;
    color: #64748b;
}

.ha-drawer-close-btn {
    background: none;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    color: #94a3b8;
    padding: 4px 8px;
    border-radius: 6px;
}

.ha-drawer-close-btn:hover {
    color: #0f172a;
    background: #e2e8f0;
}

.ha-consent-categories-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 10px;
    max-height: 280px;
    overflow-y: auto;
    margin-bottom: 14px;
}

.ha-category-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px 14px;
    transition: border-color 0.2s ease;
}

.ha-category-card:hover {
    border-color: #cbd5e1;
}

.ha-category-card.ha-category-locked {
    background: #f1f5f9;
}

.ha-category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.ha-category-info {
    display: flex;
    align-items: center;
    gap: 6px;
}

.ha-category-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: #0f172a;
}

.ha-status-pill {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 9999px;
}

.ha-pill-locked {
    background: #e2e8f0;
    color: #475569;
}

.ha-category-desc {
    font-size: 0.8rem;
    color: #64748b;
    margin: 0;
    line-height: 1.45;
}

/* Toggle Switches */
.ha-category-toggle {
    display: inline-block;
    position: relative;
    width: 38px;
    height: 20px;
    flex-shrink: 0;
}

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

.ha-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #cbd5e1;
    transition: .2s ease;
    border-radius: 34px;
}

.ha-toggle-slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .2s ease;
    border-radius: 50%;
    box-shadow: 0 1px 2px rgba(0,0,0,0.25);
}

.ha-toggle-input:checked + .ha-toggle-slider {
    background-color: #059669;
}

.ha-toggle-input:checked + .ha-toggle-slider:before {
    transform: translateX(18px);
}

.ha-toggle-input:disabled + .ha-toggle-slider {
    background-color: #059669;
    opacity: 0.65;
    cursor: not-allowed;
}

.ha-drawer-actions {
    display: flex;
    justify-content: flex-end;
}

.ha-btn-save {
    background: #0f172a;
    color: #ffffff;
    padding: 8px 20px;
}

.ha-btn-save:hover {
    background: #1e293b;
}

/* Floating Settings Badge */
.ha-consent-badge {
    position: fixed;
    bottom: 18px;
    z-index: 99998;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 9999px;
    padding: 7px 14px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: 'Assistant', system-ui, sans-serif;
    font-size: 0.84rem;
    font-weight: 700;
    color: #334155;
    direction: rtl;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.ha-consent-badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
    color: #059669;
    border-color: #059669;
}

.ha-badge-icon {
    font-size: 1rem;
    line-height: 1;
}

.ha-badge-bottom-left { left: 18px; }
.ha-badge-bottom-right { right: 18px; }

/* Responsive Mobile Layout */
@media (max-width: 820px) {
    .ha-consent-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
    }
    .ha-consent-bar-buttons {
        display: flex;
        width: 100%;
    }
    .ha-consent-bar-buttons .ha-btn {
        flex: 1;
        padding: 9px 12px;
        font-size: 0.85rem;
    }
    .ha-consent-dock-inner {
        padding: 12px 16px;
    }
    .ha-consent-categories-list {
        grid-template-columns: 1fr;
    }
}
