/**
 * Consent Banner Styles
 *
 * Cookie consent banner CSS with dark/light theme support.
 *
 * @package HiCare_Panel
 * @subpackage Modules/Cookies
 * @since 1.0.0
 */

/* ============================================
   CSS Custom Properties
   ============================================ */

.hcp-consent-banner--light {
    --hcp-bg: rgba(255, 255, 255, 0.85);
    --hcp-bg-secondary: rgba(248, 250, 252, 0.9);
    --hcp-border: rgba(226, 232, 240, 0.6);
    --hcp-text: #1e293b;
    --hcp-text-secondary: #64748b;
    --hcp-text-muted: #94a3b8;
    --hcp-primary: var(--hi-primary, #3b82f6);
    --hcp-primary-hover: var(--hi-primary-hover, #2563eb);
    --hcp-success: #22c55e;
    --hcp-danger: #ef4444;
    --hcp-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(255, 255, 255, 0.5) inset;
    --hcp-toggle-bg: #cbd5e1;
    --hcp-toggle-bg-active: var(--hi-primary, #3b82f6);
}

.hcp-consent-banner--dark {
    --hcp-bg: rgba(30, 41, 59, 0.85);
    --hcp-bg-secondary: rgba(15, 23, 42, 0.9);
    --hcp-border: rgba(51, 65, 85, 0.6);
    --hcp-text: #f1f5f9;
    --hcp-text-secondary: #94a3b8;
    --hcp-text-muted: #64748b;
    --hcp-primary: var(--hi-primary, #60a5fa);
    --hcp-primary-hover: var(--hi-primary-hover, #3b82f6);
    --hcp-success: #4ade80;
    --hcp-danger: #f87171;
    --hcp-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    --hcp-toggle-bg: #475569;
    --hcp-toggle-bg-active: var(--hi-primary, #60a5fa);
}

/* ============================================
   Consent Banner Base
   ============================================ */

.hcp-consent-banner {
    position: fixed;
    left: 0;
    right: 0;
    z-index: 999999;
    padding: 0 16px;
    font-family: var(--hi-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif);
    line-height: 1.5;
    box-sizing: border-box;
}

.hcp-consent-banner--bottom {
    bottom: 0;
    padding-bottom: 16px;
}

.hcp-consent-banner--top {
    top: 0;
    padding-top: 16px;
}

.hcp-consent-banner *,
.hcp-consent-banner *::before,
.hcp-consent-banner *::after {
    box-sizing: border-box;
}

.hcp-consent-banner__container {
    max-width: 960px;
    margin: 0 auto;
    background: var(--hcp-bg);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-radius: 16px;
    box-shadow: var(--hcp-shadow);
    border: 1px solid var(--hcp-border);
    overflow: hidden;
    animation: hcpSlideIn 0.4s ease;
}

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

/* ============================================
   Main View
   ============================================ */

.hcp-consent-banner__main {
    padding: 24px;
}

.hcp-consent-banner__content {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.hcp-consent-banner__icon {
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border-radius: 12px;
}

.hcp-consent-banner__cookie-img {
    width: 56px;
    height: 56px;
    object-fit: contain;
    transition: transform 0.3s ease;
    animation: cookieFloat 3s ease-in-out infinite;
}

.hcp-consent-banner__icon:hover .hcp-consent-banner__cookie-img {
    animation: cookieWiggle 0.5s ease-in-out;
}

@keyframes cookieFloat {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-4px) rotate(3deg); }
}

@keyframes cookieWiggle {
    0%, 100% { transform: rotate(0deg) scale(1); }
    25% { transform: rotate(-10deg) scale(1.1); }
    75% { transform: rotate(10deg) scale(1.1); }
}

.hcp-consent-banner__text {
    flex: 1;
    min-width: 0;
}

.hcp-consent-banner__title {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--hcp-text);
}

.hcp-consent-banner__description {
    margin: 0;
    font-size: 14px;
    color: var(--hcp-text-secondary);
}

/* ============================================
   Actions
   ============================================ */

.hcp-consent-banner__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: flex-end;
}

.hcp-consent-banner__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.hcp-consent-banner__btn--accept {
    background: var(--hcp-primary);
    color: #ffffff;
}

.hcp-consent-banner__btn--accept:hover {
    background: var(--hcp-primary-hover);
    transform: translateY(-1px);
}

.hcp-consent-banner__btn--reject {
    background: transparent;
    color: var(--hcp-text-secondary);
    border: 1px solid var(--hcp-border);
}

.hcp-consent-banner__btn--reject:hover {
    background: var(--hcp-bg-secondary);
    color: var(--hcp-text);
}

.hcp-consent-banner__btn--settings {
    background: var(--hcp-bg-secondary);
    color: var(--hcp-text);
    border: 1px solid var(--hcp-border);
}

.hcp-consent-banner__btn--settings:hover {
    border-color: var(--hcp-primary);
    color: var(--hcp-primary);
}

.hcp-consent-banner__btn--save {
    background: var(--hcp-success);
    color: #ffffff;
}

.hcp-consent-banner__btn--save:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* ============================================
   Settings View
   ============================================ */

.hcp-consent-banner__settings {
    max-height: 70vh;
    overflow-y: auto;
}

.hcp-consent-banner__settings-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
    border-bottom: 1px solid var(--hcp-border);
    position: sticky;
    top: 0;
    background: var(--hcp-bg);
    z-index: 10;
}

.hcp-consent-banner__back {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--hcp-bg-secondary);
    border: 1px solid var(--hcp-border);
    border-radius: 8px;
    color: var(--hcp-text);
    cursor: pointer;
    transition: all 0.2s ease;
}

.hcp-consent-banner__back:hover {
    border-color: var(--hcp-primary);
    color: var(--hcp-primary);
}

.hcp-consent-banner__settings-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--hcp-text);
}

.hcp-consent-banner__categories {
    padding: 16px 24px;
}

/* ============================================
   Category
   ============================================ */

.hcp-consent-banner__category {
    padding: 16px 0;
    border-bottom: 1px solid var(--hcp-border);
}

.hcp-consent-banner__category:last-child {
    border-bottom: none;
}

.hcp-consent-banner__category-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.hcp-consent-banner__category-info {
    flex: 1;
    min-width: 0;
}

.hcp-consent-banner__category-name {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--hcp-text);
    margin-bottom: 4px;
}

.hcp-consent-banner__required {
    font-weight: 400;
    font-size: 12px;
    color: var(--hcp-text-muted);
}

.hcp-consent-banner__category-desc {
    display: block;
    font-size: 13px;
    color: var(--hcp-text-secondary);
}

/* ============================================
   Toggle Switch
   ============================================ */

.hcp-consent-banner__toggle {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
}

.hcp-consent-banner__toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.hcp-consent-banner__toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--hcp-toggle-bg);
    border-radius: 26px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.hcp-consent-banner__toggle-slider::before {
    content: '';
    position: absolute;
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background: #ffffff;
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.hcp-consent-banner__toggle input:checked + .hcp-consent-banner__toggle-slider {
    background: var(--hcp-toggle-bg-active);
}

.hcp-consent-banner__toggle input:checked + .hcp-consent-banner__toggle-slider::before {
    transform: translateX(22px);
}

.hcp-consent-banner__toggle input:disabled + .hcp-consent-banner__toggle-slider {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ============================================
   Expand Cookies
   ============================================ */

.hcp-consent-banner__expand {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    padding: 0;
    font-size: 13px;
    color: var(--hcp-primary);
    background: none;
    border: none;
    cursor: pointer;
}

.hcp-consent-banner__expand:hover {
    text-decoration: underline;
}

.hcp-consent-banner__expand svg {
    transition: transform 0.2s ease;
}

.hcp-consent-banner__expand.is-expanded svg {
    transform: rotate(180deg);
}

.hcp-consent-banner__cookies {
    margin-top: 12px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--hcp-border);
}

.hcp-consent-banner__table {
    width: 100%;
    font-size: 12px;
    border-collapse: collapse;
}

.hcp-consent-banner__table th,
.hcp-consent-banner__table td {
    padding: 10px 12px;
    text-align: left;
}

.hcp-consent-banner__table th {
    background: var(--hcp-bg-secondary);
    color: var(--hcp-text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
}

.hcp-consent-banner__table td {
    color: var(--hcp-text);
    border-top: 1px solid var(--hcp-border);
}

.hcp-consent-banner__table tr:first-child td {
    border-top: none;
}

/* ============================================
   Settings Actions
   ============================================ */

.hcp-consent-banner__settings-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: flex-end;
    padding: 16px 24px;
    border-top: 1px solid var(--hcp-border);
    background: var(--hcp-bg);
    position: sticky;
    bottom: 0;
}

/* ============================================
   Footer
   ============================================ */

.hcp-consent-banner__footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
    padding: 12px 24px;
    background: var(--hcp-bg-secondary);
    border-top: 1px solid var(--hcp-border);
    font-size: 12px;
}

.hcp-consent-banner__link {
    color: var(--hcp-text-secondary);
    text-decoration: none;
}

.hcp-consent-banner__link:hover {
    color: var(--hcp-primary);
}

.hcp-consent-banner__powered {
    margin-left: auto;
    color: var(--hcp-text-muted);
}

/* ============================================
   Floating Cookie Button
   ============================================ */

.hcp-consent-button {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 999998;
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--hcp-bg);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--hcp-border);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--hcp-shadow);
    transition: all 0.3s ease;
    padding: 0;
}

.hcp-consent-button__icon {
    width: 32px;
    height: 32px;
    object-fit: contain;
    transition: transform 0.3s ease;
    animation: buttonCookieFloat 3s ease-in-out infinite;
}

@keyframes buttonCookieFloat {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-5deg); }
    75% { transform: rotate(5deg); }
}

.hcp-consent-button:hover {
    transform: scale(1.1);
    border-color: var(--hcp-primary);
}

.hcp-consent-button:hover .hcp-consent-button__icon {
    animation: buttonCookieWiggle 0.5s ease-in-out;
}

@keyframes buttonCookieWiggle {
    0%, 100% { transform: rotate(0deg) scale(1); }
    25% { transform: rotate(-15deg) scale(1.15); }
    75% { transform: rotate(15deg) scale(1.15); }
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 640px) {
    .hcp-consent-banner {
        padding: 0 8px;
    }
    
    .hcp-consent-banner--bottom {
        padding-bottom: 8px;
    }
    
    .hcp-consent-banner__container {
        border-radius: 12px;
    }
    
    .hcp-consent-banner__main {
        padding: 16px;
    }
    
    .hcp-consent-banner__content {
        flex-direction: column;
        gap: 12px;
    }
    
    .hcp-consent-banner__icon {
        width: 48px;
        height: 48px;
    }
    
    .hcp-consent-banner__cookie-img {
        width: 48px;
        height: 48px;
    }
    
    .hcp-consent-banner__title {
        font-size: 16px;
    }
    
    .hcp-consent-banner__description {
        font-size: 13px;
    }
    
    .hcp-consent-banner__actions {
        flex-direction: column;
    }
    
    .hcp-consent-banner__btn {
        width: 100%;
    }
    
    .hcp-consent-banner__settings-header,
    .hcp-consent-banner__categories,
    .hcp-consent-banner__settings-actions,
    .hcp-consent-banner__footer {
        padding-left: 16px;
        padding-right: 16px;
    }
    
    .hcp-consent-banner__settings-actions {
        flex-direction: column;
    }
    
    .hcp-consent-banner__footer {
        flex-direction: column;
        text-align: center;
    }
    
    .hcp-consent-banner__powered {
        margin-left: 0;
    }
    
    .hcp-consent-button {
        width: 48px;
        height: 48px;
        bottom: 16px;
        left: 16px;
    }
    
    .hcp-consent-button__icon {
        width: 28px;
        height: 28px;
    }
}

/* ============================================
   Animation for showing/hiding
   ============================================ */

.hcp-consent-banner.is-hiding {
    animation: hcpSlideOut 0.3s ease forwards;
}

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

/* ============================================
   Cookie List Styles
   ============================================ */

.hcp-consent-banner__cookie-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 12px;
    background: var(--hcp-bg-secondary);
    border-radius: 8px;
    margin-top: 8px;
}

.hcp-consent-banner__cookie-name {
    display: inline-block;
    padding: 4px 10px;
    font-size: 12px;
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    background: var(--hcp-bg);
    border: 1px solid var(--hcp-border);
    border-radius: 4px;
    color: var(--hcp-text-secondary);
}

/* ============================================
   Print Styles
   ============================================ */

@media print {
    .hcp-consent-banner,
    .hcp-consent-button {
        display: none !important;
    }
}
