:root {
    --font-main: 'Exo 2', sans-serif;
    --font-mono: 'Fira Code', monospace;
    --bg-color: #0a0c14;
    --panel-bg: rgba(21, 24, 38, 0.7);
    --panel-border: rgba(155, 89, 182, 0.25);
    --glow-color: rgba(155, 89, 182, 0.3);
    --primary-accent: #9b59b6;
    --secondary-accent: #8e44ad;
    --text-color: #dfe6f2;
    --text-muted: #8a99b3;
    --success-color: #2ecc71;
    --warning-color: #f39c12;
    --error-color: #e74c3c;
    --light-bg: #f5f7fa;
    --light-panel: #ffffff;
    --light-text: #2c3e50;
    --light-muted: #7f8c8d;
    --light-border: #e0e6ed;
}

*, ::after, ::before {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: linear-gradient(-45deg, #0a0c14, #151826, #2d0b3f, #151826);
    background-size: 400% 400%;
    color: var(--text-color);
    font-family: var(--font-main);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    min-height: 100vh;
    transition: background 0.3s ease, color 0.3s ease;
    animation: gradientShift 15s ease infinite;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

body.light-theme {
    background: linear-gradient(-45deg, #f5f7fa, #e9ecef, #dee2e6, #e9ecef);
    color: var(--light-text);
}

body.light-theme .os-header,
body.light-theme .os-footer {
    background: rgba(255, 255, 255, 0.8);
    border-color: var(--light-border);
}

body.light-theme .input-card,
body.light-theme .output-card {
    background: var(--light-panel);
    border-color: var(--light-border);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.1);
}

body.light-theme .conversion-btn {
    background: var(--light-panel);
    border-color: var(--light-border);
    color: var(--light-muted);
}

body.light-theme .conversion-btn:hover {
    background-color: var(--light-border);
    color: var(--light-text);
}

body.light-theme #prompt-canvas {
    color: var(--light-text);
}

body.light-theme .modal-content {
    background: var(--light-panel);
    border-color: var(--light-border);
}

body.light-theme .history-panel {
    background: var(--light-panel);
    border-color: var(--light-border);
}

body.light-theme .icon-btn {
    color: var(--light-muted);
}

body.light-theme .icon-btn:hover {
    background: rgba(155, 89, 182, 0.1);
    color: var(--primary-accent);
}

body.light-theme .auto-correct-label {
    color: var(--light-muted);
}

body.light-theme .auto-correct-label:hover {
    color: var(--light-text);
}

body.light-theme .template-item:hover,
body.light-theme .category-item:hover {
    background: rgba(155, 89, 182, 0.1);
    color: var(--primary-accent);
}

body.light-theme .category-title {
    color: var(--primary-accent);
    border-bottom: 1px solid var(--light-border);
}

body.light-theme .footer-info a {
    color: var(--primary-accent);
}

body.light-theme .footer-info a:hover {
    color: var(--secondary-accent);
}

body::-webkit-scrollbar {
    width: 8px;
}

body::-webkit-scrollbar-track {
    background: var(--bg-color);
}

body::-webkit-scrollbar-thumb {
    background: var(--primary-accent);
    border-radius: 4px;
}

body::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-accent);
}

.os-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.os-header, .os-footer {
    flex-shrink: 0;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    background: rgba(10, 12, 20, 0.6);
    border-color: var(--panel-border);
    z-index: 10;
    transition: background 0.3s ease, border-color 0.3s ease;
}

.os-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    border-bottom: 1px solid var(--panel-border);
}

.os-main {
    flex-grow: 1;
    padding: 1rem;
    overflow-y: auto;
    position: relative;
}

.main-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

.input-card, .output-card {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    box-shadow: 0 0 40px var(--glow-color);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 1.5rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    width: 100%;
}

.input-card:hover, .output-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 50px var(--glow-color);
}

.textarea-wrapper {
    position: relative;
    display: flex;
}

#prompt-canvas {
    flex-grow: 1;
    background: 0 0;
    border: none;
    outline: 0;
    resize: none;
    color: var(--text-color);
    font-size: 1.1rem;
    font-family: var(--font-mono);
    min-height: 150px;
    padding: 0.8rem;
    border-radius: 8px;
    transition: border-color 0.3s ease;
    width: 100%;
}

#prompt-canvas:focus {
    border: 1px solid var(--primary-accent);
}

#output-preview {
    white-space: pre-wrap;
    word-wrap: break-word;
    margin-top: 1rem;
    line-height: 1.6;
    font-size: 1rem;
}

/* Ad Container Styles - Main Focus */
.ad-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto;
    width: 100%;
    clear: both;
    overflow: hidden;
    border-radius: 8px;
    background: rgba(21, 24, 38, 0.5);
    border: 1px dashed var(--panel-border);
    position: relative;
    z-index: 5;
    isolation: isolate;
    /* IMPORTANT: Ensure ads remain visible after prompt generation */
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    contain: layout style paint;
    /* Prevent layout shift */
    min-height: 60px;
}

.ad-content {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
}

/* Ensure ads are visible */
.ad-container iframe,
.ad-container ins {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    opacity: 1 !important;
    visibility: visible !important;
    position: relative !important;
    z-index: 2 !important;
}

/* FIXED: Hide ad scripts from view but allow them to execute */
.ad-container script {
    display: none !important;
    visibility: hidden !important;
}

/* 728x90 Banner Styles */
.ad-728 {
    max-width: 728px;
    height: 90px;
    margin: 40px auto 30px;
    min-height: 90px;
}

/* 468x60 Banner Styles */
.ad-468 {
    max-width: 468px;
    height: 60px;
    margin: 25px auto 20px;
    min-height: 60px;
}

/* 300x250 Banner Styles */
.ad-300 {
    max-width: 300px;
    height: 250px;
    margin: 20px auto;
    min-height: 250px;
}

/* 160x600 Banner Styles */
.ad-160 {
    max-width: 160px;
    height: 600px;
    margin: 20px auto;
    min-height: 600px;
}

/* Specific Ad Container Positions */
#ad-banner-top {
    margin-top: 10px;
    margin-bottom: 30px;
}

#ad-banner-header-desktop {
    margin: 20px auto 30px;
}

#ad-banner-middle-1 {
    margin: 30px auto 20px;
}

#ad-banner-sidebar {
    position: sticky;
    top: 20px;
}

#ad-banner-footer-desktop {
    margin: 20px auto 10px;
}

/* Section Ad Banners - 728x90 */
#ad-banner-why-choose,
#ad-banner-key-features,
#ad-banner-how-to-use,
#ad-banner-applications,
#ad-banner-future,
#ad-banner-join,
#ad-banner-faq {
    margin: 50px auto 40px;
}

/* Between Section Ad Banners - 468x60 */
#ad-banner-between-1,
#ad-banner-between-2,
#ad-banner-between-3,
#ad-banner-between-4,
#ad-banner-between-5,
#ad-banner-between-6 {
    margin: 30px auto 25px;
}

/* SEO Content Ad Spacing */
.seo-content .ad-container {
    margin: 30px auto;
}

.seo-content h2 {
    margin-top: 40px;
    margin-bottom: 20px;
}

/* Responsive Ad Behavior */
@media (max-width: 768px) {
    .ad-728 {
        display: none !important;
    }
    
    .ad-468 {
        max-width: 320px;
        height: 50px;
        min-height: 50px;
    }
    
    .ad-300 {
        max-width: 300px;
        height: 250px;
        min-height: 250px;
    }
    
    .ad-160 {
        display: none !important;
    }
    
    #ad-banner-top {
        display: none;
    }
    
    .seo-content .ad-container {
        margin: 20px auto;
    }
    
    .seo-content h2 {
        margin-top: 30px;
        margin-bottom: 15px;
    }
}

@media (max-width: 480px) {
    .ad-468 {
        max-width: 300px;
        height: 250px;
        min-height: 250px;
    }
    
    .ad-300 {
        max-width: 300px;
        height: 250px;
        min-height: 250px;
    }
}

/* Tablet Responsive */
@media (min-width: 769px) and (max-width: 1024px) {
    .ad-728 {
        max-width: 468px;
        height: 60px;
        min-height: 60px;
    }
    
    .ad-160 {
        display: none !important;
    }
}

/* Desktop Large */
@media (min-width: 1200px) {
    .ad-728 {
        max-width: 970px;
        height: 90px;
        min-height: 90px;
    }
}

/* Ad Loading Animation */
.ad-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(155, 89, 182, 0.1), transparent);
    animation: adLoading 2s linear infinite;
    z-index: 1;
}

@keyframes adLoading {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* Remove animation when ad is loaded */
.ad-container.loaded::before {
    display: none;
}

/* Ad Container Hover Effects */
.ad-container:hover {
    border-color: var(--primary-accent);
    box-shadow: 0 0 20px rgba(155, 89, 182, 0.2);
    transition: all 0.3s ease;
}

/* Ad Placeholder Fallback */
.ad-placeholder {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60px;
    margin: 1rem auto 0;
    clear: both;
    background: rgba(21, 24, 38, 0.5);
    border: 1px dashed var(--panel-border);
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 0.9rem;
    text-align: center;
    padding: 10px;
    overflow: hidden;
}

/* Z-index fixes */
.ad-container {
    position: relative;
}

.modal-overlay {
    z-index: 5000;
}

.history-panel {
    z-index: 6000;
}

/* Smooth transitions for ad visibility */
.ad-container {
    transition: all 0.3s ease;
}

/* Ensure ad content is properly contained */
.ad-content {
    position: relative;
    z-index: 1;
}

/* Hide ad scripts visually but keep them functional */
.ad-container script {
    position: absolute;
    left: -9999px;
    top: -9999px;
    visibility: hidden;
}

/* Content flow improvements */
.content-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

@media (min-width: 1024px) {
    .content-wrapper {
        flex-direction: row;
        justify-content: center;
        align-items: flex-start;
        gap: 2rem;
    }

    .main-panel {
        margin-right: 0;
        flex: 1;
    }

    .sidebar-ad-container {
        width: 160px;
        flex-shrink: 0;
        margin-top: 1rem;
    }
}

.sidebar-ad-container {
    display: none;
}

@media (min-width: 1024px) {
    .sidebar-ad-container {
        display: block;
    }
}

.top-generate-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 1rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.instagram-btn {
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
    text-decoration: none;
}

.instagram-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(188, 24, 136, .6);
}

.privacy-policy, .about-us {
    max-width: 800px;
    margin: 2rem auto;
    padding: 1.5rem;
    background: var(--panel-bg);
    border-radius: 16px;
    border: 1px solid var(--panel-border);
    color: var(--text-color);
    line-height: 1.6;
}

.privacy-policy h2, .about-us h2 {
    color: var(--primary-accent);
    margin-bottom: 1.5rem;
    font-size: 2rem;
    text-align: center;
}

.privacy-policy h3, .about-us h3 {
    color: var(--text-color);
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.privacy-policy h4, .about-us h4 {
    color: var(--text-color);
    margin-top: 1.5rem;
    margin-bottom: .8rem;
    font-size: 1.1rem;
}

.privacy-policy p, .about-us p {
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.privacy-policy a, .about-us a {
    color: var(--primary-accent);
    text-decoration: none;
    transition: color 0.3s ease;
}

.privacy-policy a:hover, .about-us a:hover {
    text-decoration: underline;
    color: var(--secondary-accent);
}

.company-info, .mission, .product, .team, .contact, .future {
    margin-bottom: 2rem;
    padding: 1rem;
    background: rgba(21, 24, 38, .5);
    border-radius: 8px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.company-info:hover, .mission:hover, .product:hover, .team:hover, .contact:hover, .future:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(155, 89, 182, 0.3);
}

.leader {
    padding: 1rem;
    background: rgba(155, 89, 182, .1);
    border-radius: 8px;
    margin-top: 1rem;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background-color: var(--primary-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 1.2rem;
}

.install-button {
    background: linear-gradient(45deg, var(--primary-accent), var(--secondary-accent));
    color: #fff;
    border: none;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .3s ease;
    box-shadow: 0 2px 10px rgba(155, 89, 182, .4);
    display: flex;
    align-items: center;
    gap: 5px;
}

.install-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(155, 89, 182, .6);
}

.install-button:active {
    transform: translateY(0);
}

h1, h2, h3, h4, h5, h6 {
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

a {
    color: var(--primary-accent);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--secondary-accent);
}

button {
    transition: all 0.3s ease;
}

input, textarea {
    transition: border-color 0.3s ease;
}

.notification {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary-accent);
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    z-index: 10000;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateX(-50%) translateY(100px);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

.notification.success {
    background: var(--success-color);
}

.notification.error {
    background: var(--error-color);
}

.notification.warning {
    background: var(--warning-color);
}

/* New styles for additional features */
.header-menu {
    position: relative;
}

.menu-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    min-width: 200px;
    z-index: 100;
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: dropdownSlide 0.3s ease;
}

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

.menu-dropdown.active {
    display: flex;
}

.menu-item {
    padding: 12px 16px;
    cursor: pointer;
    transition: background-color .2s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.menu-item:hover {
    background: rgba(155, 89, 182, 0.2);
}

.theme-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toggle-switch {
    position: relative;
    width: 50px;
    height: 24px;
    background: var(--panel-border);
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.3s;
}

.toggle-switch.active {
    background: var(--primary-accent);
}

.toggle-slider {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s;
}

.toggle-switch.active .toggle-slider {
    transform: translateX(26px);
}

.quality-score {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 1rem;
    padding: 10px;
    background: rgba(21, 24, 38, 0.5);
    border-radius: 8px;
}

.score-bar {
    flex-grow: 1;
    height: 8px;
    background: var(--panel-border);
    border-radius: 4px;
    overflow: hidden;
}

.score-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--error-color), var(--warning-color), var(--success-color));
    width: 0%;
    transition: width 0.5s ease;
}

.score-text {
    font-weight: bold;
    min-width: 40px;
    text-align: right;
}

.live-activity {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: rgba(21, 24, 38, 0.5);
    border-radius: 8px;
    margin-top: 1rem;
}

.activity-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.activity-value {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--primary-accent);
}

.activity-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.loading-indicator {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 4px solid rgba(155, 89, 182, 0.3);
    border-top: 4px solid var(--primary-accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

.loading-active {
    display: block;
}

.home-btn {
    background: linear-gradient(45deg, var(--primary-accent), var(--secondary-accent));
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
    text-decoration: none;
    margin-bottom: 1rem;
}

.home-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(155, 89, 182, .6);
}

.page-content {
    max-width: 900px;
    margin: 0 auto;
    padding: 1.5rem;
    width: 100%;
}

.page-header {
    text-align: center;
    margin-bottom: 2rem;
}

.page-header h1 {
    color: var(--primary-accent);
    font-size: 2.5rem;
    margin-bottom: 1rem;
    background: linear-gradient(45deg, var(--primary-accent), var(--secondary-accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-header p {
    color: var(--text-muted);
    font-size: 1.2rem;
    max-width: 700px;
    margin: 0 auto;
    line-height: 1.6;
}

/* Ad banner content styling */
.ad-content {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

/* Centered ad banner for first screenshot */
.centered-ad {
    display: flex;
    justify-content: center;
    margin: 1rem 0;
}

/* Small ad banner for content section */
.ad-banner-small-content {
    display: block;
    width: 100%;
    max-width: 468px;
    height: 60px;
    margin: 1.5rem auto;
    background: rgba(21, 24, 38, 0.5);
    border: 1px dashed var(--panel-border);
    border-radius: 8px;
    overflow: hidden;
}

/* Mobile responsive fixes */
@media (max-width: 768px) {
    .os-header {
        padding: 6px 12px;
    }
    
    .logo-container h2 {
        font-size: 1rem !important;
    }
    
    .logo-container span {
        font-size: 0.6em !important;
    }
    
    .main-panel {
        width: 100%;
        padding: 0 0.5rem;
    }
    
    .input-card, .output-card {
        padding: 1rem;
        border-radius: 12px;
    }
    
    #prompt-canvas {
        min-height: 120px;
        font-size: 1rem;
    }
    
    .generate-btn {
        padding: 10px 18px;
        font-size: 1rem;
    }
    
    .icon-btn {
        width: 42px;
        height: 42px;
        font-size: 1.1rem;
    }
    
    .top-generate-container {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .page-header h1 {
        font-size: 2rem;
    }
    
    .page-header p {
        font-size: 1rem;
    }
    
    .ad-banner-header-desktop {
        height: 50px;
        max-width: 320px;
    }
    
    .ad-banner-small-content {
        height: 50px;
        max-width: 320px;
        margin: 1rem auto;
    }
    
    .footer-action-bar {
        padding: 2px 0;
    }
    
    .footer-info {
        font-size: 0.7rem;
        flex-direction: column;
        gap: 5px;
    }
    
    .seo-content {
        padding: 1rem;
    }
    
    .faq-item {
        padding: 1rem;
    }
}

/* Fix for menu button visibility */
#menu-btn {
    position: relative;
    z-index: 101;
    color: var(--text-color) !important;
    background: rgba(155, 89, 182, 0.1) !important;
    border: 1px solid rgba(155, 89, 182, 0.3) !important;
}

#menu-btn:hover {
    background: rgba(155, 89, 182, 0.3) !important;
    color: var(--primary-accent) !important;
}

/* Fix for input card alignment on mobile */
@media (max-width: 768px) {
    .input-card {
        margin-bottom: 1rem;
    }
    
    .textarea-wrapper {
        display: flex;
        flex-direction: column;
        align-items: stretch;
    }
    
    #prompt-canvas {
        width: 100%;
        box-sizing: border-box;
    }
    
    .loading-indicator {
        top: 40%;
    }
    
    .top-generate-container {
        margin-top: 0.8rem;
    }
    
    .input-options {
        margin-top: 0.5rem;
        justify-content: flex-start;
    }
    
    .auto-correct-label {
        font-size: 0.8rem;
    }
}

/* Ensure ad banners are properly centered */
.ad-banner-header-desktop,
.ad-banner-small-content {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

/* Wider content for larger screens */
@media (min-width: 1200px) {
    .main-panel {
        max-width: 1000px;
    }
    
    .seo-content {
        max-width: 1000px;
    }
    
    .page-content {
        max-width: 1000px;
    }
}

/* Improve readability for larger screens */
@media (min-width: 1200px) {
    .seo-content p,
    .seo-content li {
        font-size: 1.1rem;
    }
    
    #prompt-canvas {
        font-size: 1.2rem;
    }
    
    #output-preview {
        font-size: 1.1rem;
    }
}

/* Enhanced ad banner styling */
.ad-banner-small-content {
    margin: 2rem auto;
}

/* Ensure proper spacing between sections */
.seo-content h3 {
    margin-top: 2rem;
}

/* Style for FAQ section */
.faq-section {
    margin-top: 2rem;
}

.faq-item {
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    background: rgba(21, 24, 38, 0.5);
    border-radius: 8px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.faq-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(155, 89, 182, 0.3);
}

.faq-item h4 {
    color: var(--primary-accent);
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.faq-item p {
    color: var(--text-muted);
    line-height: 1.6;
}

/* Modal styles - FIXED for close buttons */
.modal-overlay, .history-panel {
    transition: transform .3s ease, opacity .3s ease;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .8);
    backdrop-filter: blur(10px);
    z-index: 5000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    max-width: 600px;
    width: 90%;
    background: var(--bg-color);
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 0 60px var(--glow-color);
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    animation: modalSlideIn 0.3s ease;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    position: relative;
}

.modal-body {
    overflow-y: auto;
    padding-right: 10px;
}

.category-list .category-title {
    font-weight: 700;
    color: var(--primary-accent);
    margin-top: 1rem;
    padding-bottom: .5rem;
    border-bottom: 1px solid var(--panel-border);
    text-align: left;
}

.template-item, .category-item {
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color .2s;
    text-align: left;
}

.template-item:hover, .category-item:hover {
    background: rgba(155, 89, 182, 0.2);
    color: var(--primary-accent);
}

.history-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 300px;
    max-width: 80vw;
    background: #0a0c14;
    border-left: 1px solid var(--panel-border);
    transform: translateX(100%);
    z-index: 6000;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.history-panel.active {
    transform: translateX(0);
}

.footer-info {
    text-align: center;
    font-size: .8rem;
    color: var(--text-muted);
    padding: 5px 0;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
}

.footer-info span {
    margin: 0 5px;
}

.footer-info a {
    color: var(--primary-accent);
    text-decoration: none;
    margin: 0 5px;
    transition: color 0.3s ease;
}

.footer-info a:hover {
    text-decoration: underline;
    color: var(--secondary-accent);
}

#token-count-display {
    font-family: var(--font-mono);
    font-size: .9rem;
    color: var(--text-muted);
    margin-top: 1rem;
    text-align: right;
    opacity: 0;
    transition: opacity .3s ease;
}

#token-count-display.visible {
    opacity: 1;
}

.input-options {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: .5rem 0 0;
}

.auto-correct-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: .9rem;
    color: var(--text-muted);
    transition: color 0.3s ease;
}

.auto-correct-label:hover {
    color: var(--text-color);
}

.auto-correct-label input {
    margin-right: 8px;
    accent-color: var(--primary-accent);
}

.json-output {
    background-color: rgba(0, 0, 0, .3);
    border-radius: 8px;
    padding: 1rem;
    font-family: var(--font-mono);
    white-space: pre-wrap;
    overflow-x: auto;
    font-size: 0.9rem;
}

.seo-content {
    max-width: 900px;
    margin: 2rem auto;
    padding: 2rem;
    background: var(--panel-bg);
    border-radius: 16px;
    border: 1px solid var(--panel-border);
    width: 100%;
}

.seo-content h2, .seo-content h3 {
    color: var(--primary-accent);
    margin-bottom: 1rem;
}

.seo-content h4 {
    color: var(--text-color);
    margin-top: 1.5rem;
    margin-bottom: .5rem;
    font-size: 1.1rem;
}

.seo-content p, .seo-content li {
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: .8rem;
    font-size: 1rem;
}

.seo-content ul, .seo-content ol {
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}

.ad-desktop {
    display: none;
}

.ad-mobile {
    display: block;
}

@media (min-width: 768px) {
    .ad-desktop {
        display: block;
    }

    .ad-mobile {
        display: none;
    }
}

.conversion-btn {
    flex-grow: 1;
    background: 0 0;
    border: 1px solid var(--panel-border);
    color: var(--text-muted);
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: all .2s ease;
    font-family: var(--font-main);
    font-weight: 600;
    font-size: 0.9rem;
}

.conversion-btn:hover {
    background-color: var(--panel-border);
    color: var(--text-color);
    transform: scale(1.05);
}

#conversion-buttons {
    display: none;
    flex-wrap: wrap;
    gap: .5rem;
    margin-top: 1rem;
}

.footer-action-bar {
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 4px 0;
}

.generate-btn {
    background: linear-gradient(45deg, var(--primary-accent), var(--secondary-accent));
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all .3s ease;
    box-shadow: 0 4px 20px rgba(155, 89, 182, .4);
}

.generate-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 25px rgba(155, 89, 182, .6);
}

.generate-btn:active {
    transform: translateY(-1px);
}

.icon-btn {
    background: 0 0;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.2rem;
    transition: all .2s ease;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    visibility: visible !important;
    opacity: 1 !important;
}

.icon-btn:hover {
    background: rgba(155, 89, 182, 0.2);
    color: var(--primary-accent);
    transform: scale(1.1);
}

/* Modal close button specific styling - FIXED */
.modal-close-btn {
    background: rgba(155, 89, 182, 0.1) !important;
    color: var(--text-muted) !important;
    border: 1px solid rgba(155, 89, 182, 0.3) !important;
    font-size: 1.5rem !important;
    width: 36px !important;
    height: 36px !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    pointer-events: auto !important;
    z-index: 10 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 8px !important;
}

.modal-close-btn:hover {
    background: rgba(155, 89, 182, 0.2) !important;
    color: var(--primary-accent) !important;
    transform: scale(1.1) !important;
}

/* Back button styling for modals - FIXED */
.modal-back-btn {
    background: rgba(155, 89, 182, 0.1) !important;
    color: var(--text-muted) !important;
    border: 1px solid rgba(155, 89, 182, 0.3) !important;
    font-size: 1.2rem !important;
    width: 36px !important;
    height: 36px !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    pointer-events: auto !important;
    z-index: 10 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 8px !important;
    margin-right: 10px !important;
}

.modal-back-btn:hover {
    background: rgba(155, 89, 182, 0.2) !important;
    color: var(--primary-accent) !important;
    transform: scale(1.1) !important;
}

/* Mobile Responsive Improvements */
@media (max-width: 768px) {
    .os-main {
        padding: 0.5rem;
    }
    
    .page-content {
        padding: 1rem;
    }
    
    .input-card, .output-card {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .seo-content {
        padding: 1rem;
    }
    
    .main-panel {
        gap: 0.8rem;
    }
    
    .top-generate-container {
        margin-top: 0.5rem;
    }
    
    .generate-btn {
        padding: 10px 20px;
        font-size: 1rem;
    }
    
    .icon-btn {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    .conversion-btn {
        font-size: 0.8rem;
        padding: 6px;
    }
    
    #conversion-buttons {
        gap: 0.3rem;
    }
    
    .footer-action-bar {
        padding: 2px 0;
    }
    
    .footer-info {
        font-size: 0.7rem;
        flex-direction: column;
        gap: 5px;
    }
    
    .faq-item {
        padding: 1rem;
    }
    
    .faq-item h4 {
        font-size: 1rem;
    }
    
    .faq-item p {
        font-size: 0.9rem;
    }
}

/* Extra Small Mobile Devices */
@media (max-width: 480px) {
    .os-header {
        padding: 4px 8px;
    }
    
    .logo-container h2 {
        font-size: 0.9rem !important;
    }
    
    .logo-container span {
        font-size: 0.5em !important;
    }
    
    .logo {
        width: 32px;
        height: 32px;
    }
    
    .install-button {
        padding: 4px 8px;
        font-size: 0.8rem;
    }
    
    .main-panel {
        padding: 0 0.3rem;
    }
    
    .input-card, .output-card {
        padding: 0.8rem;
    }
    
    #prompt-canvas {
        min-height: 100px;
        font-size: 0.9rem;
    }
    
    .top-generate-container {
        gap: 0.3rem;
    }
    
    .generate-btn {
        padding: 8px 16px;
        font-size: 0.9rem;
    }
    
    .icon-btn {
        width: 36px;
        height: 36px;
        font-size: 0.9rem;
    }
    
    .conversion-btn {
        font-size: 0.7rem;
        padding: 5px;
    }
    
    .seo-content {
        padding: 0.8rem;
    }
    
    .seo-content h2 {
        font-size: 1.4rem;
    }
    
    .seo-content h3 {
        font-size: 1.2rem;
    }
    
    .seo-content h4 {
        font-size: 1.1rem;
    }
    
    .seo-content p, .seo-content li {
        font-size: 0.9rem;
    }
    
    .faq-item {
        padding: 0.8rem;
    }
    
    .faq-item h4 {
        font-size: 0.95rem;
    }
    
    .faq-item p {
        font-size: 0.85rem;
    }
}

/* Medium Tablets */
@media (min-width: 769px) and (max-width: 1024px) {
    .page-content {
        padding: 1.2rem;
    }
    
    .input-card, .output-card {
        padding: 1.2rem;
    }
    
    .seo-content {
        padding: 1.5rem;
    }
    
    #prompt-canvas {
        font-size: 1.05rem;
    }
    
    .generate-btn {
        padding: 11px 22px;
        font-size: 1.05rem;
    }
    
    .icon-btn {
        width: 44px;
        height: 44px;
        font-size: 1.1rem;
    }
}

/* Large Desktops */
@media (min-width: 1200px) {
    .page-content {
        padding: 1.8rem;
    }
    
    .input-card, .output-card {
        padding: 1.8rem;
    }
    
    .seo-content {
        padding: 2.5rem;
    }
    
    #prompt-canvas {
        font-size: 1.15rem;
    }
    
    .generate-btn {
        padding: 14px 28px;
        font-size: 1.15rem;
    }
    
    .icon-btn {
        width: 52px;
        height: 52px;
        font-size: 1.3rem;
    }
}

/* Ad Container Improvements */
.ad-container {
    isolation: isolate;
}

.ad-container iframe {
    border-radius: 8px;
    overflow: hidden;
}

/* Ad Loading State */
.ad-container.loading {
    background: linear-gradient(45deg, rgba(21, 24, 38, 0.3), rgba(155, 89, 182, 0.1));
    background-size: 200% 200%;
    animation: adPulse 2s ease-in-out infinite;
}

@keyframes adPulse {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

/* Remove loading animation when ad is ready */
.ad-container.ready {
    animation: none;
    background: rgba(21, 24, 38, 0.5);
}

/* Ad container border styling */
.ad-container {
    border: 1px solid var(--panel-border);
    border-style: dashed;
}

/* Make ads more prominent */
.ad-container:hover {
    border-style: solid;
    border-color: var(--primary-accent);
}

/* Fix for potential z-index conflicts */
.ad-container {
    position: relative;
}

/* Add subtle background to ads for better visibility */
.ad-container {
    background: rgba(21, 24, 38, 0.3);
}

/* Fix for responsive ad switching */
@media (max-width: 767px) {
    .ad-container.ad-468 {
        max-width: 100%;
        height: auto;
        aspect-ratio: 7.8/1;
    }
}

/* Ensure ads maintain aspect ratio */
.ad-container {
    aspect-ratio: auto;
}

/* Add margin for SEO content sections */
.seo-content section {
    margin-bottom: 3rem;
}

/* Style for blog posts */
.blog-post {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: rgba(21, 24, 38, 0.5);
    border-radius: 8px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.blog-post:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(155, 89, 182, 0.3);
}

.blog-post h4 {
    color: var(--primary-accent);
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.blog-post p {
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 1rem;
}

.read-more {
    color: var(--primary-accent);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.read-more:hover {
    color: var(--secondary-accent);
    text-decoration: underline;
}

/* Style for docs content */
.docs-content h4 {
    color: var(--text-color);
    margin-top: 1.5rem;
    margin-bottom: 0.8rem;
    font-size: 1.1rem;
}

.docs-content ol, .docs-content ul {
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}

.docs-content li {
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 0.5rem;
}

/* Improve modal scrolling */
.modal-body {
    scrollbar-width: thin;
    scrollbar-color: var(--panel-border) transparent;
}

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

.modal-body::-webkit-scrollbar-track {
    background: transparent;
}

.modal-body::-webkit-scrollbar-thumb {
    background-color: var(--panel-border);
    border-radius: 3px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background-color: var(--primary-accent);
}

/* Fix for modal close button */
.modal-header .icon-btn {
    background: rgba(155, 89, 182, 0.1);
    color: var(--text-muted);
}

.modal-header .icon-btn:hover {
    background: rgba(155, 89, 182, 0.2);
    color: var(--primary-accent);
}

/* Improve history panel scrolling */
.history-panel {
    scrollbar-width: thin;
    scrollbar-color: var(--panel-border) transparent;
}

.history-panel::-webkit-scrollbar {
    width: 6px;
}

.history-panel::-webkit-scrollbar-track {
    background: transparent;
}

.history-panel::-webkit-scrollbar-thumb {
    background-color: var(--panel-border);
    border-radius: 3px;
}

.history-panel::-webkit-scrollbar-thumb:hover {
    background-color: var(--primary-accent);
}

/* Ensure modal close buttons are clickable */
.modal-close-btn {
    pointer-events: auto !important;
    z-index: 10 !important;
}

/* Prevent content from being selectable in modals on mobile */
@media (max-width: 768px) {
    .modal-body {
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
    }
    
    .modal-body * {
        -webkit-user-select: text;
        -moz-user-select: text;
        -ms-user-select: text;
        user-select: text;
    }
}

/* Ensure search input is visible */
#template-search-input {
    background: var(--panel-bg) !important;
    color: var(--text-color) !important;
    border: 1px solid var(--panel-border) !important;
    padding: 10px !important;
    border-radius: 8px !important;
    width: 100% !important;
    margin-bottom: 1rem !important;
    font-size: 1rem !important;
}

#template-search-input:focus {
    outline: 2px solid var(--primary-accent) !important;
    outline-offset: 2px !important;
}

/* Fix modal header spacing */
.modal-header {
    padding: 0 0 1rem 0;
}

/* Add swipe gesture for mobile modals */
@media (max-width: 768px) {
    .modal-overlay {
        touch-action: pan-y;
    }
    
    .modal-content {
        touch-action: pan-y;
    }
}

/* Ensure modal content doesn't overflow on mobile */
@media (max-width: 768px) {
    .modal-content {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Fix for menu dropdown on mobile */
@media (max-width: 768px) {
    .menu-dropdown {
        right: -10px;
        min-width: 180px;
    }
    
    .menu-item {
        padding: 10px 12px;
    }
}

/* Fix for theme toggle on mobile */
@media (max-width: 480px) {
    .toggle-switch {
        width: 40px;
        height: 20px;
    }
    
    .toggle-slider {
        width: 16px;
        height: 16px;
        top: 2px;
        left: 2px;
    }
    
    .toggle-switch.active .toggle-slider {
        transform: translateX(20px);
    }
}

/* Custom Modal Styles */
.custom-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    z-index: 7000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.custom-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.custom-modal-content {
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    background: var(--bg-color);
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    box-shadow: 0 0 60px var(--glow-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.custom-modal-overlay.active .custom-modal-content {
    transform: scale(1);
}

.custom-modal-header {
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--panel-border);
    background: var(--panel-bg);
    position: relative;
    z-index: 10;
}

.custom-modal-back-btn {
    background: rgba(155, 89, 182, 0.1);
    border: 1px solid rgba(155, 89, 182, 0.3);
    color: var(--text-muted);
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-right: 1rem;
    flex-shrink: 0;
}

.custom-modal-back-btn:hover {
    background: rgba(155, 89, 182, 0.2);
    color: var(--primary-accent);
    transform: scale(1.1);
}

.custom-modal-title {
    color: var(--text-color);
    font-size: 1.5rem;
    font-weight: 600;
    flex-grow: 1;
    text-align: center;
    margin: 0;
}

.custom-modal-close-btn {
    background: rgba(155, 89, 182, 0.1);
    border: 1px solid rgba(155, 89, 182, 0.3);
    color: var(--text-muted);
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-left: 1rem;
    flex-shrink: 0;
}

.custom-modal-close-btn:hover {
    background: rgba(155, 89, 182, 0.2);
    color: var(--primary-accent);
    transform: scale(1.1);
}

.custom-modal-body {
    flex-grow: 1;
    overflow-y: auto;
    padding: 1.5rem;
    scrollbar-width: thin;
    scrollbar-color: var(--panel-border) transparent;
}

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

.custom-modal-body::-webkit-scrollbar-track {
    background: transparent;
}

.custom-modal-body::-webkit-scrollbar-thumb {
    background-color: var(--panel-border);
    border-radius: 4px;
}

.custom-modal-body::-webkit-scrollbar-thumb:hover {
    background-color: var(--primary-accent);
}

/* Custom modal responsive styles */
@media (max-width: 768px) {
    .custom-modal-content {
        width: 95%;
        max-height: 95vh;
    }
    
    .custom-modal-header {
        padding: 0.8rem 1rem;
    }
    
    .custom-modal-back-btn,
    .custom-modal-close-btn {
        width: 36px;
        height: 36px;
    }
    
    .custom-modal-title {
        font-size: 1.2rem;
    }
    
    .custom-modal-body {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .custom-modal-content {
        width: 98%;
        border-radius: 12px;
    }
    
    .custom-modal-header {
        padding: 0.6rem 0.8rem;
    }
    
    .custom-modal-back-btn,
    .custom-modal-close-btn {
        width: 32px;
        height: 32px;
    }
    
    .custom-modal-title {
        font-size: 1rem;
    }
    
    .custom-modal-body {
        padding: 0.8rem;
    }
}

/* Custom modal animations */
@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.custom-modal-overlay.active .custom-modal-content {
    animation: modalSlideIn 0.3s ease forwards;
}

/* Ensure custom modal is above other elements */
.custom-modal-overlay {
    z-index: 8000;
}

/* Fix for potential z-index conflicts */
.modal-overlay {
    z-index: 5000;
}

.history-panel {
    z-index: 6000;
}

.custom-modal-overlay {
    z-index: 7000;
}

/* Custom modal content styling */
.custom-modal-body .privacy-policy,
.custom-modal-body .about-us {
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
}

.custom-modal-body .privacy-policy h2,
.custom-modal-body .about-us h2 {
    text-align: left;
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.custom-modal-body .privacy-policy h3,
.custom-modal-body .about-us h3 {
    margin-top: 1.5rem;
    margin-bottom: 0.8rem;
    font-size: 1.2rem;
}

.custom-modal-body .privacy-policy h4,
.custom-modal-body .about-us h4 {
    margin-top: 1.2rem;
    margin-bottom: 0.6rem;
    font-size: 1rem;
}

.custom-modal-body .privacy-policy p,
.custom-modal-body .about-us p {
    margin-bottom: 0.8rem;
    line-height: 1.6;
}

.custom-modal-body .company-info,
.custom-modal-body .mission,
.custom-modal-body .product,
.custom-modal-body .team,
.custom-modal-body .contact,
.custom-modal-body .future {
    background: rgba(21, 24, 38, 0.3);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.custom-modal-body .leader {
    background: rgba(155, 89, 182, 0.1);
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
}

/* Template modal specific improvements */
#template-modal .modal-header {
    padding: 0;
    margin-bottom: 1rem;
}

#template-modal .modal-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-color);
    text-align: center;
    flex-grow: 1;
    margin: 0;
}

#template-modal .modal-body {
    padding: 0;
    overflow-y: auto;
}

#template-search-input {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--panel-border);
    background: var(--panel-bg);
    color: var(--text-color);
    font-size: 1rem;
    margin-bottom: 1rem;
    transition: border-color 0.3s ease;
}

#template-search-input:focus {
    outline: none;
    border-color: var(--primary-accent);
    box-shadow: 0 0 0 2px rgba(155, 89, 182, 0.2);
}

/* Template modal responsive fixes */
@media (max-width: 768px) {
    #template-modal .modal-title {
        font-size: 1.2rem;
    }
    
    #template-search-input {
        font-size: 0.9rem;
        padding: 10px;
    }
}

@media (max-width: 480px) {
    #template-modal .modal-title {
        font-size: 1rem;
    }
    
    #template-search-input {
        font-size: 0.85rem;
        padding: 8px;
    }
    
    #template-modal .modal-back-btn,
    #template-modal .modal-close-btn {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
    }
}

/* Performance optimizations */
.lazy {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lazy.loaded {
    opacity: 1;
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus indicators for better accessibility */
button:focus,
input:focus,
textarea:focus,
a:focus {
    outline: 2px solid var(--primary-accent);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --panel-border: rgba(255, 255, 255, 0.5);
        --primary-accent: #0066cc;
        --secondary-accent: #004499;
    }
    
    .ad-container {
        border: 2px solid var(--panel-border);
    }
}

/* Print styles */
@media print {
    .os-header,
    .os-footer,
    .ad-container,
    .modal-overlay,
    .history-panel,
    .icon-btn,
    .conversion-btn,
    .generate-btn {
        display: none !important;
    }
    
    .os-main {
        padding: 0;
    }
    
    .input-card,
    .output-card {
        border: 1px solid #000;
        box-shadow: none;
    }
    
    body {
        background: white;
        color: black;
    }
}