/**
 * ASB Cookie Consent - Frontend Styles
 * Version: 2.0.0
 */

/* ============================================
   VARIABLES & RESET
   ============================================ */
:root {
    --asb-primary: #f97316;
    --asb-bg: #ffffff;
    --asb-text: #1f2937;
    --asb-border: #e5e7eb;
    --asb-shadow: rgba(0, 0, 0, 0.1);
    --asb-overlay: rgba(0, 0, 0, 0.5);
}

.asb-cookie-wrapper * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ============================================
   BACKDROP (Prior Consent)
   ============================================ */
.asb-cookie-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--asb-overlay);
    z-index: 999998;
    animation: asbFadeIn 0.3s ease-out;
}

/* ============================================
   MAIN BANNER
   ============================================ */
.asb-cookie-banner {
    position: fixed;
    left: 0;
    right: 0;
    z-index: 999999;
    background: var(--asb-bg);
    box-shadow: 0 -2px 20px var(--asb-shadow);
    padding: 24px;
    animation: asbSlideUp 0.4s ease-out;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.asb-cookie-banner-bottom {
    bottom: 0;
    border-top: 1px solid var(--asb-border);
}

.asb-cookie-banner-top {
    top: 0;
    bottom: auto;
    border-bottom: 1px solid var(--asb-border);
    animation: asbSlideDown 0.4s ease-out;
}

.asb-cookie-banner-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}

.asb-cookie-logo {
    flex-shrink: 0;
}

.asb-cookie-logo img {
    height: 40px;
    width: auto;
}

.asb-cookie-content {
    flex: 1;
    min-width: 300px;
}

.asb-cookie-heading {
    font-size: 20px;
    font-weight: 700;
    color: var(--asb-text);
    margin-bottom: 8px;
}

.asb-cookie-description {
    font-size: 14px;
    line-height: 1.6;
    color: #6b7280;
    margin: 0;
}

.asb-cookie-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.asb-cookie-powered {
    width: 100%;
    text-align: center;
    margin-top: 12px;
    color: #9ca3af;
    font-size: 12px;
}

/* Banner Layout: Box */
.asb-cookie-layout-box {
    max-width: 500px;
    left: 24px;
    right: auto;
    bottom: 24px;
    border-radius: 12px;
    box-shadow: 0 4px 24px var(--asb-shadow);
}

.asb-cookie-layout-box .asb-cookie-banner-inner {
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
}

.asb-cookie-layout-box .asb-cookie-actions {
    width: 100%;
}

/* ============================================
   BUTTONS
   ============================================ */
.asb-cookie-btn {
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    font-family: inherit;
}

.asb-cookie-btn-accept {
    background: var(--asb-primary);
    color: white;
}

.asb-cookie-btn-accept:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.asb-cookie-btn-settings {
    background: transparent;
    color: var(--asb-text);
    border: 2px solid var(--asb-border);
}

.asb-cookie-btn-settings:hover {
    background: #f9fafb;
    border-color: var(--asb-primary);
}

.asb-cookie-btn-reject {
    background: transparent;
    color: #6b7280;
    border: 1px solid var(--asb-border);
}

.asb-cookie-btn-reject:hover {
    background: #f9fafb;
}

.asb-cookie-btn-save {
    background: var(--asb-primary);
    color: white;
    flex: 1;
}

/* ============================================
   MODAL
   ============================================ */
.asb-cookie-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: asbFadeIn 0.3s ease-out;
}

.asb-cookie-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--asb-overlay);
}

.asb-cookie-modal-content {
    position: relative;
    background: white;
    border-radius: 16px;
    max-width: 700px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: asbScaleIn 0.3s ease-out;
}

.asb-cookie-modal-header {
    padding: 24px;
    border-bottom: 1px solid var(--asb-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.asb-cookie-modal-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--asb-text);
    margin: 0;
}

.asb-cookie-modal-close {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: #9ca3af;
    transition: color 0.2s;
}

.asb-cookie-modal-close:hover {
    color: var(--asb-text);
}

.asb-cookie-modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.asb-cookie-modal-intro {
    font-size: 14px;
    line-height: 1.6;
    color: #6b7280;
    margin-bottom: 24px;
}

.asb-cookie-modal-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--asb-border);
    display: flex;
    gap: 12px;
    background: #f9fafb;
    border-radius: 0 0 16px 16px;
}

/* ============================================
   COOKIE CATEGORIES
   ============================================ */
.asb-cookie-categories {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.asb-cookie-category {
    border: 1px solid var(--asb-border);
    border-radius: 12px;
    padding: 20px;
    transition: border-color 0.2s;
}

.asb-cookie-category:hover {
    border-color: var(--asb-primary);
}

.asb-cookie-category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.asb-cookie-category-info h4 {
    font-size: 16px;
    font-weight: 600;
    color: var(--asb-text);
    margin: 0 0 4px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.asb-cookie-category-badge {
    display: inline-block;
    background: #10b981;
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.asb-cookie-category-description {
    font-size: 14px;
    line-height: 1.6;
    color: #6b7280;
}

.asb-cookie-category-description p {
    margin: 0 0 12px 0;
}

/* ============================================
   TOGGLE SWITCH
   ============================================ */
.asb-cookie-category-toggle {
    position: relative;
    width: 52px;
    height: 28px;
    background: #d1d5db;
    border-radius: 14px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.asb-cookie-category-toggle.disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.asb-cookie-category-toggle.active {
    background: var(--asb-primary);
}

.asb-cookie-toggle-slider {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 24px;
    height: 24px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.asb-cookie-category-toggle.active .asb-cookie-toggle-slider {
    transform: translateX(24px);
}

/* ============================================
   COOKIE DETAILS
   ============================================ */
.asb-cookie-details {
    margin-top: 12px;
}

.asb-cookie-details summary {
    cursor: pointer;
    font-size: 13px;
    color: var(--asb-primary);
    font-weight: 600;
    user-select: none;
}

.asb-cookie-details summary:hover {
    text-decoration: underline;
}

.asb-cookie-list {
    margin-top: 8px;
    padding: 12px;
    background: #f9fafb;
    border-radius: 6px;
}

.asb-cookie-list code {
    font-size: 12px;
    color: #4b5563;
    word-break: break-all;
}

/* ============================================
   SHOW AGAIN TAB
   ============================================ */
.asb-cookie-tab {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    z-index: 999999;
    animation: asbSlideInSide 0.4s ease-out;
}

.asb-cookie-tab-left {
    left: 0;
}

.asb-cookie-tab-right {
    right: 0;
}

.asb-cookie-tab-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--asb-primary);
    color: white;
    border: none;
    border-radius: 0 8px 8px 0;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 2px 2px 8px var(--asb-shadow);
    transition: all 0.2s ease;
    writing-mode: vertical-rl;
    text-orientation: mixed;
}

.asb-cookie-tab-right .asb-cookie-tab-button {
    border-radius: 8px 0 0 8px;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
}

.asb-cookie-tab-button:hover {
    padding-left: 20px;
    padding-right: 20px;
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes asbSlideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes asbSlideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes asbSlideInSide {
    from {
        transform: translateY(-50%) translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(-50%) translateX(0);
        opacity: 1;
    }
}

@keyframes asbFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes asbScaleIn {
    from {
        transform: scale(0.95);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .asb-cookie-banner {
        padding: 16px;
    }
    
    .asb-cookie-banner-inner {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }
    
    .asb-cookie-content {
        min-width: auto;
    }
    
    .asb-cookie-heading {
        font-size: 18px;
    }
    
    .asb-cookie-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .asb-cookie-btn {
        width: 100%;
        justify-content: center;
    }
    
    .asb-cookie-layout-box {
        left: 12px;
        right: 12px;
        bottom: 12px;
        max-width: none;
    }
    
    .asb-cookie-modal {
        padding: 0;
    }
    
    .asb-cookie-modal-content {
        border-radius: 0;
        max-height: 100vh;
        height: 100vh;
    }
    
    .asb-cookie-modal-footer {
        flex-direction: column;
        border-radius: 0;
    }
    
    .asb-cookie-modal-footer .asb-cookie-btn {
        width: 100%;
    }
    
    .asb-cookie-tab-button {
        font-size: 12px;
        padding: 10px 12px;
    }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */
.asb-cookie-btn:focus,
.asb-cookie-category-toggle:focus,
.asb-cookie-modal-close:focus,
.asb-cookie-tab-button:focus {
    outline: 2px solid var(--asb-primary);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .asb-cookie-banner,
    .asb-cookie-modal-content {
        border: 2px solid currentColor;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .asb-cookie-banner,
    .asb-cookie-modal,
    .asb-cookie-backdrop,
    .asb-cookie-tab {
        animation: none;
    }
    
    .asb-cookie-btn,
    .asb-cookie-category-toggle,
    .asb-cookie-toggle-slider {
        transition: none;
    }
}