/* Variables */
:root {
    --primary: #4361ee;
    --primary-hover: #3a0ca3;
    --secondary: #4cc9f0;
    --background: #f8f9fa;
    --surface: #ffffff;
    --text-main: #2b2d42;
    --text-muted: #8d99ae;
    --border: #e9ecef;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius: 12px;
    --transition: all 0.3s ease;
    
    --header-height: 70px;
}

[data-theme="dark"] {
    --primary: #4361ee;
    --primary-hover: #4cc9f0;
    --secondary: #f72585;
    --background: #121212;
    --surface: #1e1e1e;
    --text-main: #f8f9fa;
    --text-muted: #adb5bd;
    --border: #2d2d2d;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
}

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

body {
    font-family: 'Tajawal', sans-serif;
    background-color: var(--background);
    color: var(--text-main);
    line-height: 1.6;
    transition: background-color var(--transition), color var(--transition);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-hover);
}

ul {
    list-style: none;
}

/* Header & Nav */
.site-header {
    background-color: var(--surface);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--header-height);
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-main);
}

.logo-text {
    background: linear-gradient(45deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.search-bar {
    flex: 1;
    max-width: 400px;
    position: relative;
    margin: 0 20px;
}

.search-input {
    width: 100%;
    padding: 10px 40px 10px 15px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background-color: var(--background);
    color: var(--text-main);
    font-family: inherit;
    transition: var(--transition);
}

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

.search-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

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

.main-nav {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-link {
    color: var(--text-main);
    font-weight: 500;
    padding: 8px 12px;
    border-radius: var(--radius);
}

.nav-link:hover, .nav-link.active {
    background-color: rgba(67, 97, 238, 0.1);
    color: var(--primary);
}

.nav-dropdown {
    position: relative;
}

.dropdown-toggle {
    background: none;
    border: none;
    font-family: inherit;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--text-main);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    min-width: 200px;
    padding: 10px 0;
    display: none;
    z-index: 1000;
}

.nav-dropdown:hover .dropdown-menu {
    display: block;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: var(--text-main);
    transition: var(--transition);
}

.dropdown-item:hover {
    background-color: rgba(67, 97, 238, 0.05);
    color: var(--primary);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.icon-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--text-main);
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

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

.mobile-only {
    display: none;
}

/* قائمة الجوال — مخفية افتراضياً على جميع الأحجام */
.mobile-menu {
    display: none;
    position: fixed;
    top: 0;
    right: -100%;
    width: 80%;
    max-width: 300px;
    height: 100vh;
    background: var(--surface);
    box-shadow: -5px 0 15px rgba(0,0,0,0.2);
    transition: right 0.3s ease;
    z-index: 1000;
    flex-direction: column;
}

.mobile-menu.active {
    right: 0;
}

/* Main Content */
.app-content {
    flex: 1;
    padding: 30px 20px;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

.page {
    animation: fadeIn 0.3s ease;
}

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

/* Home Grid */
.hero {
    text-align: center;
    margin-bottom: 40px;
}

.hero h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 10px;
    background: linear-gradient(45deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

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

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.tool-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: flex-start;
    gap: 15px;
    cursor: pointer;
    transition: var(--transition);
}

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

.tool-icon {
    font-size: 2rem;
    color: var(--primary);
    background: rgba(67, 97, 238, 0.1);
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 15px;
    flex-shrink: 0;
}

.tool-info h3 {
    font-size: 1.2rem;
    margin-bottom: 5px;
    color: var(--text-main);
}

.tool-info p {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Ads */
.ad-banner {
    width: 100%;
    padding: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    border-top: 1px solid var(--border);
}

.ad-placeholder {
    width: 728px;
    height: 90px;
    background: var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    border-radius: 4px;
    max-width: 100%;
}

.ad-interstitial {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.interstitial-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}

.interstitial-content {
    background: var(--surface);
    padding: 20px;
    border-radius: var(--radius);
    position: relative;
    z-index: 10000;
    width: 90%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.interstitial-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
    color: var(--text-main);
}

.interstitial-timer {
    background: var(--primary);
    color: white;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.interstitial-body {
    width: 100%;
    height: 300px;
    background: var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.interstitial-skip {
    background: var(--border);
    color: var(--text-main);
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-family: inherit;
    transition: var(--transition);
}

.interstitial-skip:hover {
    background: var(--primary);
    color: white;
}

/* Footer */
.site-footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 40px 20px 20px;
    margin-top: auto;
}

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

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}

.footer-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 15px;
}

.footer-desc {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.footer-col h4 {
    margin-bottom: 15px;
    color: var(--text-main);
}

.footer-col ul li {
    margin-bottom: 10px;
}

.footer-col a {
    color: var(--text-muted);
}

.footer-col a:hover {
    color: var(--primary);
}

.social-links {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.social-links a {
    display: flex;
    align-items: center;
    gap: 10px;
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Tool Page Specific */
.tool-header {
    text-align: center;
    margin-bottom: 30px;
}

.tool-header h2 {
    font-size: 2rem;
    margin-bottom: 10px;
    color: var(--primary);
}

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

.tool-container {
    max-width: 800px;
    margin: 0 auto;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 30px;
    border: 1px solid var(--border);
}

.drop-zone {
    border: 2px dashed var(--primary);
    border-radius: var(--radius);
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: rgba(67, 97, 238, 0.05);
}

.drop-zone:hover, .drop-zone.dragover {
    background: rgba(67, 97, 238, 0.1);
    border-color: var(--primary-hover);
}

.drop-icon {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 15px;
}

.btn {
    display: inline-block;
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: var(--radius);
    cursor: pointer;
    font-family: inherit;
    font-weight: 500;
    font-size: 1rem;
    transition: var(--transition);
}

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

.btn:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
}

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

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

/* Controls */
.controls {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.control-group label {
    font-weight: 500;
    color: var(--text-main);
}

.form-control {
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--background);
    color: var(--text-main);
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
}

/* Loading */
.loading-screen {
    display: none;
    justify-content: center;
    align-items: center;
    padding: 40px;
}

.loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.loader-ring {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .search-bar { display: none; }
    .main-nav { display: none; }
    .mobile-only { display: flex; }

    .mobile-menu { display: flex; }

    .mobile-menu-header {
        padding: 20px;
        border-bottom: 1px solid var(--border);
        display: flex;
        justify-content: space-between;
        align-items: center;
        font-weight: bold;
        font-size: 1.2rem;
    }

    .mobile-menu-content {
        padding: 20px;
        overflow-y: auto;
    }

    .mobile-menu-item {
        display: flex;
        align-items: center;
        gap: 15px;
        padding: 15px 0;
        border-bottom: 1px solid var(--border);
        color: var(--text-main);
    }

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

    .app-content {
        padding: 20px 15px;
    }
}

