/**
 * Privacy Hub Pro - Public Styles
 *
 * Consent banner styles with clean, professional design.
 * Supports customization via CSS custom properties.
 *
 * @package Privacy_Hub_Pro
 * @since   1.0.0
 */

/* ==========================================================================
   CSS Variables with Defaults
   ========================================================================== */

.php-consent-banner {
    --php-primary-color: #2e7d32;
    --php-primary-hover: #388e3c;
    --php-link-color: #4a9eff;
}

/* ==========================================================================
   Consent Banner - Base Styles
   ========================================================================== */

.php-consent-banner {
    position: fixed;
    z-index: 999999;
    padding: 15px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

/* Position Variants */
.php-position-bottom {
    bottom: 0;
    left: 0;
    right: 0;
}

.php-position-top {
    top: 0;
    left: 0;
    right: 0;
}

.php-position-bottom-left {
    bottom: 20px;
    left: 20px;
    right: auto;
    max-width: 400px;
}

.php-position-bottom-right {
    bottom: 20px;
    right: 20px;
    left: auto;
    max-width: 400px;
}

/* Floating positions remove the container padding for cards */
.php-position-bottom-left .php-consent-inner,
.php-position-bottom-right .php-consent-inner {
    max-width: 100%;
}

.php-position-bottom-left .php-consent-actions,
.php-position-bottom-right .php-consent-actions {
    flex-direction: column;
    width: 100%;
}

.php-position-bottom-left .php-consent-btn,
.php-position-bottom-right .php-consent-btn {
    width: 100%;
}

/* ==========================================================================
   Banner Inner Container
   ========================================================================== */

.php-consent-inner {
    max-width: 1000px;
    margin: 0 auto;
    border-radius: 8px;
    padding: 20px 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

/* Dark Style (Default) */
.php-style-dark .php-consent-inner {
    background: #1e1e1e;
    color: #fff;
}

.php-style-dark .php-consent-text {
    color: rgba(255, 255, 255, 0.8);
}

.php-style-dark .php-btn-reject {
    background: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.8);
}

.php-style-dark .php-btn-reject:hover {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
}

/* Light Style */
.php-style-light .php-consent-inner {
    background: #ffffff;
    color: #1e1e1e;
    border: 1px solid #e0e0e0;
}

.php-style-light .php-consent-text {
    color: #666;
}

.php-style-light .php-btn-reject {
    background: #f5f5f5;
    color: #333;
    border: 1px solid #ddd;
}

.php-style-light .php-btn-reject:hover {
    background: #e8e8e8;
}

.php-style-light .php-btn-customize {
    color: #333;
    border-color: #ccc;
}

.php-style-light .php-btn-customize:hover {
    background: #f5f5f5;
}

/* ==========================================================================
   Banner Content
   ========================================================================== */

.php-consent-content {
    flex: 1;
    min-width: 280px;
    max-width: 600px;
}

.php-consent-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.php-consent-text {
    margin: 0;
    font-size: 14px;
}

.php-privacy-link {
    color: var(--php-link-color);
    text-decoration: none;
    margin-left: 4px;
}

.php-privacy-link:hover {
    text-decoration: underline;
}

/* ==========================================================================
   Consent Buttons
   ========================================================================== */

.php-consent-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.php-consent-btn {
    display: inline-block;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    border: none;
    border-radius: 6px;
    transition: opacity 0.2s, background-color 0.2s, transform 0.1s;
}

.php-consent-btn:focus {
    outline: 2px solid var(--php-link-color);
    outline-offset: 2px;
}

.php-consent-btn:active {
    transform: scale(0.98);
}

.php-btn-accept-all {
    background: var(--php-primary-color);
    color: #fff;
}

.php-btn-accept-all:hover {
    filter: brightness(1.1);
}

.php-btn-customize {
    background: transparent;
    color: var(--php-link-color);
    border: 1px solid currentColor;
}

.php-btn-customize:hover {
    background: rgba(74, 158, 255, 0.1);
}

.php-btn-save {
    background: var(--php-primary-color);
    color: #fff;
    width: 100%;
}

.php-btn-save:hover {
    filter: brightness(1.1);
}

/* ==========================================================================
   Preferences Modal
   ========================================================================== */

.php-consent-preferences {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.6);
}

.php-preferences-inner {
    background: #fff;
    color: #333;
    max-width: 480px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.php-preferences-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e0e0e0;
}

.php-preferences-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #1e1e1e;
}

.php-preferences-body {
    padding: 0;
}

/* ==========================================================================
   Consent Categories
   ========================================================================== */

.php-consent-category {
    padding: 16px 24px;
    border-bottom: 1px solid #f0f0f0;
}

.php-consent-category:last-child {
    border-bottom: none;
}

.php-category-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.php-category-info {
    flex: 1;
}

.php-category-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #1e1e1e;
    margin-bottom: 4px;
}

.php-category-icon {
    color: #1976d2;
    flex-shrink: 0;
}

.php-required-badge {
    font-size: 11px;
    font-weight: 500;
    padding: 2px 6px;
    background: #e3f2fd;
    color: #1976d2;
    border-radius: 3px;
}

.php-category-desc {
    margin: 0;
    font-size: 13px;
    color: #666;
}

/* ==========================================================================
   Toggle Switch
   ========================================================================== */

.php-toggle {
    position: relative;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.php-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.php-toggle-track {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #ccc;
    border-radius: 12px;
    transition: background 0.2s;
}

.php-toggle-track::before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.php-toggle input:checked+.php-toggle-track {
    background: var(--php-primary-color, #2e7d32);
}

.php-toggle input:checked+.php-toggle-track::before {
    transform: translateX(20px);
}

.php-toggle input:disabled+.php-toggle-track {
    background: var(--php-primary-color, #2e7d32);
    opacity: 0.7;
    cursor: not-allowed;
}

.php-toggle input:disabled+.php-toggle-track::before {
    transform: translateX(20px);
}

/* ==========================================================================
   Preferences Footer
   ========================================================================== */

.php-preferences-footer {
    padding: 16px 24px;
    background: #f9f9f9;
    border-top: 1px solid #e0e0e0;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media screen and (max-width: 768px) {
    .php-consent-banner {
        padding: 10px;
    }

    .php-position-bottom-left,
    .php-position-bottom-right {
        left: 10px;
        right: 10px;
        bottom: 10px;
        max-width: none;
    }

    .php-consent-inner {
        flex-direction: column;
        text-align: center;
        padding: 16px 20px;
        gap: 16px;
    }

    .php-consent-content {
        max-width: 100%;
    }

    .php-consent-actions {
        width: 100%;
        flex-direction: column;
    }

    .php-consent-btn {
        width: 100%;
    }

    .php-preferences-inner {
        max-height: 90vh;
    }
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {

    .php-consent-btn,
    .php-toggle-track,
    .php-toggle-track::before {
        transition: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .php-consent-inner {
        border: 2px solid currentColor;
    }

    .php-consent-btn {
        border: 2px solid currentColor;
    }
}