/* ============================================
   COOKIE CONSENT BANNER STYLES
   ============================================
   GDPR-compliant cookie consent UI
   Matches the design system of TruckingLoveIt
*/

/* ============================================
   BANNER (Bottom bar)
   ============================================ */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    padding: 0;
    transform: translateY(100%);
    transition: transform 0.3s ease-out;
}

.cookie-banner.visible {
    transform: translateY(0);
}

.cookie-banner-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 24px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 20px;
}

.cookie-banner-text {
    flex: 1;
    min-width: 280px;
}

.cookie-banner-text h3 {
    margin: 0 0 8px 0;
    font-size: 1.1rem;
    color: var(--color-text-primary, #2c3e50);
}

.cookie-banner-text p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--color-text-secondary, #555);
    line-height: 1.5;
}

.cookie-banner-text a {
    color: var(--color-primary, #3498db);
    text-decoration: underline;
}

.cookie-banner-text a:hover {
    color: var(--color-primary-dark, #2980b9);
}

.cookie-banner-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ============================================
   BUTTONS
   ============================================ */
.cookie-btn {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    min-height: 44px; /* Touch target */
}

.cookie-btn-accept {
    background: var(--color-primary, #3498db);
    color: white;
}

.cookie-btn-accept:hover {
    background: var(--color-primary-dark, #2980b9);
    transform: translateY(-1px);
}

.cookie-btn-reject {
    background: var(--color-background, #f8f9fa);
    color: var(--color-text-primary, #2c3e50);
    border: 1px solid var(--color-border, #e0e0e0);
}

.cookie-btn-reject:hover {
    background: #e9ecef;
}

.cookie-btn-settings {
    background: transparent;
    color: var(--color-primary, #3498db);
    border: 1px solid var(--color-primary, #3498db);
}

.cookie-btn-settings:hover {
    background: rgba(52, 152, 219, 0.1);
}

.cookie-btn-secondary {
    background: var(--color-background, #f8f9fa);
    color: var(--color-text-secondary, #555);
    border: 1px solid var(--color-border, #e0e0e0);
}

.cookie-btn-secondary:hover {
    background: #e9ecef;
}

/* ============================================
   SETTINGS MODAL
   ============================================ */
.cookie-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.cookie-modal-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.cookie-modal {
    background: white;
    border-radius: 12px;
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.cookie-modal-overlay.visible .cookie-modal {
    transform: scale(1);
}

.cookie-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--color-border, #e0e0e0);
}

.cookie-modal-header h2 {
    margin: 0;
    font-size: 1.3rem;
    color: var(--color-text-primary, #2c3e50);
}

.cookie-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--color-text-muted, #7f8c8d);
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    border-radius: 4px;
    transition: background 0.2s;
}

.cookie-modal-close:hover {
    background: var(--color-background, #f8f9fa);
    color: var(--color-text-primary, #2c3e50);
}

.cookie-modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.cookie-modal-intro {
    margin: 0 0 20px 0;
    color: var(--color-text-secondary, #555);
    font-size: 0.95rem;
    line-height: 1.5;
}

.cookie-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--color-border, #e0e0e0);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ============================================
   CATEGORY ITEMS
   ============================================ */
.cookie-category {
    background: var(--color-background, #f8f9fa);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
}

.cookie-category:last-child {
    margin-bottom: 0;
}

.cookie-category-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cookie-category-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.cookie-category-info strong {
    color: var(--color-text-primary, #2c3e50);
    font-size: 1rem;
}

.cookie-required-badge {
    background: var(--color-success, #27ae60);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.cookie-category-desc {
    margin: 8px 0 0 0;
    color: var(--color-text-secondary, #555);
    font-size: 0.9rem;
    line-height: 1.5;
    padding-left: 52px; /* Align with text after toggle */
}

/* ============================================
   TOGGLE SWITCH
   ============================================ */
.cookie-toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.cookie-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.cookie-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 24px;
}

.cookie-toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.cookie-toggle input:checked + .cookie-toggle-slider {
    background-color: var(--color-primary, #3498db);
}

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

.cookie-toggle input:disabled + .cookie-toggle-slider {
    background-color: var(--color-success, #27ae60);
    cursor: not-allowed;
}

.cookie-toggle input:disabled + .cookie-toggle-slider:before {
    transform: translateX(20px);
}

/* ============================================
   COOKIE DETAILS
   ============================================ */
.cookie-details {
    margin-top: 10px;
    padding-left: 52px;
}

.cookie-details summary {
    cursor: pointer;
    color: var(--color-primary, #3498db);
    font-size: 0.85rem;
    padding: 4px 0;
}

.cookie-details summary:hover {
    text-decoration: underline;
}

.cookie-list {
    margin: 8px 0 0 0;
    padding-left: 20px;
    list-style: disc;
}

.cookie-list li {
    font-size: 0.85rem;
    color: var(--color-text-muted, #7f8c8d);
    margin-bottom: 4px;
}

.cookie-list code {
    background: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.85rem;
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */
@media (max-width: 767px) {
    .cookie-banner-content {
        flex-direction: column;
        align-items: stretch;
        padding: 16px;
    }

    .cookie-banner-text {
        text-align: center;
    }

    .cookie-banner-actions {
        flex-direction: column;
    }

    .cookie-btn {
        width: 100%;
        justify-content: center;
    }

    .cookie-modal {
        max-height: 90vh;
        margin: 10px;
    }

    .cookie-category-desc {
        padding-left: 0;
        margin-top: 12px;
    }

    .cookie-details {
        padding-left: 0;
    }

    .cookie-modal-footer {
        flex-direction: column;
    }

    .cookie-modal-footer .cookie-btn {
        width: 100%;
    }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */
.cookie-btn:focus-visible,
.cookie-toggle input:focus-visible + .cookie-toggle-slider,
.cookie-modal-close:focus-visible {
    outline: 2px solid var(--color-primary, #3498db);
    outline-offset: 2px;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    .cookie-banner,
    .cookie-modal-overlay,
    .cookie-modal,
    .cookie-toggle-slider,
    .cookie-toggle-slider:before {
        transition: none;
    }
}
