/**
 * WYSIWYG Editor Component Styles
 * Location: /components/wysiwyg-editor/wysiwyg-editor.css
 */

/* Base Component Styles */
.wysiwyg-editor-component {
    position: relative;
    width: 100%;
}

.wysiwyg-inner {
    position: relative;
    z-index: 1;
}

/* Content Styles */
.wysiwyg-content {
    /* Typography base - inherits from theme */
    font-size: var(--font-size-base);
    line-height: 1.7;
    color: var(--gray-900);
}

/* Dark background text color */
.bg-dark .wysiwyg-content {
    color: var(--gray-50);
}

/* Content Width Variations */
.wysiwyg-content.content-narrow {
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.wysiwyg-content.content-wide {
    max-width: 100%;
}

/* Text Alignment */
.wysiwyg-content.text-center {
    text-align: center;
}

.wysiwyg-content.text-right {
    text-align: right;
}

/* Drop Cap */
.wysiwyg-content.has-drop-cap > p:first-of-type::first-letter {
    float: left;
    font-size: 4.5em;
    line-height: 1;
    font-weight: 700;
    margin: 0 0.1em 0 0;
    color: var(--primary-600);
}

.bg-dark .wysiwyg-content.has-drop-cap > p:first-of-type::first-letter {
    color: var(--primary-400);
}

/* WYSIWYG Content Elements */

.wysiwyg-content h1:first-child,
.wysiwyg-content h2:first-child,
.wysiwyg-content h3:first-child,
.wysiwyg-content h4:first-child,
.wysiwyg-content h5:first-child,
.wysiwyg-content h6:first-child {
    margin-top: 0;
}

.wysiwyg-content h1 { font-size: var(--font-size-h1); }
.wysiwyg-content h2 { font-size: var(--font-size-h2); margin: .5rem 0;}
.wysiwyg-content h3 { font-size: var(--font-size-h3); }
.wysiwyg-content h4 { font-size: var(--font-size-h4); }
.wysiwyg-content h5 { font-size: var(--font-size-h5); }
.wysiwyg-content h6 { font-size: var(--font-size-h6); }

/* Paragraphs */
.wysiwyg-content p {
    margin-bottom: 1.5em;
}

.wysiwyg-content p:last-child {
    margin-bottom: 0;
}

/* Links */
.wysiwyg-content a {
    color: var(--primary-600);
    text-decoration: underline;
    transition: color 0.2s ease;
}

.wysiwyg-content a:hover {
    color: var(--primary-700);
}

.bg-dark .wysiwyg-content a {
    color: var(--primary-400);
}

.bg-dark .wysiwyg-content a:hover {
    color: var(--primary-300);
}

/* Lists */
.wysiwyg-content ul,
.wysiwyg-content ol {
    margin: 1.5em 0;
    padding-left: 2em;
}

.wysiwyg-content ul {
    list-style-type: disc;
}

.wysiwyg-content ol {
    list-style-type: decimal;
}

.wysiwyg-content li {
    margin-bottom: 0.5em;
}

.wysiwyg-content ul ul,
.wysiwyg-content ol ol,
.wysiwyg-content ul ol,
.wysiwyg-content ol ul {
    margin-top: 0.5em;
    margin-bottom: 0.5em;
}

/* Blockquotes */
.wysiwyg-content blockquote {
    margin: 2em 0;
    padding: 1.5em 2em;
    border-left: 4px solid var(--primary-500);
    background-color: var(--gray-50);
    font-style: italic;
    font-size: 1.1em;
}

.bg-dark .wysiwyg-content blockquote {
    background-color: rgba(255, 255, 255, 0.05);
    border-left-color: var(--primary-400);
}

.wysiwyg-content blockquote p:last-child {
    margin-bottom: 0;
}

/* Images */
.wysiwyg-content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 2em auto;
}

/* Image Alignments */
.wysiwyg-content .alignleft {
    float: left;
    margin: 0.5em 2em 1.5em 0;
}

.wysiwyg-content .alignright {
    float: right;
    margin: 0.5em 0 1.5em 2em;
}

.wysiwyg-content .aligncenter {
    display: block;
    margin-left: auto;
    margin-right: auto;
}

/* WordPress Captions */
.wysiwyg-content .wp-caption {
    max-width: 100%;
    margin-bottom: 2em;
}

.wysiwyg-content .wp-caption-text {
    margin-top: 0.5em;
    font-size: 0.9em;
    color: var(--gray-600);
    text-align: center;
}

/* Tables */
.wysiwyg-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 2em 0;
}

.wysiwyg-content th,
.wysiwyg-content td {
    padding: 0.75em 1em;
    text-align: left;
    border: 1px solid var(--gray-300);
}

.wysiwyg-content th {
    background-color: var(--gray-100);
    font-weight: var(--font-weight-semibold);
}

.bg-dark .wysiwyg-content th {
    background-color: rgba(255, 255, 255, 0.1);
}

.bg-dark .wysiwyg-content th,
.bg-dark .wysiwyg-content td {
    border-color: var(--gray-700);
}

/* Code */
.wysiwyg-content code {
    background-color: var(--gray-100);
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-family: monospace;
    font-size: 0.9em;
}

.wysiwyg-content pre {
    background-color: var(--gray-900);
    color: var(--gray-50);
    padding: 1.5em;
    border-radius: 8px;
    overflow-x: auto;
    margin: 2em 0;
}

.wysiwyg-content pre code {
    background-color: transparent;
    padding: 0;
    color: inherit;
}

/* Horizontal Rule */
.wysiwyg-content hr {
    border: 0;
    height: 1px;
    background-color: var(--gray-300);
    margin: 3em 0;
}

.bg-dark .wysiwyg-content hr {
    background-color: var(--gray-700);
}

/* Video Embeds */
.wysiwyg-content .wp-block-embed,
.wysiwyg-content .wp-video,
.wysiwyg-content iframe[src*="youtube"],
.wysiwyg-content iframe[src*="vimeo"] {
    margin: 2em 0;
}

.wysiwyg-content .wp-block-embed__wrapper {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
}

.wysiwyg-content .wp-block-embed__wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Buttons in content */
.wysiwyg-content .wp-block-button {
    margin: 1.5em 0;
}

.wysiwyg-content .wp-block-button__link {
    display: inline-block;
    padding: 0.75em 1.5em;
    background-color: var(--primary-600);
    color: white;
    text-decoration: none;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.wysiwyg-content .wp-block-button__link:hover {
    background-color: var(--primary-700);
    color: white;
}

/* Gallery */
.wysiwyg-content .wp-block-gallery {
    margin: 2em 0;
}

/* Responsive */
@media (max-width: 768px) {
    /* Adjust drop cap on mobile */
    .wysiwyg-content.has-drop-cap > p:first-of-type::first-letter {
        font-size: 3.5em;
    }
    
    /* Clear floats on mobile */
    .wysiwyg-content .alignleft,
    .wysiwyg-content .alignright {
        float: none;
        display: block;
        margin-left: auto;
        margin-right: auto;
    }
    
    /* Reduce list padding on mobile */
    .wysiwyg-content ul,
    .wysiwyg-content ol {
        padding-left: 1.5em;
    }
    
    /* Adjust blockquote padding */
    .wysiwyg-content blockquote {
        padding: 1em 1.5em;
    }
}

/* Print styles */
@media print {
    .wysiwyg-content {
        color: black;
    }
    
    .wysiwyg-content a {
        color: black;
        text-decoration: underline;
    }
}