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

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #64748b;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg: #f8fafc;
    --bg-card: #ffffff;
    --text: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
}

/* Dark Theme */
[data-theme="dark"] {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --bg: #0f172a;
    --bg-card: #1e293b;
    --text: #f1f5f9;
    --text-light: #94a3b8;
    --border: #334155;
    --shadow: 0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.3), 0 4px 6px -2px rgba(0,0,0,0.2);
}

[data-theme="dark"] .result-box.success {
    background: #064e3b;
    border-color: var(--success);
}

[data-theme="dark"] .result-box.error {
    background: #7f1d1d;
    border-color: var(--danger);
}

[data-theme="dark"] .favorites-section {
    background: linear-gradient(135deg, #78350f 0%, #92400e 100%);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

/* Navbar */
.navbar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text);
}

.logo-icon {
    background: var(--primary);
    color: white;
    padding: 6px 12px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 18px;
}

.logo-text {
    font-weight: 600;
    font-size: 18px;
}

.logo-img {
    height: 36px;
    width: auto;
}

/* Logo theme switching */
.logo-dark {
    display: none;
}

[data-theme="dark"] .logo-light {
    display: none;
}

[data-theme="dark"] .logo-dark {
    display: block;
}

/* Back Button (on tool pages) */
.back-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--text);
    padding: 8px 14px;
    background: var(--bg);
    border-radius: 8px;
    transition: all 0.2s;
}

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

.back-icon {
    font-size: 1.2rem;
    font-weight: bold;
}

.back-text {
    font-weight: 500;
    font-size: 0.95rem;
}

.tool-nav {
    display: flex;
    align-items: center;
    gap: 12px;
}

.tool-nav-icon {
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    padding: 8px 12px;
    border-radius: 8px;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Social Share Icons */
.social-share {
    display: flex;
    align-items: center;
    gap: 8px;
}

.social-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    color: white;
    transition: all 0.2s;
    opacity: 0.9;
}

.social-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}

.social-btn.twitter {
    background: #000;
}

.social-btn.facebook {
    background: #1877f2;
}

.social-btn.linkedin {
    background: #0a66c2;
}

.social-btn.whatsapp {
    background: #25d366;
}

.social-btn.telegram {
    background: #0088cc;
}

.lang-switcher {
    display: flex;
    gap: 5px;
    background: var(--bg);
    padding: 4px;
    border-radius: 8px;
}

.lang-switcher a {
    padding: 6px 12px;
    text-decoration: none;
    color: var(--text-light);
    font-size: 14px;
    font-weight: 500;
    border-radius: 6px;
    transition: all 0.2s;
}

.lang-switcher a.active,
.lang-switcher a:hover {
    background: var(--bg-card);
    color: var(--primary);
    box-shadow: var(--shadow);
}

/* Search Container */
.search-container {
    position: relative;
    flex: 1;
    max-width: 400px;
    margin: 0 20px;
}

.search-input {
    width: 100%;
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    background: var(--bg);
    color: var(--text);
    transition: all 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-top: 5px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: var(--shadow-lg);
}

.search-results.show {
    display: block;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    text-decoration: none;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    transition: background 0.2s;
}

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

.search-result-item:hover,
.search-result-item.active {
    background: var(--bg);
}

.search-result-icon {
    font-size: 1.2rem;
}

.search-result-name {
    font-weight: 500;
}

.search-result-category {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-left: auto;
}

.search-no-results {
    padding: 20px;
    text-align: center;
    color: var(--text-light);
}

/* Theme Toggle */
.theme-toggle {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.theme-toggle:hover {
    border-color: var(--primary);
}

.theme-icon-dark {
    display: none;
}

[data-theme="dark"] .theme-icon-light {
    display: none;
}

[data-theme="dark"] .theme-icon-dark {
    display: inline;
}

/* Language Dropdown */
.lang-dropdown {
    position: relative;
}

.lang-dropdown-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--text);
    transition: all 0.2s;
}

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

.lang-flag {
    font-size: 1.2rem;
}

.lang-code {
    font-weight: 500;
}

.lang-arrow {
    font-size: 0.7rem;
    color: var(--text-light);
    transition: transform 0.2s;
}

.lang-dropdown.open .lang-arrow {
    transform: rotate(180deg);
}

.lang-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-top: 5px;
    min-width: 180px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: var(--shadow-lg);
}

.lang-dropdown.open .lang-dropdown-menu {
    display: block;
}

.lang-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    text-decoration: none;
    color: var(--text);
    transition: background 0.2s;
}

.lang-option:hover {
    background: var(--bg);
}

.lang-option.active {
    background: var(--primary);
    color: white;
}

.lang-name {
    font-weight: 500;
    flex: 1;
}

.lang-option.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.lang-option.disabled:hover {
    background: transparent;
}

.lang-soon {
    font-size: 0.65rem;
    background: var(--text-light);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    font-weight: 600;
}

.lang-option.active .lang-soon {
    background: rgba(255,255,255,0.3);
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 40px 0;
}

/* Page Header */
.page-header {
    text-align: center;
    margin-bottom: 40px;
}

.page-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.page-header p {
    color: var(--text-light);
    font-size: 1.1rem;
}

/* Tool Grid */
.tool-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 15px;
}

.tool-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 28px 10px 12px;
    text-decoration: none;
    color: var(--text);
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.tool-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}

.tool-card-icon {
    font-size: 18px;
    line-height: 1;
}

.tool-card h3 {
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
}

.tool-card-fav {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    opacity: 0;
    transition: all 0.2s;
    color: var(--text-light);
    z-index: 10;
}

.tool-card:hover .tool-card-fav {
    opacity: 1;
}

.tool-card-fav:hover {
    transform: translateY(-50%) scale(1.2);
    color: var(--primary);
}

.tool-card-fav.active {
    opacity: 1;
    color: #f59e0b;
}

/* Mobile: Always show favorite stars */
@media (max-width: 768px) {
    .tool-card-fav {
        opacity: 1;
        color: var(--text-light);
    }

    .tool-card-fav.active {
        color: #f59e0b;
    }

    .tool-card {
        padding: 10px 33px 10px 12px; /* More space for star on mobile */
    }
}

/* Category Section */
.category-section {
    margin-bottom: 50px;
}

.category-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border);
}

/* Tool Page */
.tool-container {
    max-width: 900px;
    margin: 0 auto;
}

.tool-header {
    margin-bottom: 30px;
}

.tool-header h1 {
    font-size: 2rem;
    margin-bottom: 10px;
}

.tool-header p {
    color: var(--text-light);
}

.tool-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 30px;
    margin-bottom: 20px;
}

/* Form Elements */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

textarea,
input[type="text"],
input[type="number"],
input[type="date"],
input[type="url"],
select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s;
    background: var(--bg-card);
}

textarea:focus,
input:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
}

textarea {
    min-height: 150px;
    resize: vertical;
}

textarea.code {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 14px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

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

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

.btn-secondary {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
}

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

.btn-sm {
    padding: 8px 16px;
    font-size: 0.9rem;
}

.btn-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Result Box */
.result-box {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
}

.result-box.success {
    border-color: var(--success);
    background: #f0fdf4;
}

.result-box.error {
    border-color: var(--danger);
    background: #fef2f2;
}

.result-label {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 8px;
}

.result-value {
    font-size: 1.5rem;
    font-weight: 600;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
}

.stat-item {
    text-align: center;
    padding: 15px;
    background: var(--bg);
    border-radius: 8px;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-top: 5px;
}

/* Ad Container */
.ad-container {
    background: var(--bg);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    margin: 30px 0;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
}

/* Footer */
.footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding: 30px 0;
    text-align: center;
    color: var(--text-light);
    font-size: 0.9rem;
    margin-top: auto;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 15px;
}

.footer-links a {
    color: var(--primary);
    text-decoration: none;
    transition: opacity 0.2s;
}

.footer-links a:hover {
    opacity: 0.8;
}

.footer-brand {
    margin-bottom: 15px;
}

.footer-brand a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    transition: opacity 0.2s;
}

.footer-brand a:hover {
    opacity: 0.8;
}

.footer-copyright {
    margin: 0;
}

/* Utilities */
.text-center { text-align: center; }
.mt-20 { margin-top: 20px; }
.mb-20 { margin-bottom: 20px; }
.hidden { display: none; }

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--text);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 0.9rem;
    z-index: 1000;
    animation: slideIn 0.3s ease;
}

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

/* Favorite Tool Button */
.btn-fav {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #f59e0b;
    vertical-align: middle;
    padding: 0 5px;
    margin-right: 5px;
    transition: transform 0.2s;
}

.btn-fav:hover {
    transform: scale(1.2);
}

/* Favorites Section */
.favorites-section {
    margin-bottom: 40px;
    padding: 20px;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-radius: var(--radius);
    border: 1px solid #f59e0b;
}

.favorites-section .category-title {
    border-bottom-color: #f59e0b;
}

/* Responsive */
@media (max-width: 768px) {
    .navbar .container {
        flex-wrap: wrap;
        gap: 10px;
    }

    .search-container {
        order: 3;
        max-width: 100%;
        width: 100%;
        margin: 10px 0 0 0;
    }

    .social-share {
        order: 4;
        width: 100%;
        justify-content: center;
        padding-top: 10px;
        border-top: 1px solid var(--border);
        margin-top: 5px;
    }

    .nav-right {
        gap: 10px;
    }

    .logo-text {
        display: none;
    }

    .page-header h1 {
        font-size: 1.8rem;
    }

    .tool-grid {
        grid-template-columns: 1fr;
    }

    .tool-box {
        padding: 20px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .lang-code {
        display: none;
    }

    .back-text {
        display: none;
    }

    .back-btn {
        padding: 10px 14px;
    }
}

/* Featured Apps Section */
.featured-section {
    margin-bottom: 24px;
}

.featured-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.featured-banner {
    background: linear-gradient(135deg, var(--primary) 0%, #667eea 100%);
    border-radius: 10px;
    padding: 12px 16px;
    box-shadow: 0 2px 12px rgba(99, 102, 241, 0.1);
    transition: all 0.3s ease;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.featured-banner:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.18);
}

.featured-icon {
    font-size: 1.5rem;
    background: rgba(255, 255, 255, 0.2);
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    flex-shrink: 0;
}

.featured-text {
    flex: 1;
    color: white;
}

.featured-title {
    font-size: 0.95rem;
    font-weight: 700;
    margin: 0 0 2px 0;
    color: white;
}

.featured-description {
    margin: 0;
    font-size: 0.75rem;
    opacity: 0.9;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.3;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .featured-section {
        margin-bottom: 16px;
    }

    .featured-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .featured-banner {
        padding: 10px 14px;
    }

    .featured-icon {
        width: 36px;
        height: 36px;
        font-size: 1.3rem;
    }

    .featured-title {
        font-size: 0.9rem;
    }

    .featured-description {
        font-size: 0.7rem;
    }
}

/* ProductHunt Banner */
.producthunt-banner {
    text-align: center;
    padding: 20px 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    animation: gradient-shift 3s ease infinite;
}

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

.producthunt-banner a {
    display: inline-block;
    transition: transform 0.3s ease;
}

.producthunt-banner a:hover {
    transform: scale(1.05);
}

.producthunt-banner p {
    color: white;
    margin-top: 10px;
    font-size: 14px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

@media (max-width: 768px) {
    .producthunt-banner {
        padding: 15px 0;
    }

    .producthunt-banner img {
        width: 200px !important;
        height: auto !important;
    }

    .producthunt-banner p {
        font-size: 12px;
        padding: 0 10px;
    }
}
