/**
 * Link Embedder Admin - Frontend Styles
 * Version: 1.0.0
 */

/* Base Container Styles */
.lea-container {
    display: block;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin: 20px 0;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.lea-content {
    position: relative;
    z-index: 1;
}

/* Header Styles */
.lea-header {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid #e0e0e0;
    background: #f9f9f9;
}

.lea-embed-iframe .lea-header {
    margin-bottom: 0;
}

/* Title Styles */
.lea-title {
    margin: 0 0 12px 0;
    font-size: 24px;
    font-weight: 600;
    line-height: 1.3;
    color: #333333;
}

/* Description Styles */
.lea-description {
    margin: 0;
    font-size: 16px;
    line-height: 1.5;
    color: #666666;
}

/* Iframe Wrapper */
.lea-iframe-wrapper {
    position: relative;
    width: 100%;
    background: #fff;
    border-radius: 0 0 8px 8px;
    overflow: hidden;
}

.lea-iframe {
    width: 100%;
    min-height: 400px;
    border: none;
    display: block;
    background: #fff;
}

/* Loading State */
.lea-iframe-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: opacity 0.3s ease;
}

.lea-iframe:not([src=""]) + .lea-iframe-loading {
    opacity: 0;
    pointer-events: none;
}

.lea-loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0073aa;
    border-radius: 50%;
    animation: leaSpin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes leaSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.lea-iframe-loading p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

/* Button Wrapper (for fallback) */
.lea-button-wrapper {
    display: block;
    text-align: center;
    padding: 20px;
}

/* Base Button Styles */
.lea-button {
    display: inline-block;
    padding: 12px 24px;
    background-color: #0073aa;
    color: #ffffff;
    text-decoration: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 500;
    line-height: 1.2;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    text-align: center;
}

.lea-button:hover {
    background-color: #005a87;
    color: #ffffff;
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.3);
}

.lea-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0, 115, 170, 0.2);
}

.lea-button:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.lea-button:focus:not(:focus-visible) {
    outline: none;
}

/* Card Style */
.lea-style-card {
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    text-align: center;
    transition: all 0.3s ease;
}

.lea-style-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.lea-style-card.lea-embed-iframe {
    transform: none;
}

.lea-style-card.lea-embed-iframe:hover {
    transform: none;
}

.lea-style-card .lea-content {
    padding: 0;
}

.lea-style-card .lea-button-wrapper {
    padding: 24px;
}

.lea-style-card .lea-button {
    background: linear-gradient(135deg, #0073aa 0%, #005a87 100%);
    box-shadow: 0 2px 8px rgba(0, 115, 170, 0.2);
    font-weight: 600;
}

.lea-style-card .lea-button:hover {
    background: linear-gradient(135deg, #005a87 0%, #004066 100%);
    box-shadow: 0 4px 16px rgba(0, 115, 170, 0.3);
}

/* Minimal Style */
.lea-style-minimal {
    background-color: transparent;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: none;
    text-align: center;
}

.lea-style-minimal .lea-header {
    background: transparent;
    border-bottom: 1px solid #e0e0e0;
    padding: 16px;
}

.lea-style-minimal .lea-title {
    font-size: 20px;
    margin-bottom: 10px;
    color: #333333;
}

.lea-style-minimal .lea-description {
    font-size: 14px;
    color: #666666;
}

.lea-style-minimal .lea-content {
    padding: 0;
}

.lea-style-minimal .lea-button-wrapper {
    padding: 16px;
}

.lea-style-minimal .lea-button {
    background-color: transparent;
    color: #0073aa;
    border: 2px solid #0073aa;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
}

.lea-style-minimal .lea-button:hover {
    background-color: #0073aa;
    color: #ffffff;
    transform: none;
    box-shadow: none;
}

/* Banner Style */
.lea-style-banner {
    background: linear-gradient(135deg, #0073aa 0%, #005a87 100%);
    color: #ffffff;
    border-radius: 12px;
    position: relative;
    overflow: hidden;
    text-align: center;
}

.lea-style-banner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="75" cy="75" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="50" cy="10" r="0.5" fill="rgba(255,255,255,0.05)"/><circle cx="10" cy="90" r="0.5" fill="rgba(255,255,255,0.05)"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    opacity: 0.3;
    z-index: 0;
}

.lea-style-banner .lea-header {
    background: transparent;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding: 32px 24px;
    position: relative;
    z-index: 1;
}

.lea-style-banner .lea-content {
    position: relative;
    z-index: 1;
}

.lea-style-banner .lea-title {
    color: #ffffff;
    font-size: 28px;
    margin-bottom: 14px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.lea-style-banner .lea-description {
    color: rgba(255, 255, 255, 0.9);
    font-size: 16px;
}

.lea-style-banner .lea-button-wrapper {
    padding: 24px;
}

.lea-style-banner .lea-button {
    background-color: #ffffff;
    color: #0073aa;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.lea-style-banner .lea-button:hover {
    background-color: #f8f9fa;
    color: #005a87;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.lea-style-banner .lea-iframe-wrapper {
    border-radius: 0;
}

/* Button Only Style */
.lea-style-button-only {
    background-color: transparent;
    border: none;
    box-shadow: none;
    display: inline-block;
    width: auto;
    margin: 10px 0;
    text-align: center;
}

.lea-style-button-only .lea-content {
    padding: 0;
}

.lea-style-button-only .lea-button-wrapper {
    padding: 0;
}

.lea-style-button-only .lea-button {
    background: linear-gradient(135deg, #0073aa 0%, #005a87 100%);
    padding: 15px 30px;
    font-size: 18px;
    font-weight: 600;
    border-radius: 8px;
    box-shadow: 0 3px 12px rgba(0, 115, 170, 0.3);
}

.lea-style-button-only .lea-button:hover {
    background: linear-gradient(135deg, #005a87 0%, #004066 100%);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 115, 170, 0.4);
}

/* Iframe-specific adjustments */
.lea-embed-iframe .lea-iframe-wrapper {
    min-height: 400px;
}

.lea-embed-iframe.lea-style-card .lea-iframe-wrapper {
    border-radius: 0 0 7px 7px;
}

.lea-embed-iframe.lea-style-minimal .lea-iframe-wrapper {
    border-radius: 0 0 7px 7px;
}

.lea-embed-iframe.lea-style-banner .lea-iframe-wrapper {
    border-radius: 0 0 11px 11px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .lea-container {
        margin: 15px 0;
    }
    
    .lea-header {
        padding: 16px;
    }
    
    .lea-style-banner .lea-header {
        padding: 24px 16px;
    }
    
    .lea-title {
        font-size: 20px;
    }
    
    .lea-style-banner .lea-title {
        font-size: 24px;
    }
    
    .lea-description {
        font-size: 14px;
    }
    
    .lea-button {
        padding: 12px 20px;
        font-size: 14px;
    }
    
    .lea-style-button-only .lea-button {
        padding: 12px 24px;
        font-size: 16px;
    }
    
    .lea-iframe {
        min-height: 350px;
    }
}

@media (max-width: 480px) {
    .lea-header {
        padding: 12px;
    }
    
    .lea-style-banner .lea-header {
        padding: 20px 12px;
    }
    
    .lea-title {
        font-size: 18px;
    }
    
    .lea-style-banner .lea-title {
        font-size: 20px;
    }
    
    .lea-button {
        width: 100%;
        text-align: center;
        padding: 14px 20px;
    }
    
    .lea-button-wrapper {
        display: block;
        width: 100%;
    }
    
    .lea-style-button-only .lea-button {
        width: auto;
        display: inline-block;
    }
    
    .lea-iframe {
        min-height: 300px;
    }
}

/* Animation Classes */
.lea-fade-in {
    animation: leaFadeIn 0.5s ease-out;
}

@keyframes leaFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading State */
.lea-loading {
    opacity: 0.7;
    pointer-events: none;
}

/* Focus Management */
.lea-button:focus-visible {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.lea-iframe:focus {
    outline: 2px solid #0073aa;
    outline-offset: -2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .lea-style-card,
    .lea-style-minimal {
        border-width: 2px;
        border-color: #000;
    }
    
    .lea-button {
        border: 2px solid currentColor;
    }
    
    .lea-style-minimal .lea-button {
        border-width: 3px;
    }
    
    .lea-iframe {
        border: 2px solid #000;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .lea-container,
    .lea-button,
    .lea-iframe-loading {
        transition: none;
    }
    
    .lea-button:hover,
    .lea-container:hover .lea-button {
        transform: none;
    }
    
    .lea-style-card:hover {
        transform: none;
    }
    
    .lea-fade-in {
        animation: none;
    }
    
    .lea-loading-spinner {
        animation: none;
    }
}

/* Print Styles */
@media print {
    .lea-container {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .lea-iframe {
        display: none;
    }
    
    .lea-iframe-wrapper::after {
        content: "Embedded content: " attr(data-src);
        display: block;
        padding: 20px;
        text-align: center;
        font-style: italic;
        color: #666;
    }
    
    .lea-button {
        background: transparent !important;
        color: #000 !important;
        border: 1px solid #000 !important;
    }
    
    .lea-button::after {
        content: " (" attr(href) ")";
        font-size: 12px;
        font-weight: normal;
    }
}

/* Dark Mode Support (if theme supports it) */
@media (prefers-color-scheme: dark) {
    .lea-style-card {
        background-color: #2d2d2d;
        border-color: #444;
        color: #fff;
    }
    
    .lea-style-card .lea-header,
    .lea-style-minimal .lea-header {
        background-color: #333;
        border-color: #555;
    }
    
    .lea-style-card .lea-title,
    .lea-style-minimal .lea-title {
        color: #fff;
    }
    
    .lea-style-card .lea-description,
    .lea-style-minimal .lea-description {
        color: #ccc;
    }
    
    .lea-iframe-loading {
        background: rgba(45, 45, 45, 0.95);
    }
    
    .lea-iframe-loading p {
        color: #ccc;
    }
}

/* RTL Support */
[dir="rtl"] .lea-container {
    text-align: right;
}

[dir="rtl"] .lea-style-card,
[dir="rtl"] .lea-style-banner,
[dir="rtl"] .lea-style-minimal {
    text-align: center;
}

/* Accessibility Improvements */
.lea-button[aria-disabled="true"] {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.lea-container[aria-hidden="true"] {
    display: none;
}

.lea-iframe[aria-hidden="true"] {
    display: none;
}

/* Screen Reader Only Text */
.lea-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;
}

/* Iframe Security Notice */
.lea-iframe-security-notice {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
    padding: 10px;
    font-size: 12px;
    text-align: center;
    border-radius: 4px 4px 0 0;
}

/* Fullscreen Support */
.lea-iframe:-webkit-full-screen {
    width: 100vw;
    height: 100vh;
}

.lea-iframe:-moz-full-screen {
    width: 100vw;
    height: 100vh;
}

.lea-iframe:fullscreen {
    width: 100vw;
    height: 100vh;
}

