/* Reset and Base Variables */
:root {
    --primary: #4F46E5; /* Indigo 600 */
    --primary-hover: #4338CA;
    --bg-main: #F9FAFB;
    --bg-panel: #FFFFFF;
    --text-main: #111827;
    --text-muted: #6B7280;
    --border: #E5E7EB;
    --border-hover: #D1D5DB;
    --border-focus: #4F46E5;
    --radius: 12px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.5;
}

.hidden {
    display: none !important;
}

.text-primary {
    color: var(--primary);
}

/* Header */
.header {
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 500;
    transition: color 0.2s;
}

.nav-links a:hover {
    color: var(--text-main);
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 3rem 1rem 1rem;
    max-width: 800px;
    margin: 0 auto;
}

.hero h2 {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 1rem;
    line-height: 1.2;
}

.hero p {
    font-size: 1.1rem;
    color: var(--text-muted);
}

/* Buttons */
.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.5rem 1.25rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 6px;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.icon-btn:hover {
    background: var(--border);
    color: var(--text-main);
}

/* Main App Container */
.app-container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

/* Toolbar */
.toolbar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.mode-btn {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.mode-btn:hover {
    border-color: var(--border-hover);
    color: var(--text-main);
}

.mode-btn.active {
    background: #EEF2FF;
    border-color: var(--primary);
    color: var(--primary);
}

/* Editor Grid */
.editor-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    background: var(--bg-panel);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    padding: 1px;
}

.editor-pane {
    display: flex;
    flex-direction: column;
    height: 400px;
}

.output-pane {
    background: #FAFAFA;
    border-left: 1px solid var(--border);
    border-radius: 0 var(--radius) var(--radius) 0;
}

.pane-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
}

textarea {
    flex-grow: 1;
    width: 100%;
    resize: none;
    border: none;
    padding: 1rem 1.5rem;
    font-family: inherit;
    font-size: 1rem;
    color: var(--text-main);
    background: transparent;
    outline: none;
    line-height: 1.6;
}

textarea::placeholder {
    color: #9CA3AF;
}

.pane-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-top: 1px solid transparent;
}

.right-footer {
    justify-content: flex-end;
}

#charCount {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.btn-action {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    font-size: 0.95rem;
}

.btn-action:hover {
    background: var(--primary-hover);
}

.btn-action:active {
    transform: scale(0.98);
}

/* AI Watermark */
.ai-watermark {
    font-size: 0.8rem;
    font-weight: 600;
    background: linear-gradient(90deg, #A855F7, #3B82F6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Loading State */
#loadingState {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 1rem;
    color: var(--text-muted);
}

.spinner {
    width: 30px;
    height: 30px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Toast */
.status-badge {
    background: #10B981; /* Emerald 500 */
    color: white;
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    margin-right: auto;
    margin-left: 1rem;
    font-weight: 600;
}

/* SEO Section */
.seo-section {
    background: var(--bg-panel);
    padding: 4rem 1rem;
    margin-top: 4rem;
    border-top: 1px solid var(--border);
}

.seo-content {
    max-width: 800px;
    margin: 0 auto;
}

.seo-content h2 {
    font-size: 1.875rem;
    margin-bottom: 1.5rem;
    margin-top: 2rem;
    color: var(--text-main);
}

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

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.feature {
    background: var(--bg-panel);
    padding: 2rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    transition: transform 0.2s, box-shadow 0.2s;
}

.feature:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.feature-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: #EEF2FF;
    color: var(--primary);
    border-radius: 12px;
    margin-bottom: 1rem;
}

.feature h3 {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
    color: var(--text-main);
}

.feature p {
    font-size: 1rem;
    color: var(--text-muted);
    line-height: 1.6;
}

/* Footer */
.footer {
    background: #111827; /* Gray 900 */
    color: #D1D5DB; /* Gray 300 */
    padding: 4rem 1rem 0;
    margin-top: auto;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 2rem;
    padding-bottom: 3rem;
}

.footer-logo {
    max-width: 300px;
}

.footer-logo .logo h2 {
    color: white;
}

.footer-logo p {
    margin-top: 1rem;
    font-size: 0.95rem;
    color: #9CA3AF;
}

.footer-links {
    display: flex;
    gap: 4rem;
    flex-wrap: wrap;
}

.link-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.link-group h4 {
    color: white;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.link-group a {
    color: #9CA3AF;
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.2s;
}

.link-group a:hover {
    color: white;
}

.footer-bottom {
    text-align: center;
    padding: 1.5rem;
    border-top: 1px solid #374151; /* Gray 700 */
    color: #9CA3AF;
    font-size: 0.875rem;
}

/* Responsive */
@media (max-width: 768px) {
    .editor-grid {
        grid-template-columns: 1fr;
    }
    
    .output-pane {
        border-left: none;
        border-top: 1px solid var(--border);
        border-radius: 0 0 var(--radius) var(--radius);
    }
    
    .header {
        padding: 1rem;
    }
    
    .nav-links a {
        display: none;
    }
}

/* Ad Placeholders */
.ad-placeholder {
    background: #E5E7EB;
    border: 2px dashed #9CA3AF;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6B7280;
    font-size: 0.875rem;
    font-weight: 500;
}

.horizontal-ad {
    width: 100%;
    height: 90px;
    margin-bottom: 1.5rem;
}

/* Fullscreen Ad */
.fullscreen-ad {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.ad-content {
    background: var(--bg-panel);
    width: 90%;
    max-width: 600px;
    height: 400px;
    border-radius: var(--radius);
    padding: 2rem;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.ad-banner {
    background: #E5E7EB;
    width: 100%;
    height: 100%;
    border: 2px dashed #9CA3AF;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #4B5563;
    text-align: center;
    padding: 1rem;
}

.ad-timer {
    position: absolute;
    top: -40px;
    color: white;
    font-weight: 600;
    font-size: 1.2rem;
}

.close-ad-btn {
    position: absolute;
    top: -50px;
    right: 0;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.5);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.2s;
}

.close-ad-btn:hover {
    background: rgba(255, 255, 255, 0.4);
}

/* Uniqueness Badge */
.uniqueness-badge {
    background: #ECFDF5;
    color: #059669;
    border: 1px solid #A7F3D0;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.1);
    transition: opacity 0.5s ease;
}

/* Limit & Reward Action Group */
.action-group {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
}

.limit-counter {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
}

.btn-reward {
    background: #10B981; /* Emerald 500 */
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background 0.2s, transform 0.1s;
    font-size: 0.95rem;
}

.btn-reward:hover {
    background: #059669; /* Emerald 600 */
}

.btn-reward:active {
    transform: scale(0.98);
}
