/**
 * XPRT Privacy Engine - Compliance Styles
 * 
 * Consent banner, modal, and admin dashboard styles
 */

/* ============================================
   CONSENT BANNER
   ============================================ */

.kpe-consent-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    z-index: 999999;
    padding: 20px;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.kpe-consent-banner-visible {
    transform: translateY(0);
}

.kpe-consent-banner-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 20px;
}

.kpe-consent-banner-text {
    flex: 1;
    min-width: 300px;
}

.kpe-consent-banner-text p {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
}

.kpe-consent-banner-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ============================================
   BUTTONS
   ============================================ */

.kpe-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.kpe-btn-primary {
    background: #0d6efd;
    color: #fff;
}

.kpe-btn-primary:hover {
    background: #0b5ed7;
}

.kpe-btn-secondary {
    background: #6c757d;
    color: #fff;
}

.kpe-btn-secondary:hover {
    background: #5c636a;
}

.kpe-btn-outline {
    background: transparent;
    color: #6c757d;
    border: 1px solid #6c757d;
}

.kpe-btn-outline:hover {
    background: #6c757d;
    color: #fff;
}

/* ============================================
   CONSENT MODAL
   ============================================ */

.kpe-consent-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.kpe-consent-modal-visible {
    opacity: 1;
    visibility: visible;
}

.kpe-consent-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
}

.kpe-consent-modal-content {
    position: relative;
    background: #fff;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.kpe-consent-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
}

.kpe-consent-modal-header h3 {
    margin: 0;
    font-size: 20px;
    color: #212529;
}

.kpe-consent-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #6c757d;
    cursor: pointer;
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.kpe-consent-modal-close:hover {
    background: #f8f9fa;
    color: #212529;
}

.kpe-consent-modal-body {
    padding: 20px;
}

.kpe-consent-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 20px;
    border-top: 1px solid #e9ecef;
}

/* ============================================
   CONSENT CATEGORIES
   ============================================ */

.kpe-consent-category {
    padding: 16px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin-bottom: 12px;
}

.kpe-consent-category:last-child {
    margin-bottom: 0;
}

.kpe-consent-category-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.kpe-consent-category-header h4 {
    margin: 0;
    font-size: 16px;
    color: #212529;
    flex: 1;
}

.kpe-consent-category p {
    margin: 0;
    font-size: 14px;
    color: #6c757d;
    line-height: 1.5;
}

/* ============================================
   TOGGLE SWITCH
   ============================================ */

.kpe-consent-toggle {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
}

.kpe-consent-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.kpe-consent-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 24px;
}

.kpe-consent-toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.kpe-consent-toggle input:checked + .kpe-consent-toggle-slider {
    background-color: #0d6efd;
}

.kpe-consent-toggle input:checked + .kpe-consent-toggle-slider:before {
    transform: translateX(24px);
}

.kpe-consent-toggle input:disabled + .kpe-consent-toggle-slider {
    background-color: #0d6efd;
    opacity: 0.6;
    cursor: not-allowed;
}

/* ============================================
   BADGES
   ============================================ */

.kpe-consent-badge {
    display: inline-block;
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 4px;
}

.kpe-consent-badge-required {
    background: #dc3545;
    color: #fff;
}

/* ============================================
   ADMIN DASHBOARD STYLES
   ============================================ */

.kpe-admin {
    padding: 20px;
}

.kpe-admin-header {
    margin-bottom: 30px;
}

.kpe-admin-header h1 {
    margin: 0 0 10px 0;
    font-size: 28px;
    color: #212529;
}

.kpe-admin-header p {
    margin: 0;
    color: #6c757d;
}

/* Score Cards */
.kpe-score-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.kpe-score-card {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #e9ecef;
}

.kpe-score-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.kpe-score-card-title {
    font-size: 14px;
    font-weight: 500;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kpe-score-card-value {
    font-size: 36px;
    font-weight: 700;
    color: #212529;
}

.kpe-score-card-badge {
    display: inline-block;
    padding: 6px 12px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 20px;
}

.kpe-badge-success {
    background: #d1e7dd;
    color: #0f5132;
}

.kpe-badge-warning {
    background: #fff3cd;
    color: #664d03;
}

.kpe-badge-orange {
    background: #ffe5d0;
    color: #984c0c;
}

.kpe-badge-danger {
    background: #f8d7da;
    color: #842029;
}

/* Charts Section */
.kpe-charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.kpe-chart-card {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #e9ecef;
}

.kpe-chart-card h3 {
    margin: 0 0 20px 0;
    font-size: 18px;
    color: #212529;
}

/* Tables */
.kpe-table-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #e9ecef;
    overflow: hidden;
}

.kpe-table-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #e9ecef;
}

.kpe-table-card-header h3 {
    margin: 0;
    font-size: 18px;
    color: #212529;
}

.kpe-table {
    width: 100%;
    border-collapse: collapse;
}

.kpe-table th,
.kpe-table td {
    padding: 12px 24px;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
}

.kpe-table th {
    background: #f8f9fa;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6c757d;
}

.kpe-table tbody tr:hover {
    background: #f8f9fa;
}

.kpe-table tbody tr:last-child td {
    border-bottom: none;
}

/* Risk Level Indicators */
.kpe-risk-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.kpe-risk-indicator::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.kpe-risk-low {
    background: #d1e7dd;
    color: #0f5132;
}

.kpe-risk-low::before {
    background: #198754;
}

.kpe-risk-medium {
    background: #fff3cd;
    color: #664d03;
}

.kpe-risk-medium::before {
    background: #ffc107;
}

.kpe-risk-high {
    background: #ffe5d0;
    color: #984c0c;
}

.kpe-risk-high::before {
    background: #fd7e14;
}

.kpe-risk-critical {
    background: #f8d7da;
    color: #842029;
}

.kpe-risk-critical::before {
    background: #dc3545;
}

/* Pagination */
.kpe-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 20px;
}

.kpe-pagination-btn {
    padding: 8px 16px;
    border: 1px solid #dee2e6;
    background: #fff;
    color: #0d6efd;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.kpe-pagination-btn:hover:not(:disabled) {
    background: #0d6efd;
    color: #fff;
}

.kpe-pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.kpe-pagination-current {
    padding: 8px 16px;
    color: #6c757d;
}

/* Responsive */
@media (max-width: 768px) {
    .kpe-consent-banner-content {
        flex-direction: column;
        text-align: center;
    }
    
    .kpe-consent-banner-actions {
        width: 100%;
        justify-content: center;
    }
    
    .kpe-charts-grid {
        grid-template-columns: 1fr;
    }
    
    .kpe-score-grid {
        grid-template-columns: 1fr;
    }
    
    .kpe-table {
        font-size: 14px;
    }
    
    .kpe-table th,
    .kpe-table td {
        padding: 10px 12px;
    }
}

/* Print styles */
@media print {
    .kpe-consent-banner,
    .kpe-consent-modal {
        display: none !important;
    }
}

/* ============================================
   BANNER POSITION VARIANTS
   ============================================ */

/* Default is bottom (already set on .kpe-consent-banner) */
.kpe-banner-top {
    top: 0;
    bottom: auto;
    transform: translateY(-100%);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.kpe-banner-top.kpe-consent-banner-visible {
    transform: translateY(0);
}

/* ============================================
   DARK THEME
   ============================================ */

.kpe-theme-dark.kpe-consent-banner {
    background: #1e1e2e;
    color: #e0e0e0;
}

.kpe-theme-dark .kpe-consent-banner-text p {
    color: #cdd6f4;
}

.kpe-theme-dark .kpe-btn-outline {
    color: #cdd6f4;
    border-color: #cdd6f4;
}

.kpe-theme-dark .kpe-btn-outline:hover {
    background: #cdd6f4;
    color: #1e1e2e;
}

/* ============================================
   BRAND COLOR OVERRIDE (via CSS custom property)
   ============================================ */

.kpe-consent-banner,
.kpe-consent-widget {
    --kpe-brand: #0d6efd;
}

.kpe-btn-primary {
    background: var(--kpe-brand, #0d6efd);
}

.kpe-btn-primary:hover {
    background: color-mix(in srgb, var(--kpe-brand, #0d6efd) 85%, black);
}

/* ============================================
   FLOATING COOKIE SETTINGS WIDGET
   ============================================ */

.kpe-consent-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 99998;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--kpe-brand, #0d6efd);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    padding: 0;
}

.kpe-consent-widget:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

.kpe-consent-widget:focus-visible {
    outline: 3px solid rgba(13, 110, 253, 0.5);
    outline-offset: 2px;
}

.kpe-consent-widget.kpe-theme-dark {
    background: #313244;
    color: #cdd6f4;
}

@media print {
    .kpe-consent-widget { display: none !important; }
}
