/**
 * RSL Footer Component Styles
 * @version 1.0.0
 *
 * Runtime styles for footer rendering.
 * Integrates with RSL grid system for responsive layouts.
 * Supports light/dark themes.
 */

/* ============================================
   CSS VARIABLES
   ============================================ */

:root {
    --rsl-footer-bg: #1a1a2e;
    --rsl-footer-text: #e0e0e0;
    --rsl-footer-text-muted: #999999;
    --rsl-footer-heading: #ffffff;
    --rsl-footer-link: #e0e0e0;
    --rsl-footer-link-hover: #ffffff;
    --rsl-footer-border: rgba(255, 255, 255, 0.1);
    --rsl-footer-input-bg: rgba(255, 255, 255, 0.1);
    --rsl-footer-input-border: rgba(255, 255, 255, 0.2);
    --rsl-footer-input-focus: #6366f1;
    --rsl-footer-btn-bg: #6366f1;
    --rsl-footer-btn-hover: #4f46e5;
    --rsl-footer-btn-text: #ffffff;
    --rsl-footer-spacing: 1rem;
    --rsl-footer-radius: 8px;
}

/* Light theme footer */
.rsl-footer.rsl-footer-light {
    --rsl-footer-bg: #f8f9fa;
    --rsl-footer-text: #333333;
    --rsl-footer-text-muted: #666666;
    --rsl-footer-heading: #1a1a1a;
    --rsl-footer-link: #333333;
    --rsl-footer-link-hover: #6366f1;
    --rsl-footer-border: rgba(0, 0, 0, 0.1);
    --rsl-footer-input-bg: #ffffff;
    --rsl-footer-input-border: rgba(0, 0, 0, 0.15);
}

/* Auto theme - respects document theme */
.rsl-footer.rsl-footer-auto {
    --rsl-footer-bg: #1a1a2e;
    --rsl-footer-text: #e0e0e0;
    --rsl-footer-text-muted: #999999;
    --rsl-footer-heading: #ffffff;
    --rsl-footer-link: #e0e0e0;
    --rsl-footer-link-hover: #ffffff;
    --rsl-footer-border: rgba(255, 255, 255, 0.1);
    --rsl-footer-input-bg: rgba(255, 255, 255, 0.1);
    --rsl-footer-input-border: rgba(255, 255, 255, 0.2);
}

[data-theme="light"] .rsl-footer.rsl-footer-auto {
    --rsl-footer-bg: #f8f9fa;
    --rsl-footer-text: #333333;
    --rsl-footer-text-muted: #666666;
    --rsl-footer-heading: #1a1a1a;
    --rsl-footer-link: #333333;
    --rsl-footer-link-hover: #6366f1;
    --rsl-footer-border: rgba(0, 0, 0, 0.1);
    --rsl-footer-input-bg: #ffffff;
    --rsl-footer-input-border: rgba(0, 0, 0, 0.15);
}

/* ============================================
   MAIN FOOTER CONTAINER
   ============================================ */

.rsl-footer {
    background: var(--rsl-footer-bg);
    color: var(--rsl-footer-text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

.rsl-footer.rsl-footer-divider-above {
    border-top: 1px solid var(--rsl-footer-border);
}

/* ============================================
   FOOTER SECTIONS
   ============================================ */

.rsl-footer-section {
    padding: 3rem 0;
}

.rsl-footer-section:not(:last-child) {
    border-bottom: 1px solid var(--rsl-footer-border);
}

/* Inline section (for legal bars) */
.rsl-footer-section.rsl-footer-section-inline {
    padding: 1rem 0;
}

.rsl-footer-section.rsl-footer-section-inline .rsl-footer-columns {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

/* ============================================
   FOOTER COLUMNS
   ============================================ */

.rsl-footer-columns {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Column widths */
.rsl-footer-col {
    flex: 1;
    min-width: 200px;
}

.rsl-footer-col-auto {
    flex: 1 1 auto;
}

.rsl-footer-col-1-4 {
    flex: 0 0 calc(25% - 1.5rem);
    min-width: 200px;
}

.rsl-footer-col-1-3 {
    flex: 1 1 0;
    min-width: 180px;
}

.rsl-footer-col-1-2 {
    flex: 0 0 calc(50% - 1rem);
    min-width: 250px;
}

.rsl-footer-col-2-3 {
    flex: 0 0 calc(66.666% - 0.67rem);
    min-width: 300px;
}

.rsl-footer-col-3-4 {
    flex: 0 0 calc(75% - 0.5rem);
    min-width: 350px;
}

.rsl-footer-col-full {
    flex: 0 0 100%;
}

/* Responsive columns */
@media (max-width: 768px) {
    .rsl-footer-columns {
        flex-direction: column;
        gap: 2rem;
    }

    .rsl-footer-col,
    .rsl-footer-col-1-4,
    .rsl-footer-col-1-3,
    .rsl-footer-col-1-2,
    .rsl-footer-col-2-3,
    .rsl-footer-col-3-4 {
        flex: 0 0 100%;
        min-width: 0;
    }
}

/* ============================================
   FOOTER BLOCKS
   ============================================ */

.rsl-footer-block {
    margin-bottom: 1.5rem;
}

.rsl-footer-block:last-child {
    margin-bottom: 0;
}

/* Block headings */
.rsl-footer-heading {
    font-size: 1rem;
    font-weight: 600;
    color: var(--rsl-footer-heading);
    margin: 0 0 1rem 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ============================================
   LOGO BLOCK
   ============================================ */

.rsl-footer-block-logo {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.rsl-footer-logo-link {
    display: inline-block;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.rsl-footer-logo-link:hover {
    opacity: 0.8;
}

.rsl-footer-logo-link:focus-visible {
    outline: 2px solid var(--rsl-footer-input-focus);
    outline-offset: 4px;
    border-radius: 4px;
}

.rsl-footer-block-logo img {
    max-height: 48px;
    width: auto;
}

.rsl-footer-brand-name {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--rsl-footer-heading);
}

.rsl-footer-tagline {
    font-size: 0.875rem;
    color: var(--rsl-footer-text-muted);
    line-height: 1.6;
    margin: 0;
}

/* ============================================
   NAV BLOCK
   ============================================ */

.rsl-footer-nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.rsl-footer-nav-list.rsl-footer-nav-inline {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.rsl-footer-nav-link {
    color: var(--rsl-footer-link);
    text-decoration: none;
    font-size: 0.9375rem;
    transition: color 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.rsl-footer-nav-link:hover {
    color: var(--rsl-footer-link-hover);
}

.rsl-footer-nav-link:focus-visible {
    outline: 2px solid var(--rsl-footer-input-focus);
    outline-offset: 2px;
    border-radius: 2px;
}

.rsl-footer-nav-link i {
    font-size: 0.875rem;
    opacity: 0.7;
}

/* ============================================
   TEXT BLOCK
   ============================================ */

.rsl-footer-block-text p {
    margin: 0 0 0.75rem 0;
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--rsl-footer-text-muted);
}

.rsl-footer-block-text p:last-child {
    margin-bottom: 0;
}

.rsl-footer-block-text a {
    color: var(--rsl-footer-link-hover);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.rsl-footer-block-text a:hover {
    text-decoration: none;
}

/* ============================================
   SOCIAL BLOCK
   ============================================ */

.rsl-footer-social-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.rsl-footer-social-list.rsl-footer-social-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
    gap: 0.5rem;
    max-width: 200px;
}

.rsl-footer-social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--rsl-footer-input-bg);
    border-radius: var(--rsl-footer-radius);
    color: var(--rsl-footer-text);
    text-decoration: none;
    transition: all 0.2s ease;
}

.rsl-footer-social-link:hover {
    background: var(--rsl-footer-btn-bg);
    color: var(--rsl-footer-btn-text);
    transform: translateY(-2px);
}

.rsl-footer-social-link:focus-visible {
    outline: 2px solid var(--rsl-footer-input-focus);
    outline-offset: 2px;
}

.rsl-footer-social-link i,
.rsl-footer-social-link .rsl-icon {
    font-size: 1.125rem;
}

/* Screen reader text for social links */
.rsl-footer-social-link .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ============================================
   LEGAL BLOCK
   ============================================ */

.rsl-footer-block-legal {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.5rem;
}

.rsl-footer-legal-text {
    margin: 0;
    font-size: 0.875rem;
    color: var(--rsl-footer-text-muted);
}

.rsl-footer-legal-links {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.rsl-footer-legal-links a {
    color: var(--rsl-footer-text-muted);
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.15s ease;
}

.rsl-footer-legal-links a:hover {
    color: var(--rsl-footer-link-hover);
}

.rsl-footer-legal-links a:focus-visible {
    outline: 2px solid var(--rsl-footer-input-focus);
    outline-offset: 2px;
    border-radius: 2px;
}

/* ============================================
   NEWSLETTER BLOCK
   ============================================ */

.rsl-footer-block-newsletter {
    max-width: 400px;
}

.rsl-footer-block-newsletter p {
    margin: 0 0 1rem 0;
    font-size: 0.9375rem;
    color: var(--rsl-footer-text-muted);
    line-height: 1.5;
}

.rsl-footer-newsletter-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.rsl-footer-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--rsl-footer-text);
    margin-bottom: 0.25rem;
}

/* Visually hidden but accessible label */
.rsl-footer-label.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.rsl-footer-input-group {
    display: flex;
    gap: 0.5rem;
}

.rsl-footer-input {
    flex: 1;
    padding: 0.75rem 1rem;
    background: var(--rsl-footer-input-bg);
    border: 1px solid var(--rsl-footer-input-border);
    border-radius: var(--rsl-footer-radius);
    color: var(--rsl-footer-text);
    font-size: 0.9375rem;
    font-family: inherit;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.rsl-footer-input::placeholder {
    color: var(--rsl-footer-text-muted);
}

.rsl-footer-input:focus {
    outline: none;
    border-color: var(--rsl-footer-input-focus);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.rsl-footer-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    background: var(--rsl-footer-btn-bg);
    border: none;
    border-radius: var(--rsl-footer-radius);
    color: var(--rsl-footer-btn-text);
    font-size: 0.9375rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.1s ease;
    white-space: nowrap;
}

.rsl-footer-button:hover {
    background: var(--rsl-footer-btn-hover);
}

.rsl-footer-button:active {
    transform: scale(0.98);
}

.rsl-footer-button:focus-visible {
    outline: 2px solid var(--rsl-footer-btn-text);
    outline-offset: 2px;
}

/* Responsive newsletter form */
@media (max-width: 480px) {
    .rsl-footer-input-group {
        flex-direction: column;
    }

    .rsl-footer-button {
        width: 100%;
    }
}

/* ============================================
   BADGE ROW BLOCK
   ============================================ */

.rsl-footer-badge-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
}

.rsl-footer-badge-link {
    display: block;
    transition: opacity 0.2s ease, transform 0.15s ease;
}

.rsl-footer-badge-link:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

.rsl-footer-badge-link:focus-visible {
    outline: 2px solid var(--rsl-footer-input-focus);
    outline-offset: 4px;
    border-radius: 4px;
}

.rsl-footer-badge-link img {
    height: 40px;
    width: auto;
}

/* Badge without link */
.rsl-footer-badge-list img:not([src=""]) {
    height: 40px;
    width: auto;
}

/* ============================================
   CUSTOM HTML BLOCK
   ============================================ */

.rsl-footer-block-custom {
    /* Container for user-defined HTML */
}

.rsl-footer-block-custom p {
    margin: 0 0 0.75rem 0;
    line-height: 1.6;
}

.rsl-footer-block-custom a {
    color: var(--rsl-footer-link-hover);
}

/* ============================================
   MOBILE ACCORDION (OPTIONAL)
   ============================================ */

/* When footer sections collapse on mobile */
@media (max-width: 768px) {
    .rsl-footer-accordion .rsl-footer-heading {
        display: flex;
        align-items: center;
        justify-content: space-between;
        cursor: pointer;
        padding: 0.75rem 0;
        margin: 0;
        border-bottom: 1px solid var(--rsl-footer-border);
    }

    .rsl-footer-accordion .rsl-footer-heading::after {
        content: '\f107'; /* FontAwesome chevron down */
        font-family: 'Font Awesome 6 Free';
        font-weight: 900;
        font-size: 0.875rem;
        transition: transform 0.2s ease;
    }

    .rsl-footer-accordion .rsl-footer-heading[aria-expanded="true"]::after {
        transform: rotate(180deg);
    }

    .rsl-footer-accordion .rsl-footer-heading[aria-expanded="false"] + .rsl-footer-accordion-content {
        display: none;
    }

    .rsl-footer-accordion .rsl-footer-accordion-content {
        padding-top: 1rem;
    }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

/* Center content */
.rsl-footer-center {
    text-align: center;
}

.rsl-footer-center .rsl-footer-columns {
    justify-content: center;
}

.rsl-footer-center .rsl-footer-social-list,
.rsl-footer-center .rsl-footer-badge-list {
    justify-content: center;
}

/* Compact footer */
.rsl-footer-compact .rsl-footer-section {
    padding: 2rem 0;
}

/* Extra spacing */
.rsl-footer-spacious .rsl-footer-section {
    padding: 4rem 0;
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    .rsl-footer {
        background: white !important;
        color: black !important;
    }

    .rsl-footer-newsletter-form,
    .rsl-footer-social-list {
        display: none;
    }

    .rsl-footer-nav-link,
    .rsl-footer-legal-links a {
        color: black !important;
    }

    .rsl-footer-nav-link::after {
        content: " (" attr(href) ")";
        font-size: 0.75rem;
    }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

/* Screen reader only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .rsl-footer *,
    .rsl-footer *::before,
    .rsl-footer *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .rsl-footer {
        --rsl-footer-border: currentColor;
    }

    .rsl-footer-nav-link:focus-visible,
    .rsl-footer-social-link:focus-visible,
    .rsl-footer-button:focus-visible {
        outline-width: 3px;
    }
}
