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

:root {
    --primary-color: #60ae4e;
    --primary-dark: #4a8f3d;
    --secondary-color: #60ae4e;
    --background: #f9fafb;
    --surface: #ffffff;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --border: #e5e7eb;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
header {
    background: var(--primary-color);
    color: white;
    padding: 2rem 0;
    box-shadow: var(--shadow-lg);
}

header .back-home {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: white;
    text-decoration: none;
    font-weight: 600;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    transition: background 0.3s ease;
    margin-bottom: 15px;
    font-size: 0.9rem;
}

header .back-home:hover {
    background: rgba(255, 255, 255, 0.3);
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.tagline {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Ad Spaces */
.ad-space {
    margin: 2rem auto;
    text-align: center;
}

.ad-placeholder {
    display: inline-block;
    background: #f3f4f6;
    border: 2px dashed #d1d5db;
    padding: 2rem 4rem;
    color: #9ca3af;
    font-size: 0.9rem;
    border-radius: 8px;
}

/* Main Content */
main {
    padding: 2rem 0;
    min-height: calc(100vh - 400px);
}

/* Tool Navigation */
.tool-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: var(--surface);
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.nav-btn {
    padding: 0.75rem 1.25rem;
    border: 2px solid var(--border);
    background: white;
    color: var(--text-primary);
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.nav-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.nav-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Tool Sections */
.tool-section {
    display: none;
    background: var(--surface);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.tool-section.active {
    display: block;
}

.tool-section h2 {
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

/* Text Input/Output */
.text-input,
.text-output {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Courier New', monospace;
    line-height: 1.5;
    resize: vertical;
    transition: border-color 0.2s;
}

.text-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.text-output {
    background: #f9fafb;
}

/* Stats Grid (Word Counter) */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.stat-card {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 1.5rem;
    border-radius: 10px;
    text-align: center;
    box-shadow: var(--shadow);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.85rem;
    opacity: 0.9;
}

/* Button Groups */
.button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin: 1.5rem 0;
}

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

.action-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.action-btn:active {
    transform: translateY(0);
}

.action-btn.primary {
    background: var(--secondary-color);
    padding: 1rem 2rem;
    font-size: 1rem;
}

.action-btn.primary:hover {
    background: #4a8f3d;
}

/* Output Area */
.output-area {
    margin-top: 1.5rem;
}

.output-area label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.copy-btn {
    margin-top: 1rem;
    padding: 0.65rem 1.5rem;
    background: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.copy-btn:hover {
    background: #4a8f3d;
}

/* Find & Replace Controls */
.find-replace-controls,
.lorem-controls {
    margin: 1.5rem 0;
}

.control-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.find-input {
    flex: 1;
    min-width: 200px;
    padding: 0.75rem;
    border: 2px solid var(--border);
    border-radius: 6px;
    font-size: 1rem;
}

.find-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Diff Container */
.diff-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.diff-column label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.diff-output {
    background: #f9fafb;
    padding: 1rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-family: 'SF Mono', Monaco, monospace;
    white-space: pre-wrap;
    word-break: break-word;
    min-height: 100px;
    max-height: 400px;
    overflow-y: auto;
}

.diff-added {
    background: #d1fae5;
    color: #065f46;
    padding: 2px 4px;
}

.diff-removed {
    background: #fee2e2;
    color: #991b1b;
    padding: 2px 4px;
    text-decoration: line-through;
}

/* Lorem Controls */
.lorem-controls select,
.lorem-controls input[type="number"] {
    padding: 0.75rem;
    border: 2px solid var(--border);
    border-radius: 6px;
    font-size: 1rem;
    margin-left: 0.5rem;
}

.lorem-controls input[type="number"] {
    width: 100px;
}

/* Footer */
footer {
    background: var(--text-primary);
    color: white;
    padding: 2rem 0;
    margin-top: 4rem;
    text-align: center;
}

footer p {
    opacity: 0.8;
}

/* Responsive Design */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }
    
    .tool-nav {
        padding: 1rem;
    }
    
    .nav-btn {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }
    
    .diff-container {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .tool-section {
        padding: 1.5rem;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tool-section.active {
    animation: fadeIn 0.3s ease-out;
}
