/**
 * RTSC Cookie Banner Styles
 * 
 * Styles for the GDPR-compliant cookie consent banner
 * Uses RTSC Element UI design system for consistency
 * 
 * @version 1.0.2
 * @since 1.0.0
 */

/* Cookie Banner Base Styles */
.rtsc-cookie-banner {
    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;
    transition: all 0.3s ease-in-out;
}

.rtsc-cookie-banner * {
    box-sizing: border-box;
}

/* Banner Positioning */
.rtsc-banner-bottom {
    bottom: 0;
    left: 0;
    right: 0;
    transform: translateY(100%);
}

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

.rtsc-banner-top {
    top: 0;
    left: 0;
    right: 0;
    transform: translateY(-100%);
}

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

.rtsc-banner-center {
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
}

.rtsc-banner-center.rtsc-banner-visible {
    opacity: 1;
    visibility: visible;
}

/* Banner Overlay (for center position) */
.rtsc-cookie-banner-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
}

.rtsc-banner-center .rtsc-cookie-banner-overlay {
    display: block;
}

/* Banner Container */
.rtsc-cookie-banner-container {
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    position: relative;
    z-index: 1;
    max-width: 100%;
}

.rtsc-banner-center .rtsc-cookie-banner-container {

    max-width: 600px;
    margin: 0 20px;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.rtsc-banner-top .rtsc-cookie-banner-container {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

/* Banner Content */
.rtsc-cookie-banner-content {
    padding: 24px;
    max-width: 1200px;
    margin: 0 auto;
}

.rtsc-banner-center .rtsc-cookie-banner-content {
    padding: 32px;
}

/* Banner Header */
.rtsc-banner-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.rtsc-banner-title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #1f2937;
    line-height: 1.3;
}

.rtsc-banner-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.rtsc-banner-close:hover {
    background: #f3f4f6;
    color: #374151;
}

/* Banner Description */
.rtsc-banner-description {
    margin-bottom: 24px;
    color: #4b5563;
    line-height: 1.6;
}

.rtsc-banner-description p {
    margin: 0 0 12px 0;
}

.rtsc-banner-description p:last-child {
    margin-bottom: 0;
}

.rtsc-privacy-link {
    color: #2563eb;
    text-decoration: none;
    font-weight: 500;
}

.rtsc-privacy-link:hover {
    text-decoration: underline;
}

/* Banner Buttons */
.rtsc-banner-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-start;
}

/* Button Base Styles */
.rtsc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border: 2px solid transparent;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 44px;
    white-space: nowrap;
}

.rtsc-btn:focus {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

/* Button Variants */
.rtsc-btn-primary {
    background: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
}

.rtsc-btn-primary:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
}

.rtsc-btn-secondary {
    background: #6b7280;
    color: #ffffff;
    border-color: #6b7280;
}

.rtsc-btn-secondary:hover {
    background: #4b5563;
    border-color: #4b5563;
}

.rtsc-btn-outline {
    background: transparent;
    border-color: #d1d5db;
}

.rtsc-btn-outline:hover {
    background: #4b5563;
    border-color: #9ca3af;
}

/* Cookie Preferences Modal */
.rtsc-cookie-modal .rtsc-modal-content {
    max-width: 800px;
    max-height: 90vh;
    background: #1D2430;
    color: whitesmoke;
}

.rtsc-cookie-modal .rtsc-modal-header {
    border-bottom: 1px solid #313946;
}

.rtsc-cookie-modal .rtsc-modal-header h2 {
    color: whitesmoke;
}

.rtsc-cookie-modal .rtsc-modal-footer {
    border-top: 1px solid #313946;
}

.rtsc-cookie-modal .rtsc-preferences-intro {
    margin-bottom: 24px;
    padding: 16px;
    background: #242D3C;
    border-radius: 6px;
    border-left: 4px solid #2563eb;
}

.rtsc-preferences-intro p {
    margin: 0;
    color: whitesmoke;
}

/* Cookie Categories */
.rtsc-cookie-categories {
    space-y: 20px;
}

.rtsc-cookie-category {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 16px;
}

.rtsc-cookie-modal .rtsc-cookie-category {
    border-color: #313946;
}

.rtsc-category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

.rtsc-cookie-modal .rtsc-category-header {
    background: #242D3C;
    border-bottom-color: #313946;
}

.rtsc-category-info {
    flex: 1;
}

.rtsc-category-name {
    margin: 0 0 4px 0;
    font-size: 16px;
    font-weight: 600;
    color: whitesmoke;
}

.rtsc-category-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.rtsc-always-active {
    background: #d1fae5;
    color: #047857;
}

.rtsc-category-description {
    padding: 20px;
    color: whitesmoke;
    line-height: 1.6;
}

.rtsc-category-description p {
    margin: 0;
}

/* Toggle Switches */
.rtsc-category-toggle {
    margin-left: 16px;
}

.rtsc-toggle {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
    cursor: pointer;
}

.rtsc-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.rtsc-toggle-switch {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #d1d5db;
    border-radius: 14px;
    transition: 0.3s;
}

.rtsc-cookie-modal .rtsc-toggle-switch {
    background: #313946;
}

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

.rtsc-toggle input:checked+.rtsc-toggle-switch {
    background: #2563eb;
}

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

.rtsc-toggle-disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.rtsc-toggle-on {
    background: #10b981 !important;
}

.rtsc-toggle-on:before {
    transform: translateX(24px) !important;
}

/* Show/Hide Cookies Button */
.rtsc-show-cookies {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: none;
    border: none;
    color: #2563eb;
    font-weight: 500;
    cursor: pointer;
    width: 100%;
    justify-content: flex-start;
    border-top: 1px solid #e5e7eb;
    transition: background 0.2s ease;
}

.rtsc-cookie-modal .rtsc-show-cookies {
    background: #242D3C;
    border-top-color: #313946;
    color: #60a5fa;
}

.rtsc-show-cookies:hover {
    background: #f8fafc;
}

.rtsc-cookie-modal .rtsc-show-cookies:hover {
    background: #2D3748;
}

.rtsc-icon-chevron-down {
    transition: transform 0.2s ease;
    font-style: normal;
}

.rtsc-icon-chevron-down:before {
    content: "▼";
    font-size: 10px;
}

/* Cookie List Table */
.rtsc-cookie-list {
    border-top: 1px solid #e5e7eb;
    background: #ffffff;
}

.rtsc-cookie-modal .rtsc-cookie-list {
    background: #1D2430;
    border-top-color: #313946;
}

.rtsc-cookies-table {
    width: 100%;
}

.rtsc-table-header {
    display: grid;
    grid-template-columns: 2fr 1.5fr 1fr 3fr;
    gap: 16px;
    padding: 16px 20px;
    background: #f1f5f9;
    font-weight: 600;
    color: #374151;
    border-bottom: 1px solid #e5e7eb;
}

.rtsc-cookie-modal .rtsc-table-header {
    background: #242D3C;
    color: whitesmoke;
    border-bottom-color: #313946;
}

.rtsc-table-row {
    display: grid;
    grid-template-columns: 2fr 1.5fr 1fr 3fr;
    gap: 16px;
    padding: 12px 20px;
    border-bottom: 1px solid #f3f4f6;
}

.rtsc-cookie-modal .rtsc-table-row {
    border-bottom-color: #313946;
}

.rtsc-table-row:last-child {
    border-bottom: none;
}

.rtsc-col-name code {
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    color: #1e40af;
}

.rtsc-cookie-modal .rtsc-col-name code {
    background: #2D3748;
    color: #93c5fd;
}

/* Revisit Consent Widget */
.rtsc-revisit-widget {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 999998;
}

.rtsc-revisit-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
    transition: all 0.2s ease;
    width: 48px;
    height: 48px;
}

.rtsc-revisit-btn:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
}

.rtsc-revisit-btn svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
}

/* Modal Base Styles */
.rtsc-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rtsc-modal-content {
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    max-width: 90vw;
    max-height: 90vh;
    width: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.rtsc-modal-header {
    padding: 24px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #313946;
    flex-shrink: 0;
}

.rtsc-modal-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #1f2937;
}

.rtsc-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    color: #6b7280;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.rtsc-modal-close:hover {
    background: none;
    border: none;
    color: #374151;
}

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

.rtsc-modal-footer {
    padding: 24px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    flex-shrink: 0;
    border-top: 1px solid #313946;
}

/* Responsive Design */
@media (max-width: 768px) {
    .rtsc-cookie-banner-content {
        padding: 20px;
    }

    .rtsc-banner-center .rtsc-cookie-banner-content {
        padding: 24px;
    }

    .rtsc-banner-buttons {
        justify-content: stretch;
    }

    .rtsc-btn {
        flex: 1;
        min-width: 0;
    }

    .rtsc-table-header,
    .rtsc-table-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .rtsc-table-header {
        display: none;
    }

    .rtsc-table-row {
        padding: 16px 20px;
        border: 1px solid #e5e7eb;
        border-radius: 6px;
        margin-bottom: 8px;
    }

    .rtsc-table-row:before {
        content: attr(data-label);
        font-weight: 600;
        color: #374151;
    }

    .rtsc-col-name:before {
        content: "Cookie: ";
    }

    .rtsc-col-provider:before {
        content: "Provider: ";
    }

    .rtsc-col-duration:before {
        content: "Duration: ";
    }

    .rtsc-col-description:before {
        content: "Purpose: ";
    }
}

@media (max-width: 480px) {
    .rtsc-cookie-banner-content {
        padding: 16px;
    }

    .rtsc-banner-title {
        font-size: 18px;
    }

    .rtsc-btn {
        padding: 10px 16px;
        font-size: 13px;
    }

    .rtsc-category-header {
        padding: 16px;
    }

    .rtsc-category-description {
        padding: 16px;
    }
}

/* Animation Classes */
.rtsc-fade-in {
    animation: rtscFadeIn 0.3s ease-out;
}

.rtsc-fade-out {
    animation: rtscFadeOut 0.3s ease-out;
}

.rtsc-slide-up {
    animation: rtscSlideUp 0.3s ease-out;
}

.rtsc-slide-down {
    animation: rtscSlideDown 0.3s ease-out;
}

@keyframes rtscFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes rtscFadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

@keyframes rtscSlideUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

@keyframes rtscSlideDown {
    from {
        transform: translateY(-100%);
    }

    to {
        transform: translateY(0);
    }
}

/* Dark Theme Support */
@media (prefers-color-scheme: dark) {
    .rtsc-cookie-banner-container {
        background: #1f2937;
        color: #f9fafb;
    }

    .rtsc-banner-title {
        color: #f9fafb;
    }

    .rtsc-banner-description {
        color: #d1d5db;
    }

    .rtsc-category-header {
        background: #374151;
        border-color: #4b5563;
    }

    .rtsc-cookie-category {
        border-color: #4b5563;
        background: #1f2937;
    }

    .rtsc-preferences-intro {
        background: #374151;
        border-color: #60a5fa;
    }
}

/* Focus and Accessibility */
.rtsc-btn:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

.rtsc-toggle:focus-within {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
    border-radius: 14px;
}

/* Loading States */
.rtsc-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: #6b7280;
}

.rtsc-loading:before {
    content: "";
    width: 20px;
    height: 20px;
    border: 2px solid #e5e7eb;
    border-top: 2px solid #2563eb;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}