/**
 * Public-facing styles for TheDock Cookie
 */

:root {
    /* Primary colors - can be customized from admin */
    --thedock-primary-color: #1e73be;
    --thedock-primary-hover: #135e96;

    /* Text colors */
    --thedock-text-color: #333;
    --thedock-text-light: #666;
    --thedock-text-lighter: #999;

    /* Background colors */
    --thedock-bg-color: #fff;
    --thedock-bg-secondary: #fafafa;
    --thedock-bg-tertiary: #f5f5f5;

    /* Border colors */
    --thedock-border-color: #e5e5e5;
    --thedock-border-hover: #d0d0d0;

    /* Overlay */
    --thedock-overlay-color: rgba(0, 0, 0, 0.5);

    /* Button colors */
    --thedock-btn-secondary-bg: #f5f5f5;
    --thedock-btn-secondary-hover: #e8e8e8;
    --thedock-btn-secondary-border: #e0e0e0;

    /* Shadow colors */
    --thedock-shadow-sm: rgba(0, 0, 0, 0.1);
    --thedock-shadow-md: rgba(0, 0, 0, 0.15);
    --thedock-shadow-lg: rgba(0, 0, 0, 0.2);

    /* Blocked content */
    --thedock-blocked-bg-start: #f8f9fa;
    --thedock-blocked-bg-end: #f0f2f5;
    --thedock-blocked-border: #d0d5dd;
    --thedock-blocked-border-hover: #b5bac4;
}

/* Cookie Banner */
.thedock-cookie-banner {
    position: fixed;
    left: 0;
    right: 0;
    z-index: 999999;
    background: var(--thedock-bg-color);
    box-shadow: 0 -2px 10px var(--thedock-shadow-sm);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, sans-serif;
    animation: thedockSlideIn 0.3s ease-out;
}

.thedock-cookie-banner.thedock-position-bottom {
    bottom: 0;
}

.thedock-cookie-banner.thedock-position-top {
    top: 0;
    box-shadow: 0 2px 10px var(--thedock-shadow-sm);
}

.thedock-cookie-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.thedock-cookie-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

@media (max-width: 768px) {
    .thedock-cookie-content {
        flex-direction: column;
        align-items: stretch;
    }
}

.thedock-cookie-text {
    flex: 1;
}

.thedock-cookie-heading {
    margin: 0 0 10px 0;
    font-size: 18px;
    font-weight: 600;
}

.thedock-cookie-description {
    margin: 0 0 10px 0;
    font-size: 14px;
    line-height: 1.5;
}

.thedock-cookie-links {
    display: flex;
    gap: 15px;
    font-size: 13px;
}

.thedock-cookie-actions {
    align-items: center;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .thedock-cookie-actions {
        flex-direction: column;
    }
}

/* Button shapes */
.button-full {
    padding: 12px 24px;
    border-radius: 8px;
}

/* Button colors */
.button-accent-color {
    background: var(--thedock-primary-color);
    color: #fff;
}

.button-secondary-color {
    background: var(--thedock-btn-secondary-bg);
    color: var(--thedock-text-color);
}

.button-secondary-color:hover {
    background: var(--thedock-btn-secondary-hover);
    border-color: var(--thedock-border-hover);
}

/* Box Layout */
.thedock-cookie-banner.thedock-box {
    left: auto;
    right: 20px;
    bottom: 20px;
    max-width: 400px;
    border-radius: 8px;
}

.thedock-cookie-banner.thedock-box .thedock-cookie-content {
    flex-direction: column;
    align-items: stretch;
}

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

/* Modal Layout */
.thedock-cookie-banner.thedock-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    right: auto;
    bottom: auto;
    transform: translate(-50%, -50%);
    max-width: 600px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.thedock-cookie-banner.thedock-modal::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--thedock-overlay-color);
    z-index: -1;
}

.thedock-cookie-banner.thedock-modal .thedock-cookie-content {
    flex-direction: column;
    align-items: stretch;
}

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

/* Settings Modal */
.thedock-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.thedock-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--thedock-overlay-color);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: thedockOverlayFadeIn 0.3s ease-out;
    cursor: pointer;
}

.thedock-modal-content {
    position: relative;
    background: var(--thedock-bg-color);
    border-radius: 12px;
    max-width: 1000px;
    width: 100%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px var(--thedock-shadow-md), 0 0 0 1px rgba(0, 0, 0, 0.05);
    animation: thedockModalSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: default;
}

.thedock-modal-header {
    padding: 24px 24px 20px;
    border-bottom: 1px solid var(--thedock-border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(to bottom, var(--thedock-bg-secondary) 0%, var(--thedock-bg-color) 100%);
    border-radius: 12px 12px 0 0;
}

.thedock-modal-header h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    color: var(--thedock-text-color);
    letter-spacing: -0.3px;
}

.thedock-modal-close {
    background: var(--thedock-bg-tertiary);
    border: none;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    color: var(--thedock-text-light);
    padding: 0;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    margin: 0;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.thedock-modal-close:hover {
    background: var(--thedock-btn-secondary-hover);
    color: var(--thedock-text-color);
    transform: rotate(90deg);
}

.thedock-modal-close:active {
    transform: rotate(90deg) scale(0.95);
}

.thedock-modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
    /* Custom scrollbar */
    scrollbar-width: thin;
    scrollbar-color: var(--thedock-border-hover) var(--thedock-bg-tertiary);
}

.thedock-modal-body::-webkit-scrollbar {
    width: 8px;
}

.thedock-modal-body::-webkit-scrollbar-track {
    background: var(--thedock-bg-tertiary);
    border-radius: 4px;
}

.thedock-modal-body::-webkit-scrollbar-thumb {
    background: var(--thedock-border-hover);
    border-radius: 4px;
}

.thedock-modal-body::-webkit-scrollbar-thumb:hover {
    background: var(--thedock-text-lighter);
}

.thedock-modal-body > p {
    margin: 0 0 20px 0;
    color: var(--thedock-text-light);
    font-size: 14px;
    line-height: 1.6;
}

.thedock-modal-footer {
    padding: 20px 24px 24px;
    border-top: 1px solid var(--thedock-border-color);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    background: var(--thedock-bg-secondary);
    border-radius: 0 0 12px 12px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .thedock-modal-content {
        border-radius: 12px 12px 0 0;
        max-height: 90vh;
    }

    .thedock-modal {
        align-items: flex-end;
        padding: 0;
    }

    .thedock-modal-header {
        padding: 20px;
    }

    .thedock-modal-body {
        padding: 20px;
    }

    .thedock-modal-footer {
        padding: 16px 20px 20px;
    }
}

@media (max-width: 480px) {
    .thedock-modal-footer {
        flex-direction: column;
    }

    .thedock-modal-footer .block-button {
        width: 100%;
    }

    .thedock-modal-content {
        width: 100%;
        border-radius: 16px 16px 0 0;
        animation: thedockModalSlideUpMobile 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    }

    .thedock-blocked-content {
        padding: 30px 15px;
        min-height: 150px;
    }

    .thedock-accept-category {
        padding: 12px 24px;
        font-size: 13px;
    }

    .thedock-category-header {
        flex-wrap: wrap;
    }

    .thedock-btn-details {
        width: 100%;
        margin-left: 0;
        margin-top: 10px;
        justify-content: center;
    }
}

@keyframes thedockModalSlideUpMobile {
    from {
        opacity: 0;
        transform: translateY(100%);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .block-button,
    .thedock-modal-overlay,
    .thedock-modal-content,
    .thedock-modal-close,
    .thedock-category-item,
    .thedock-blocked-content,
    .thedock-accept-category {
        animation: none !important;
        transition: none !important;
    }
}

/* Cookie Categories */
.thedock-cookie-categories {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.thedock-category-item {
    border: 1px solid var(--thedock-border-color);
    border-radius: 10px;
    padding: 18px;
    background: var(--thedock-bg-color);
    transition: all 0.2s ease;
}

.thedock-category-item:hover {
    border-color: var(--thedock-border-hover);
    box-shadow: 0 2px 8px var(--thedock-shadow-sm);
    transform: translateY(-1px);
}

.thedock-category-header {
    display: flex;
    align-items: center;
    gap: 15px;
}

.thedock-category-info {
    flex: 1;
    min-width: 0; /* Allow text truncation if needed */
}

.thedock-category-info h4 {
    margin: 0 0 5px 0;
    font-size: 16px;
    color: var(--thedock-text-color);
}

.thedock-required-badge {
    display: inline-block;
    padding: 2px 8px;
    background: #f0f0f0;
    border-radius: 3px;
    font-size: 12px;
    color: #666;
}

.thedock-category-description p {
    margin: 0 0 10px 0;
    font-size: 13px;
    line-height: 1.5;
    color: #666;
}

.thedock-cookie-count {
    font-size: 14px;
    font-weight: normal;
    color: #999;
}

/* Show Details Button */
.thedock-btn-details {
    background: var(--thedock-bg-tertiary);
    border: 1px solid var(--thedock-border-color);
    color: var(--thedock-text-color);
    font-size: 13px;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    white-space: nowrap;
    font-weight: 500;
    margin-left: auto; /* Push to the right side */
}

.thedock-btn-details:hover {
    background: var(--thedock-btn-secondary-hover);
    border-color: var(--thedock-border-hover);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px var(--thedock-shadow-sm);
}

.thedock-btn-details:active {
    transform: translateY(0);
}

.thedock-details-icon {
    display: inline-block;
    transition: transform 0.3s ease;
    font-size: 10px;
    color: var(--thedock-text-light);
}

.thedock-btn-details.active {
    background: var(--thedock-primary-color);
    color: #fff;
    border-color: var(--thedock-primary-color);
}

.thedock-btn-details.active .thedock-details-icon {
    transform: rotate(180deg);
    color: #fff;
}

/* Category Details */
.thedock-category-details {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e5e5e5;
    animation: thedockSlideDown 0.3s ease-out;
}

@keyframes thedockSlideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Cookie Table */
.thedock-cookies-table {
    overflow-x: auto;
    margin-top: 20px;
    border-radius: 8px;
    border: 1px solid var(--thedock-border-color);
    background: var(--thedock-bg-color);
}

.thedock-cookie-list-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
    background: transparent;
}

.thedock-cookie-list-table thead {
    background: var(--thedock-bg-tertiary);
    position: sticky;
    top: 0;
    z-index: 10;
}

.thedock-cookie-list-table thead th {
    border: none;
    text-align: left;
    padding: 14px 16px;
    font-weight: 600;
    color: var(--thedock-text-color);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    white-space: nowrap;
    background: var(--thedock-bg-tertiary);
}

.thedock-cookie-list-table thead th:first-child {
    padding-left: 20px;
    border-radius: 8px 0 0 0;
}

.thedock-cookie-list-table thead th:last-child {
    padding-right: 20px;
    border-radius: 0 8px 0 0;
}

.thedock-cookie-list-table tbody td {
    transition: all 0.15s ease;
    border-left: 0;
    border-right: 0;
    border-top: 0;
    border-bottom: 1px solid var(--thedock-border-color);
}

.thedock-cookie-list-table tbody tr:last-child {
    border-bottom: none;
}

.thedock-cookie-list-table tbody tr:last-child td:first-child {
    border-radius: 0 0 0 8px;
}

.thedock-cookie-list-table tbody tr:last-child td:last-child {
    border-radius: 0 0 8px 0;
}

.thedock-cookie-list-table tbody tr:hover {
    background: var(--thedock-bg-secondary);
}

.thedock-cookie-list-table tbody td {
    padding: 14px 16px;
    vertical-align: middle;
    line-height: 1.6;
    color: var(--thedock-text-light);
}

.thedock-cookie-list-table tbody td:first-child {
    padding-left: 20px;
}

.thedock-cookie-list-table tbody td:last-child {
    padding-right: 20px;
}

.thedock-cookie-name-col {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', 'Courier New', monospace;
    font-size: 13px;
    white-space: nowrap;
    font-weight: 500;
}

.thedock-cookie-name-col strong {
    color: var(--thedock-text-color);
    font-weight: 600;
}

.thedock-cookie-domain-col {
    color: var(--thedock-text-light);
    white-space: nowrap;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', 'Courier New', monospace;
    font-size: 12px;
    opacity: 0.9;
}

.thedock-cookie-provider-col {
    color: var(--thedock-text-color);
    white-space: nowrap;
    font-weight: 500;
}

.thedock-cookie-purpose-col {
    color: var(--thedock-text-light);
    max-width: 350px;
    min-width: 220px;
    line-height: 1.5;
}

.thedock-cookie-expiry-col {
    color: var(--thedock-text-light);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.thedock-cookie-type-col {
    text-align: center;
    white-space: nowrap;
}

.thedock-cookie-type-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-width: 70px;
    transition: all 0.2s ease;
}

/* Type badge colors - Minimal design with subtle tones */
.thedock-type-http {
    background: rgba(46, 125, 50, 0.08);
    color: #2e7d32;
    border: 1px solid rgba(46, 125, 50, 0.2);
}

.thedock-type-javascript {
    background: rgba(239, 108, 0, 0.08);
    color: #ef6c00;
    border: 1px solid rgba(239, 108, 0, 0.2);
}

.thedock-type-third-party {
    background: rgba(25, 118, 210, 0.08);
    color: #1976d2;
    border: 1px solid rgba(25, 118, 210, 0.2);
}

.thedock-type-iframe {
    background: rgba(123, 31, 162, 0.08);
    color: #7b1fa2;
    border: 1px solid rgba(123, 31, 162, 0.2);
}

.thedock-type-localstorage {
    background: rgba(194, 24, 91, 0.08);
    color: #c2185b;
    border: 1px solid rgba(194, 24, 91, 0.2);
}

.thedock-type-sessionstorage {
    background: rgba(0, 105, 92, 0.08);
    color: #00695c;
    border: 1px solid rgba(0, 105, 92, 0.2);
}

.thedock-cookie-type-badge:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px var(--thedock-shadow-sm);
}

.thedock-no-cookies {
    margin: 10px 0 0 0;
    font-size: 12px;
    color: #999;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .thedock-cookies-table {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        /* Smooth scrolling on iOS */
        scrollbar-width: thin;
        scrollbar-color: var(--thedock-border-hover) transparent;
    }

    .thedock-cookies-table::-webkit-scrollbar {
        height: 6px;
    }

    .thedock-cookies-table::-webkit-scrollbar-track {
        background: transparent;
    }

    .thedock-cookies-table::-webkit-scrollbar-thumb {
        background: var(--thedock-border-hover);
        border-radius: 3px;
    }

    .thedock-cookie-list-table {
        min-width: 800px;
        font-size: 12px;
    }

    .thedock-cookie-list-table thead th {
        padding: 12px 14px;
        font-size: 11px;
    }

    .thedock-cookie-list-table tbody td {
        padding: 12px 14px;
    }

    .thedock-cookie-purpose-col {
        max-width: 250px;
        min-width: 150px;
    }
}

/* Toggle Switch */
.thedock-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
    flex-shrink: 0;
}

.thedock-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

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

.thedock-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.thedock-switch input:checked + .thedock-slider {
    background-color: var(--thedock-primary-color);
}

.thedock-switch input:checked + .thedock-slider:before {
    transform: translateX(24px);
}

.thedock-switch input:disabled + .thedock-slider {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Blocked Content Placeholder */
.thedock-blocked-content {
    background: linear-gradient(135deg, var(--thedock-blocked-bg-start) 0%, var(--thedock-blocked-bg-end) 100%);
    border: 2px dashed var(--thedock-blocked-border);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    min-height: 200px;
    transition: all 0.3s ease;
}

.thedock-blocked-content:hover {
    border-color: var(--thedock-blocked-border-hover);
    background: linear-gradient(135deg, var(--thedock-bg-color) 0%, var(--thedock-bg-tertiary) 100%);
}

.thedock-blocked-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 10px 0;
    color: var(--thedock-text-light);
    max-width: 500px;
}

.thedock-blocked-message p {
    margin: 0 0 12px 0;
    line-height: 1.5;
}

.thedock-blocked-message p strong {
    color: var(--thedock-text-color);
    font-size: 16px;
    display: block;
    margin-bottom: 8px;
}

.thedock-accept-category {
    margin-top: 20px;
    padding: 12px 28px;
    background: var(--thedock-primary-color);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px var(--thedock-shadow-sm);
}

.thedock-accept-category:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--thedock-shadow-md);
}

.thedock-accept-category:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px var(--thedock-shadow-sm);
}

/* Animations */
@keyframes thedockSlideIn {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.thedock-position-top.thedock-cookie-banner {
    animation: thedockSlideInTop 0.3s ease-out;
}

@keyframes thedockSlideInTop {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes thedockFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes thedockOverlayFadeIn {
    from {
        opacity: 0;
        backdrop-filter: blur(0px);
        -webkit-backdrop-filter: blur(0px);
    }
    to {
        opacity: 1;
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
    }
}

@keyframes thedockModalSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Hide elements */
.thedock-hidden {
    display: none !important;
}

/* Blocked iframe placeholders */
.thedock-blocked-iframe {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    border: 2px dashed #ccc;
    border-radius: 8px;
    min-height: 300px;
    padding: 40px 20px;
}

.thedock-iframe-placeholder {
    text-align: center;
    max-width: 500px;
}

.thedock-placeholder-content {
    padding: 20px;
}

.thedock-placeholder-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin: 0 0 10px 0;
}

.thedock-placeholder-text {
    font-size: 14px;
    color: #666;
    margin: 0 0 20px 0;
    line-height: 1.6;
}

.thedock-blocked-iframe .thedock-btn {
    display: inline-block;
    padding: 12px 24px;
    background: var(--thedock-primary-color, #2271b1);
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
}

.thedock-blocked-iframe .thedock-btn:hover {
    background: var(--thedock-primary-hover, #135e96);
}

/* Responsive blocked content */
@media (max-width: 768px) {
    .thedock-blocked-iframe {
        min-height: 200px;
        padding: 20px 15px;
    }

    .thedock-placeholder-title {
        font-size: 16px;
    }

    .thedock-placeholder-text {
        font-size: 13px;
    }
}
