/* Modern Design System */
:root {
    /* Color Palette - Indigo & Slate */
    --primary-50: #eef2ff;
    --primary-100: #e0e7ff;
    --primary-500: #6366f1;
    --primary-600: #4f46e5;
    --primary-700: #4338ca;
    
    --slate-50: #f8fafc;
    --slate-100: #f1f5f9;
    --slate-200: #e2e8f0;
    --slate-300: #cbd5e1;
    --slate-700: #334155;
    --slate-800: #1e293b;
    --slate-900: #0f172a;

    --success: #22c55e;
    --error: #ef4444;
    --warning: #f59e0b;

    /* Semantic Colors */
    --bg-body: var(--slate-50);
    --bg-surface: #ffffff;
    --text-main: var(--slate-800);
    --text-muted: var(--slate-700);
    --border-color: var(--slate-200);
    --primary: var(--primary-600);
    --primary-hover: var(--primary-500);

    /* Spacing & Radius */
    --radius-md: 0.5rem;   /* 8px */
    --radius-lg: 0.75rem;  /* 12px */
    --radius-full: 9999px;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Layout */
.app-container {
    max-width: 1024px;
    margin: 0 auto;
    padding: 2rem 1rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.main-header {
    text-align: center;
    margin-bottom: 2.5rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--slate-200);
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
    color: var(--primary);
}

.logo i {
    font-size: 2rem;
}

.logo h1 {
    font-size: 1.875rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    color: var(--slate-900);
}

.tagline {
    color: var(--text-muted);
    font-size: 1.125rem;
}

/* Tabs */
.tabs {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
    padding: 0.375rem;
    background: var(--slate-100);
    border-radius: var(--radius-lg);
    flex-wrap: wrap;
}

.tab-button {
    padding: 0.625rem 1.25rem;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.9375rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tab-button:hover {
    color: var(--slate-900);
    background: rgba(255, 255, 255, 0.5);
}

.tab-button.active {
    background: var(--bg-surface);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

/* Main Content Area */
.main-content {
    background: transparent;
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

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

.content-wrapper {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

/* Input/Output Sections */
.input-section, .output-section {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

label {
    display: block;
    font-weight: 600;
    color: var(--slate-700);
    margin-bottom: 0.75rem;
    font-size: 0.9375rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

label i {
    color: var(--primary);
}

textarea {
    width: 100%;
    min-height: 300px;
    padding: 1rem;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-md);
    font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
    font-size: 0.875rem;
    line-height: 1.5;
    background: var(--slate-50);
    color: var(--slate-900);
    resize: vertical;
    transition: border-color 0.2s, box-shadow 0.2s;
}

textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-100);
    background: var(--bg-surface);
}

textarea[readonly] {
    background-color: #fafafa;
    color: var(--slate-700);
}

/* Buttons */
.button-group {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.9375rem;
    cursor: pointer;
    transition: all 0.2s;
    gap: 0.5rem;
    border: 1px solid transparent;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
    box-shadow: 0 1px 2px 0 rgba(79, 70, 229, 0.3);
}

.btn-primary:hover {
    background-color: var(--primary-700);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: var(--bg-surface);
    border-color: var(--slate-300);
    color: var(--slate-700);
}

.btn-secondary:hover {
    border-color: var(--slate-400);
    background-color: var(--slate-50);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--slate-200);
    color: var(--text-muted);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-50);
}

/* Validation Status */
.validator-result {
    background: var(--slate-50);
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    min-height: 300px;
}

.validation-status {
    padding: 1rem;
    border-radius: var(--radius-md);
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    font-weight: 500;
}

.validation-status.info {
    background-color: var(--primary-50);
    color: var(--primary-700);
}

.validation-status.success {
    background-color: #dcfce7;
    color: #15803d;
}

.validation-status.error {
    background-color: #fee2e2;
    color: #b91c1c;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    z-index: 1000;
    pointer-events: none;
}

.toast {
    background: var(--slate-800);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    pointer-events: auto;
    animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    min-width: 300px;
}

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

.toast i {
    font-size: 1.25rem;
}

.toast.success i { color: var(--success); }
.toast.error i { color: var(--error); }
.toast.info i { color: var(--primary-100); }

/* Responsive */
@media (min-width: 1024px) {
    .content-wrapper {
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
    }
    
    #comparator .content-wrapper {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 768px) {
    .app-container {
        padding: 1rem;
    }

    .main-header h1 {
        font-size: 1.5rem;
    }

    .tabs {
        overflow-x: auto;
        justify-content: flex-start;
        padding: 0.5rem;
        flex-wrap: nowrap;
    }

    .tab-button {
        flex-shrink: 0;
    }
}

/* Ad Containers */
.ad-container {
    background: var(--slate-100);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin: 2rem 0;
    text-align: center;
    display: none;
    min-height: 100px;
}

/* Keyboard Shortcuts */
.keyboard-shortcuts {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.keyboard-shortcuts h4 {
    margin-bottom: 1.5rem;
    color: var(--text-muted);
}

.keyboard-shortcuts ul {
    list-style: none;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.keyboard-shortcuts li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

kbd {
    background: var(--bg-surface);
    border: 1px solid var(--slate-200);
    border-radius: 4px;
    padding: 0.125rem 0.375rem;
    font-family: inherit;
    font-size: 0.75rem;
    box-shadow: 0 1px 0 var(--slate-200);
}

/* History Styles */
.history-section {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
}

.history-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-list {
    max-height: 600px;
    overflow-y: auto;
}

.history-item {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--slate-100);
    transition: background 0.2s;
}

.history-item:last-child {
    border-bottom: none;
}

.history-item:hover {
    background: var(--slate-50);
}

.history-meta {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.history-preview {
    font-family: monospace;
    font-size: 0.875rem;
    color: var(--slate-700);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}