:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #818cf8;
    --secondary: #10b981;
    --accent: #f59e0b;
    --danger: #ef4444;
    --dark: #1e1b4b;
    --gray-900: #111827;
    --gray-800: #1f2937;
    --gray-700: #374151;
    --gray-600: #4b5563;
    --gray-500: #6b7280;
    --gray-400: #9ca3af;
    --gray-300: #d1d5db;
    --gray-200: #e5e7eb;
    --gray-100: #f3f4f6;
    --gray-50: #f9fafb;
    --white: #ffffff;
    --radius-sm: 6px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
    --shadow-md: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
    --shadow-lg: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1);
    --shadow-primary: 0 4px 14px rgba(79,70,229,0.39);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { font-family: var(--font); background: var(--gray-50); color: var(--gray-800); line-height: 1.6; }

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

/* Header */
.main-header { background: var(--white); border-bottom: 1px solid var(--gray-200); position: sticky; top: 0; z-index: 100; }
.main-header .container { display: flex; align-items: center; justify-content: space-between; height: 70px; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--dark); font-weight: 800; font-size: 1.35rem; }
.logo-icon { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; background: linear-gradient(135deg, var(--primary), var(--primary-light)); border-radius: var(--radius); color: var(--white); }
.logo-text { background: linear-gradient(135deg, var(--primary), var(--primary-light)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }

.main-nav { display: flex; gap: 32px; }
.main-nav a { text-decoration: none; color: var(--gray-600); font-weight: 500; font-size: 0.95rem; transition: color 0.2s; position: relative; }
.main-nav a:hover, .main-nav a.active { color: var(--primary); }
.main-nav a.active::after { content: ''; position: absolute; bottom: -24px; left: 0; right: 0; height: 2px; background: var(--primary); }

.mobile-toggle { display: none; background: none; border: none; cursor: pointer; color: var(--gray-700); }

/* Hero */
.hero { background: linear-gradient(135deg, var(--dark) 0%, #312e81 50%, var(--primary) 100%); color: var(--white); padding: 80px 0 100px; text-align: center; position: relative; overflow: hidden; }
.hero::before { content: ''; position: absolute; top: -50%; left: -50%; width: 200%; height: 200%; background: radial-gradient(circle, rgba(255,255,255,0.08) 1px, transparent 1px); background-size: 40px 40px; opacity: 0.5; }
.hero .container { position: relative; z-index: 1; }
.hero h1 { font-size: 3rem; font-weight: 800; margin-bottom: 16px; line-height: 1.15; }
.hero p { font-size: 1.2rem; color: var(--primary-light); max-width: 600px; margin: 0 auto 32px; }
.hero-search { max-width: 560px; margin: 0 auto; position: relative; }
.hero-search input { width: 100%; padding: 16px 24px; border-radius: var(--radius-xl); border: none; font-size: 1rem; box-shadow: var(--shadow-lg); outline: none; }
.hero-search button { position: absolute; right: 6px; top: 6px; bottom: 6px; background: var(--primary); color: var(--white); border: none; border-radius: var(--radius-lg); padding: 0 24px; font-weight: 600; cursor: pointer; transition: background 0.2s; }
.hero-search button:hover { background: var(--primary-dark); }

/* Stats bar */
.stats-bar { background: var(--white); padding: 24px 0; margin-top: -40px; position: relative; z-index: 2; border-radius: var(--radius-lg); box-shadow: var(--shadow-md); max-width: 900px; margin-left: auto; margin-right: auto; }
.stats-bar .container { display: flex; justify-content: space-around; text-align: center; }
.stat-item h3 { font-size: 1.75rem; font-weight: 800; color: var(--primary); }
.stat-item p { color: var(--gray-500); font-size: 0.9rem; }

/* Section titles */
.section-title { text-align: center; margin-bottom: 48px; }
.section-title h2 { font-size: 2rem; font-weight: 700; color: var(--dark); margin-bottom: 8px; }
.section-title p { color: var(--gray-500); font-size: 1.05rem; }

/* Tools Grid */
.tools-section { padding: 80px 0; }
.tools-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 24px; }
.tool-card { background: var(--white); border-radius: var(--radius-lg); padding: 32px; text-decoration: none; color: var(--gray-800); transition: all 0.3s ease; border: 1px solid var(--gray-200); display: flex; flex-direction: column; }
.tool-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--primary-light); }
.tool-icon { width: 56px; height: 56px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; margin-bottom: 20px; background: linear-gradient(135deg, var(--primary-light), var(--primary)); color: var(--white); }
.tool-icon svg { width: 28px; height: 28px; }
.tool-card h3 { font-size: 1.15rem; font-weight: 700; margin-bottom: 8px; }
.tool-card p { color: var(--gray-500); font-size: 0.9rem; flex: 1; }
.tool-card .tool-meta { display: flex; align-items: center; gap: 8px; margin-top: 16px; font-size: 0.8rem; color: var(--primary); font-weight: 600; }

/* Categories */
.categories { padding: 60px 0; background: var(--white); }
.category-tabs { display: flex; gap: 12px; justify-content: center; margin-bottom: 40px; flex-wrap: wrap; }
.category-tab { padding: 10px 24px; border-radius: var(--radius-xl); border: 1px solid var(--gray-300); background: var(--white); color: var(--gray-600); font-weight: 500; cursor: pointer; transition: all 0.2s; text-decoration: none; }
.category-tab:hover, .category-tab.active { background: var(--primary); color: var(--white); border-color: var(--primary); }

/* Tool Page */
.tool-page { padding: 60px 0; }
.tool-page-header { text-align: center; margin-bottom: 40px; }
.tool-page-header h1 { font-size: 2rem; font-weight: 800; color: var(--dark); margin-bottom: 8px; }
.tool-page-header p { color: var(--gray-500); }

.tool-layout { display: grid; grid-template-columns: 1fr 300px; gap: 32px; }
.tool-main { background: var(--white); border-radius: var(--radius-lg); padding: 32px; border: 1px solid var(--gray-200); }
.tool-sidebar { display: flex; flex-direction: column; gap: 24px; }

.text-area { width: 100%; min-height: 300px; padding: 20px; border: 2px solid var(--gray-200); border-radius: var(--radius); font-family: var(--font); font-size: 1rem; resize: vertical; transition: border-color 0.2s; }
.text-area:focus { outline: none; border-color: var(--primary); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 28px; border-radius: var(--radius); font-weight: 600; font-size: 0.95rem; cursor: pointer; transition: all 0.2s; border: none; text-decoration: none; }
.btn-primary { background: var(--primary); color: var(--white); box-shadow: var(--shadow-primary); }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn-secondary { background: var(--gray-100); color: var(--gray-700); border: 1px solid var(--gray-300); }
.btn-secondary:hover { background: var(--gray-200); }
.btn-danger { background: var(--danger); color: var(--white); }
.btn-sm { padding: 8px 16px; font-size: 0.85rem; }
.btn-lg { padding: 16px 36px; font-size: 1.05rem; }

.results-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 16px; margin-top: 24px; }
.result-card { background: var(--gray-50); border-radius: var(--radius); padding: 20px; text-align: center; border: 1px solid var(--gray-200); }
.result-card h4 { font-size: 1.75rem; font-weight: 800; color: var(--primary); margin-bottom: 4px; }
.result-card p { font-size: 0.85rem; color: var(--gray-500); font-weight: 500; }

/* Sidebar */
.sidebar-card { background: var(--white); border-radius: var(--radius-lg); padding: 24px; border: 1px solid var(--gray-200); }
.sidebar-card h3 { font-size: 1.05rem; font-weight: 700; margin-bottom: 16px; color: var(--dark); }
.sidebar-card a { display: block; padding: 10px 0; color: var(--gray-600); text-decoration: none; border-bottom: 1px solid var(--gray-100); font-size: 0.9rem; transition: color 0.2s; }
.sidebar-card a:hover { color: var(--primary); }
.sidebar-card a:last-child { border-bottom: none; }

/* Ads */
.ads-container { background: var(--gray-100); padding: 16px; text-align: center; }
.ads-container.header-ads { margin-bottom: 0; }
.ads-container.footer-ads { margin-top: 0; }
.ads-container.between-ads { margin: 32px 0; }
.popup-ad { position: fixed; bottom: 20px; right: 20px; width: 320px; background: var(--white); border-radius: var(--radius-lg); padding: 16px; box-shadow: var(--shadow-lg); z-index: 999; border: 1px solid var(--gray-200); }
.popup-close { position: absolute; top: 8px; right: 12px; background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--gray-400); }

/* Footer */
.main-footer { background: var(--dark); color: var(--gray-300); padding: 60px 0 0; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 40px; margin-bottom: 40px; }
.footer-brand .logo { color: var(--white); margin-bottom: 12px; }
.footer-brand p { color: var(--gray-400); font-size: 0.9rem; margin-bottom: 20px; }
.social-links { display: flex; gap: 12px; }
.social-links a { width: 36px; height: 36px; border-radius: var(--radius); background: rgba(255,255,255,0.1); display: flex; align-items: center; justify-content: center; color: var(--gray-300); transition: all 0.2s; text-decoration: none; }
.social-links a:hover { background: var(--primary); color: var(--white); }
.footer-links h4 { color: var(--white); font-size: 1rem; font-weight: 600; margin-bottom: 20px; }
.footer-links a { display: block; color: var(--gray-400); text-decoration: none; padding: 6px 0; font-size: 0.9rem; transition: color 0.2s; }
.footer-links a:hover { color: var(--white); }
.footer-bottom { border-top: 1px solid rgba(255,255,255,0.1); padding: 24px 0; text-align: center; font-size: 0.85rem; color: var(--gray-500); }

/* Content Pages */
.content-page { padding: 60px 0; max-width: 800px; margin: 0 auto; }
.content-page h1 { font-size: 2.25rem; font-weight: 800; margin-bottom: 24px; color: var(--dark); }
.content-page h2 { font-size: 1.5rem; font-weight: 700; margin: 32px 0 16px; color: var(--gray-800); }
.content-page p { margin-bottom: 16px; color: var(--gray-600); line-height: 1.75; }

/* Contact Form */
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 500; color: var(--gray-700); font-size: 0.9rem; }
.form-control { width: 100%; padding: 12px 16px; border: 1px solid var(--gray-300); border-radius: var(--radius); font-family: var(--font); font-size: 0.95rem; transition: border-color 0.2s; }
.form-control:focus { outline: none; border-color: var(--primary); }
textarea.form-control { resize: vertical; min-height: 120px; }

/* Alerts */
.alert { padding: 16px 20px; border-radius: var(--radius); margin-bottom: 20px; font-weight: 500; }
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.alert-info { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

/* Grammar checker results */
.grammar-result { margin-top: 24px; padding: 20px; background: var(--gray-50); border-radius: var(--radius); }
.grammar-error { padding: 12px 16px; margin-bottom: 12px; background: var(--white); border-radius: var(--radius-sm); border-left: 4px solid var(--danger); }
.grammar-warning { border-left-color: var(--accent); }
.grammar-suggestion { border-left-color: var(--secondary); }
.grammar-error strong { color: var(--danger); }

/* Responsive */
@media (max-width: 992px) {
    .tool-layout { grid-template-columns: 1fr; }
    .footer-grid { grid-template-columns: 1fr 1fr; }
    .stats-bar .container { flex-wrap: wrap; gap: 20px; }
}
@media (max-width: 768px) {
    .hero h1 { font-size: 2rem; }
    .hero p { font-size: 1rem; }
    .main-nav { display: none; position: absolute; top: 70px; left: 0; right: 0; background: var(--white); flex-direction: column; padding: 20px; border-bottom: 1px solid var(--gray-200); gap: 16px; box-shadow: var(--shadow-md); }
    .main-nav.open { display: flex; }
    .mobile-toggle { display: block; }
    .tools-grid { grid-template-columns: 1fr; }
    .footer-grid { grid-template-columns: 1fr; }
    .results-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
    .hero { padding: 50px 0 70px; }
    .hero h1 { font-size: 1.6rem; }
    .tool-page { padding: 30px 0; }
    .results-grid { grid-template-columns: 1fr; }
    .popup-ad { width: calc(100% - 40px); }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.tool-card { animation: fadeIn 0.4s ease forwards; }
.tool-card:nth-child(1) { animation-delay: 0.05s; }
.tool-card:nth-child(2) { animation-delay: 0.1s; }
.tool-card:nth-child(3) { animation-delay: 0.15s; }
.tool-card:nth-child(4) { animation-delay: 0.2s; }
.tool-card:nth-child(5) { animation-delay: 0.25s; }
.tool-card:nth-child(6) { animation-delay: 0.3s; }

/* Admin login styles inline in admin/login.php */
/* Admin panel styles in admin/assets/admin.css */
