/* Recreonics Cookie Consent Manager - Frontend Styles */

/* Reset and Base Styles */
.rcc-modal, .rcc-modal * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Overlay */
.rcc-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 42%);
    z-index: 999998;
    /* backdrop-filter: blur(2px); */
}

/* Mandatory overlay - blocks all interaction */
.rcc-overlay.rcc-mandatory {
    pointer-events: auto;
    cursor: not-allowed;
}

/* Common Modal Styles */
.rcc-modal {
    position: fixed;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
}

/* Mandatory modal - cannot be closed */
.rcc-modal.rcc-mandatory {
    pointer-events: auto;
}

/* When modal is open, allow background scrolling but block interaction with background elements */
body.rcc-modal-open > *:not(.rcc-overlay):not(.rcc-modal) {
    pointer-events: none !important;
}

body.rcc-modal-open .rcc-modal,
body.rcc-modal-open .rcc-modal *,
body.rcc-modal-open .rcc-overlay {
    pointer-events: auto !important;
}

.rcc-modal-content {
    background: #ffffff;
    border-radius: 0;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

/* Intro Modal */
.rcc-intro-modal {
    bottom: 20px;
    right: 20px;
    width: 400px;
    max-width: calc(100vw - 40px);
}

.rcc-intro-modal .rcc-modal-content {
    border-radius: 0;
}

.rcc-intro-modal .rcc-modal-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: #333;
    margin: 0;
    padding: 20px 24px 0;
}

.rcc-intro-modal .rcc-modal-body {
    padding: 16px 24px;
}

.rcc-intro-modal .rcc-modal-body p {
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
    color: #666;
}

.rcc-intro-modal .rcc-privacy-link {
    color: #0a7093;
    text-decoration: underline;
}

.rcc-intro-modal .rcc-privacy-link:hover {
    color: #005a87;
}

.rcc-external-icon::after {
    content: "↗";
    font-size: 12px;
    margin-left: 2px;
}

.rcc-intro-modal .rcc-modal-footer {
    padding: 0 24px 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Preference Modal */
.rcc-preference-modal {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 800px;
    max-width: calc(100vw - 40px);
    max-height: calc(100vh - 40px);
}

.rcc-preference-modal .rcc-modal-content {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 40px);
}

.rcc-preference-modal .rcc-modal-header {
    padding: 24px 24px 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid #e1e5e9;
    margin-bottom: 20px;
}

.rcc-preference-modal .rcc-modal-header h2 {
    font-size: 22px;
    font-weight: 600;
    color: #333;
    margin: 0 0 20px 0;
}

.rcc-close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.rcc-close-btn:hover {
    background: #f5f5f5;
    color: #333;
}

.rcc-preference-modal .rcc-modal-body {
    padding: 0 24px 24px 24px;
    overflow-y: auto;
    flex: 1;
    max-height: calc(100vh - 200px);
}

.rcc-preference-modal .rcc-modal-body > p {
    margin: 0 0 24px 0;
    font-size: 14px;
    line-height: 1.6;
    color: #555;
}

.rcc-privacy-link {
    color: #0a7093;
    text-decoration: underline;
}

.rcc-privacy-link:hover {
    color: #16395b;
}

/* Categories */
.rcc-categories {
    margin-bottom: 24px;
    border: 1px solid #e1e5e9;
}

.rcc-category {
    border: none;
    border-radius: 0;
    margin-bottom: 0;
    overflow: hidden;
    box-shadow: none;
}

.rcc-category:not(:last-child) {
    border-bottom: 1px solid #e1e5e9;
}

.rcc-category-header {
    padding: 20px;
    background: #ffffff;
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease;
}

.rcc-category-header:hover {
    background: #f9f9f9;
}

.rcc-category-toggle {
    background: #f0f0f0;
    border: 1px solid #ccc;
    padding: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    transition: background-color 0.2s;
}

.rcc-category-toggle:hover {
    background: #e0e0e0;
}

.rcc-toggle-icon {
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid #666;
    transition: transform 0.2s;
    transform: rotate(0deg);
}

.rcc-category-toggle[aria-expanded="true"] .rcc-toggle-icon {
    transform: rotate(180deg);
}

.rcc-category-info {
    flex: 1;
}

.rcc-category-info h3 {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.rcc-toggle-container {
    flex-shrink: 0;
    padding: 4px;
    margin: -4px;
    border-radius: 0;
}

.rcc-toggle-container:hover {
    background: transparent;
}

/* Toggle Switch */
.rcc-toggle {
    width: 48px;
    height: 24px;
    background: #ccc;
    border-radius: 12px;
    position: relative;
    cursor: pointer;
    transition: background-color 0.3s;
}

.rcc-toggle.rcc-toggle-active {
    background: #4CAF50;
}

.rcc-toggle.rcc-toggle-disabled {
    background: #4CAF50;
    cursor: not-allowed;
    opacity: 0.7;
    margin-top: 2px;
}

.rcc-toggle-slider {
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: transform 0.3s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.rcc-toggle.rcc-toggle-active .rcc-toggle-slider {
    transform: translateX(24px);
}

/* Category Content */
.rcc-category-content {
    padding: 0 20px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out, padding 0.3s ease-out;
    background: #fff;
}

.rcc-category-content.rcc-category-expanded {
    padding: 20px;
    border-top: 1px solid #e1e5e9;
    max-height: 1000px;
    overflow: visible;
    word-wrap: break-word;
    background: #fff;
}

.rcc-category-content p {
    margin: 0 0 16px 0;
    font-size: 14px;
    line-height: 1.6;
    color: #666;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

.rcc-cookie-list {
    margin-top: 16px;
}

.rcc-cookie-item {
    background: #f8f9fa;
    border-radius: 4px;
    padding: 12px 16px;
    margin-bottom: 8px;
}

.rcc-cookie-item strong {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.rcc-cookie-item p {
    margin: 0;
    font-size: 13px;
    color: #666;
}

/* Modal Footer */
.rcc-preference-modal .rcc-modal-footer {
    padding: 24px;
    border-top: 1px solid #e1e5e9;
    display: flex;
    justify-content: flex-end;
    gap: 16px;
    flex-shrink: 0;
}

/* Button ordering for desktop - Accept button should be on the right */
.rcc-preference-modal .rcc-modal-footer #rcc-accept-selected {
    order: 2;
}

.rcc-preference-modal .rcc-modal-footer #rcc-accept-necessary {
    order: 1;
}

/* Buttons */
.rcc-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 0;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    min-width: 120px;
}

.rcc-btn-primary {
    background: #0a7093;
    color: white;
    border: 1px solid #0a7093;
}

.rcc-btn-primary:hover {
    background: #16395b;
    border-color: #16395b;
}

.rcc-btn-secondary {
    background: transparent;
    color: #0a7093;
    border: none;
    text-decoration: underline;
    padding: 12px 0;
    min-width: auto;
}

.rcc-btn-secondary:hover {
    background: transparent;
    color: #16395b;
    text-decoration: underline;
}

.rcc-intro-modal .rcc-btn {
    width: 100%;
}

/* Preferences Link */
#rcc-preferences-link {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 999997;
}

.rcc-preferences-trigger {
    background: #0a7093 !important;
    color: white !important;
    padding: 12px 6px !important;
    border-radius: 6px !important;
    text-decoration: none !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2) !important;
    border: none !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    display: inline-block !important;
    white-space: nowrap !important;
}

.rcc-preferences-trigger:hover {
    background: #16395b !important;
    color: white !important;
    text-decoration: none !important;
    box-shadow: -3px 3px 12px rgba(0,0,0,0.3) !important;
}

.rcc-preferences-trigger:focus,
.rcc-preferences-trigger:active {
    outline: none !important;
    color: white !important;
    text-decoration: none !important;
}

/* Responsive Design */
@media (max-width: 850px) {
    .rcc-preference-modal {
        width: 95%;
        max-width: calc(100vw - 20px);
    }
}

@media (max-width: 768px) {
    .rcc-intro-modal {
        bottom: 20px;
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        width: calc(100vw - 40px);
        max-width: 400px;
        border-radius: 8px;
    }
    
    .rcc-intro-modal .rcc-modal-content {
        border-radius: 8px;
    }
    
    .rcc-preference-modal {
        bottom: 20px;
        left: 20px;
        right: 20px;
        top: auto;
        transform: none;
        width: auto;
        height: auto;
        max-width: none;
        max-height: calc(100vh - 40px);
    }
    
    .rcc-preference-modal .rcc-modal-content {
        height: auto;
        border-radius: 8px;
        max-height: calc(100vh - 40px);
    }
    
    .rcc-preference-modal .rcc-modal-footer {
        flex-direction: column;
    }
    
    /* Reset button order for mobile - Accept should be on top */
    .rcc-preference-modal .rcc-modal-footer #rcc-accept-selected {
        order: 1;
    }
    
    .rcc-preference-modal .rcc-modal-footer #rcc-accept-necessary {
        order: 2;
    }
    
    .rcc-preference-modal .rcc-modal-footer .rcc-btn {
        width: 100%;
    }
    
    .rcc-category-header {
        padding: 12px 16px;
    }
    
    .rcc-category-content.rcc-category-expanded {
        padding: 16px;
    }
}

@media (max-width: 480px) {
    .rcc-intro-modal {
        bottom: 10px;
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        width: calc(100vw - 20px);
        max-width: 350px;
    }
    
    .rcc-preference-modal {
        bottom: 10px;
        left: 10px;
        right: 10px;
        top: auto;
    }
    
    .rcc-preference-modal .rcc-modal-content {
        max-height: calc(100vh - 20px);
    }
    
    .rcc-intro-modal .rcc-modal-header h2 {
        font-size: 18px;
        padding: 16px 20px 0;
    }
    
    .rcc-intro-modal .rcc-modal-body {
        padding: 12px 20px;
    }
    
    .rcc-intro-modal .rcc-modal-footer {
        padding: 0 20px 20px;
    }
    
    .rcc-preference-modal .rcc-modal-header {
        padding: 20px 20px 0;
    }
    
    .rcc-preference-modal .rcc-modal-body {
        padding: 0 20px;
    }
    
    .rcc-preference-modal .rcc-modal-footer {
        padding: 20px;
    }
}

/* Accessibility */
.rcc-modal:focus {
    outline: none;
}

.rcc-btn:focus,
.rcc-close-btn:focus,
.rcc-category-toggle:focus,
.rcc-toggle:focus {
    outline: 2px solid #0a7093;
    outline-offset: 2px;
}

/* Animation */
.rcc-modal.rcc-show {
    animation: rccFadeIn 0.3s ease-out;
}

.rcc-modal.rcc-hide {
    animation: rccFadeOut 0.3s ease-out;
}

@keyframes rccFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes rccFadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(20px);
    }
}

.rcc-preference-modal.rcc-show {
    animation: rccScaleIn 0.3s ease-out;
}

.rcc-preference-modal.rcc-hide {
    animation: rccScaleOut 0.3s ease-out;
}

@keyframes rccScaleIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes rccScaleOut {
    from {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    to {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }
}
