/* Cookie Consent Manager - Frontend Styles */

/* Skip link för skärmläsare */
.ccm-skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #000;
    color: #fff;
    padding: 8px;
    text-decoration: none;
    z-index: 1000000;
}

.ccm-skip-link:focus {
    top: 0;
}

.ccm-banner {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.ccm-banner.ccm-hidden {
    display: none;
}

/* Floating Settings Button */
.ccm-floating-button {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 50px;
    height: 50px;
    background-color: #000000;
    color: #ffffff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999998;
    transition: all 0.3s ease;
}

.ccm-floating-button:hover {
    background-color: #333333;
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.ccm-floating-button:focus {
    outline: 3px solid #4A90E2;
    outline-offset: 2px;
}

.ccm-floating-button svg {
    width: 24px;
    height: 24px;
}

/* Focus styles för alla interaktiva element */
.ccm-button:focus,
.ccm-close:focus,
.ccm-back:focus,
.ccm-category-header:focus,
.ccm-toggle:focus {
    outline: 3px solid #4A90E2;
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.3);
}

/* Hög kontrastläge stöd */
@media (prefers-contrast: high) {
    .ccm-button:focus,
    .ccm-close:focus,
    .ccm-back:focus {
        outline: 3px solid #000;
        outline-offset: 2px;
    }
}

/* Screen reader only text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

.sr-only:focus {
    position: static;
    width: auto;
    height: auto;
    padding: inherit;
    margin: inherit;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* Reducerad rörelse för användare som föredrar det */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

.ccm-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
}

.ccm-modal {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #ffffff;
    border-radius: 8px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.ccm-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    font-size: 30px;
    cursor: pointer;
    color: #000000;
    line-height: 1;
    padding: 7px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    border-radius: 4px;
}

.ccm-close:hover {
    background-color: #f0f0f0;
}

.ccm-close:focus {
    outline: 3px solid #4A90E2;
    outline-offset: 2px;
}

.ccm-content {
    padding: 40px 30px 30px;
}

.ccm-content.ccm-hidden {
    display: none;
}

.ccm-back {
    background: transparent;
    border: none;
    padding: 10px 12px;
    margin-bottom: 20px;
    cursor: pointer;
    font-size: 14px;
    color: #000000;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-width: 44px;
    min-height: 44px;
    transition: all 0.2s;
    border-radius: 4px;
}

.ccm-back:hover {
    background-color: #f0f0f0;
}

.ccm-back:focus {
    outline: 3px solid #4A90E2;
    outline-offset: 2px;
}

.ccm-title {
    font-size: 24px;
    font-weight: 600;
    margin: 0 0 15px 0;
    color: #000000;
}

.ccm-message {
    font-size: 15px;
    line-height: 1.6;
    color: #333333;
    margin: 0 0 25px 0;
}

.ccm-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.ccm-button {
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.ccm-button:focus {
    outline: 3px solid #4A90E2;
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.3);
}

.ccm-button-accept {
    background-color: #000000;
    color: #ffffff;
}

.ccm-button-accept:hover {
    background-color: #333333;
}

.ccm-button-reject {
    background-color: transparent;
    color: #000000;
    border: 2px solid #000000;
}

.ccm-button-reject:hover {
    background-color: #f5f5f5;
}

.ccm-button-settings {
    background-color: #f5f5f5;
    color: #000000;
    border: 2px solid #e0e0e0;
}

.ccm-button-settings:hover {
    background-color: #e0e0e0;
}

.ccm-button-save {
    background-color: #000000;
    color: #ffffff;
}

.ccm-button-save:hover {
    background-color: #333333;
}

/* Categories */
.ccm-categories {
    margin: 0 0 25px 0;
}

.ccm-category {
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    margin-bottom: 15px;
    overflow: hidden;
}

.ccm-category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background-color: #f9f9f9;
    cursor: pointer;
    transition: background-color 0.2s;
    min-height: 44px;
}

.ccm-category-header:hover {
    background-color: #f0f0f0;
}

.ccm-category-header:focus {
    outline: 3px solid #4A90E2;
    outline-offset: -3px;
    background-color: #f0f0f0;
}

.ccm-category-header.active {
    background-color: #e8e8e8;
}

.ccm-category-title {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.ccm-category-title h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #000000;
}

.ccm-category-always-active {
    font-size: 13px;
    color: #155724;
    font-weight: 500;
}

.ccm-category-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ccm-toggle {
    position: relative;
    width: 50px;
    height: 26px;
    background-color: #e0e0e0;
    border-radius: 13px;
    cursor: pointer;
    transition: background-color 0.3s;
    border: 2px solid transparent;
}

.ccm-toggle:focus {
    outline: 3px solid #4A90E2;
    outline-offset: 2px;
}

.ccm-toggle.active {
    background-color: #000000;
}

.ccm-toggle.disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.ccm-toggle::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background-color: #ffffff;
    border-radius: 50%;
    transition: transform 0.3s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.ccm-toggle.active::after {
    transform: translateX(24px);
}

/* Visuell indikation för ON/OFF */
.ccm-toggle::before {
    content: attr(aria-label);
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    font-weight: bold;
    color: #666;
}

.ccm-toggle:not(.active)::before {
    content: 'AV';
    right: 6px;
}

.ccm-toggle.active::before {
    content: 'PÅ';
    left: 6px;
    color: #fff;
}

.ccm-expand-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.ccm-expand-btn:focus {
    outline: 3px solid #4A90E2;
    outline-offset: 2px;
}

.ccm-chevron {
    font-size: 12px;
    color: #333333;
    transition: transform 0.3s;
}

.ccm-expand-btn.active .ccm-chevron {
    transform: rotate(180deg);
}

.ccm-category-content {
    padding: 0 20px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s, padding 0.3s;
}

.ccm-category-content.active {
    padding: 15px 20px;
    max-height: 1000px;
}

.ccm-category-description {
    font-size: 14px;
    line-height: 1.6;
    color: #666666;
    margin: 0 0 15px 0;
}

.ccm-cookies-list {
    border-top: 1px solid #e0e0e0;
    padding-top: 15px;
}

.ccm-cookie-item {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #f0f0f0;
}

.ccm-cookie-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.ccm-cookie-name {
    font-family: monospace;
    font-size: 13px;
    font-weight: 600;
    color: #000000;
    margin-bottom: 5px;
}

.ccm-cookie-info {
    display: flex;
    gap: 15px;
    font-size: 12px;
    color: #666666;
    margin-bottom: 5px;
}

.ccm-cookie-label {
    font-weight: 600;
}

.ccm-cookie-description {
    font-size: 13px;
    line-height: 1.5;
    color: #666666;
}

/* Responsive */
@media (max-width: 600px) {
    .ccm-modal {
        width: 95%;
        max-height: 95vh;
    }
    
    .ccm-content {
        padding: 30px 20px 20px;
    }
    
    .ccm-buttons {
        flex-direction: column;
    }
    
    .ccm-button {
        width: 100%;
    }
    
    .ccm-title {
        font-size: 20px;
    }
}

/* Iframe placeholder */
.ccm-iframe-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    border: 1px solid #ddd;
    color: #555;
    font-size: 14px;
    font-family: inherit;
    text-align: center;
    box-sizing: border-box;
    padding: 16px;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.ccm-banner {
    animation: fadeIn 0.3s ease-in;
}
