:root {
    --primary: #6c63ff;
    --primary-dark: #5a52d5;
    --primary-light: #8b83ff;
    --bg-dark: #0f0c29;
    --bg-card: rgba(255,255,255,0.05);
    --text-light: #e2e8f0;
    --text-muted: #a0aec0;
    --border-color: #4a5568;
    --radius: 16px;
    --shadow: 0 15px 40px rgba(0,0,0,0.3);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --gradient: linear-gradient(135deg, #6c63ff, #a78bfa);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

body {
    background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
    min-height: 100vh;
    color: var(--text-light);
    display: flex;
    flex-direction: column;
}

/* === هيڊر === */
header {
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(20px);
    padding: 12px 30px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.logo {
    font-size: 1.4rem;
    font-weight: 800;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo .version {
    font-size: 0.55rem;
    background: var(--primary);
    color: white;
    padding: 2px 10px;
    border-radius: 50px;
    -webkit-text-fill-color: white;
}

.badge {
    background: var(--gradient);
    padding: 4px 16px;
    border-radius: 50px;
    font-size: 0.7rem;
    color: white;
    font-weight: 600;
}

.domain-badge {
    color: var(--text-muted);
    font-size: 0.7rem;
    text-decoration: none;
    padding: 4px 12px;
    border: 1px solid var(--border-color);
    border-radius: 50px;
    transition: var(--transition);
}

.domain-badge:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.icon-btn {
    background: rgba(255,255,255,0.08);
    border: none;
    color: var(--text-light);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    background: var(--primary);
    transform: scale(1.05);
}

/* === هيرو === */
.hero {
    text-align: center;
    padding: 40px 20px 20px;
}

.hero h1 {
    font-size: 2.2rem;
    font-weight: 800;
    background: linear-gradient(135deg, #fff, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 10px;
}

.hero p {
    color: var(--text-muted);
    font-size: 1.1rem;
    max-width: 700px;
    margin: 0 auto;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-top: 20px;
}

.hero-stats span {
    background: rgba(255,255,255,0.05);
    padding: 6px 20px;
    border-radius: 50px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.hero-stats i {
    color: var(--primary);
    margin-right: 6px;
}

/* === مکيه === */
.main-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px 20px;
    flex: 1;
    width: 100%;
}

.dashboard {
    background: var(--bg-card);
    backdrop-filter: blur(15px);
    border-radius: var(--radius);
    padding: 28px;
    border: 1px solid rgba(255,255,255,0.06);
    box-shadow: var(--shadow);
}

.search-section {
    margin-bottom: 25px;
}

.search-box {
    display: flex;
    align-items: center;
    background: rgba(0,0,0,0.3);
    border-radius: 50px;
    padding: 0 20px;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.search-box:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.1);
}

.search-box input {
    background: transparent;
    border: none;
    padding: 14px 12px;
    color: var(--text-light);
    font-size: 1rem;
    width: 100%;
    outline: none;
}

.search-box i {
    color: var(--text-muted);
}

/* === اوزار گرڊ === */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 18px;
}

.tool-card {
    background: rgba(255,255,255,0.04);
    border-radius: var(--radius);
    padding: 20px 16px;
    text-align: center;
    transition: var(--transition);
    border: 1px solid transparent;
}

.tool-card:hover {
    background: rgba(255,255,255,0.08);
    transform: translateY(-5px);
    border-color: var(--primary);
    box-shadow: 0 10px 30px rgba(108, 99, 255, 0.15);
}

.tool-card .tool-icon {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 10px;
}

.tool-card h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.tool-card p {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 12px;
    min-height: 30px;
}

.tool-btn {
    background: var(--gradient);
    color: white;
    border: none;
    padding: 6px 18px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.tool-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 20px rgba(108, 99, 255, 0.3);
}

/* === ورڪ اسپيس === */
.workspace {
    background: var(--bg-card);
    backdrop-filter: blur(15px);
    border-radius: var(--radius);
    padding: 30px;
    border: 1px solid rgba(255,255,255,0.06);
    box-shadow: var(--shadow);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

.workspace-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    flex-wrap: wrap;
}

.back-btn {
    background: rgba(255,255,255,0.08);
    border: none;
    color: var(--text-light);
    padding: 8px 20px;
    border-radius: 50px;
    cursor: pointer;
    transition: var(--transition);
}

.back-btn:hover {
    background: var(--primary);
}

.workspace-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
}

.tool-badge {
    background: var(--gradient);
    padding: 2px 14px;
    border-radius: 50px;
    font-size: 0.6rem;
    color: white;
    font-weight: 600;
}

.workspace-body textarea {
    width: 100%;
    padding: 16px;
    border-radius: 14px;
    border: 1px solid var(--border-color);
    background: rgba(0,0,0,0.3);
    color: var(--text-light);
    font-size: 1rem;
    resize: vertical;
    min-height: 140px;
    transition: var(--transition);
    line-height: 1.7;
}

.workspace-body textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.1);
}

.char-counter {
    text-align: right;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.tool-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 12px;
    margin: 15px 0;
    padding: 15px;
    background: rgba(0,0,0,0.2);
    border-radius: 14px;
}

.option-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.option-group label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.option-group select,
.option-group input[type="number"] {
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: rgba(0,0,0,0.3);
    color: var(--text-light);
    font-size: 0.9rem;
}

.primary-btn {
    background: var(--gradient);
    color: white;
    border: none;
    padding: 14px 32px;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.primary-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(108, 99, 255, 0.35);
}

.primary-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.shortcut {
    font-weight: 400;
    font-size: 0.7rem;
    opacity: 0.6;
}

.spinner {
    width: 45px;
    height: 45px;
    border: 4px solid rgba(108, 99, 255, 0.1);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 12px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

#toolLoading {
    text-align: center;
    padding: 30px 20px;
}

#toolLoading p {
    color: var(--text-muted);
    font-size: 1rem;
}

#toolLoading small {
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* === نتيجو === */
#toolOutput {
    margin-top: 20px;
    animation: fadeIn 0.4s ease;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
}

.result-header h3 {
    color: var(--primary);
    font-size: 1.1rem;
}

.result-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.result-actions button {
    background: rgba(255,255,255,0.06);
    border: none;
    color: var(--text-light);
    padding: 5px 14px;
    border-radius: 50px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

.result-actions button:hover {
    background: var(--primary);
}

.summary-content {
    background: rgba(0,0,0,0.3);
    border-radius: 14px;
    padding: 22px;
    color: var(--text-light);
    line-height: 1.8;
    border-left: 4px solid var(--primary);
    white-space: pre-wrap;
    font-size: 1.05rem;
    min-height: 50px;
}

.result-meta {
    display: flex;
    gap: 20px;
    margin-top: 12px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* === غلطي === */
.error-box {
    background: rgba(255, 0, 0, 0.08);
    border: 1px solid rgba(255, 0, 0, 0.15);
    border-radius: 12px;
    padding: 14px 20px;
    color: #fc8181;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
}

/* === فوٽر === */
footer {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: 0.75rem;
    border-top: 1px solid rgba(255,255,255,0.04);
    margin-top: 20px;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.footer-links {
    display: flex;
    gap: 15px;
}

.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    transition: var(--transition);
}

.footer-links a:hover {
    color: var(--primary);
}

/* === لائيٽ موڊ === */
body.light-mode {
    background: #f0f2f5;
    color: #1a202c;
}

body.light-mode .dashboard,
body.light-mode .workspace {
    background: rgba(255,255,255,0.92);
    border-color: #e2e8f0;
}

body.light-mode .tool-card {
    background: white;
}

body.light-mode .tool-card:hover {
    background: #f7fafc;
}

body.light-mode .search-box {
    background: white;
    border-color: #e2e8f0;
}

body.light-mode .search-box input {
    color: #1a202c;
}

body.light-mode .workspace-body textarea {
    background: white;
    color: #1a202c;
    border-color: #e2e8f0;
}

body.light-mode .tool-options {
    background: #f7fafc;
}

body.light-mode .option-group select,
body.light-mode .option-group input[type="number"] {
    background: white;
    color: #1a202c;
    border-color: #e2e8f0;
}

body.light-mode .summary-content {
    background: #f7fafc;
    color: #1a202c;
}

body.light-mode header {
    background: rgba(255,255,255,0.92);
    border-bottom-color: #e2e8f0;
}

body.light-mode .icon-btn {
    color: #4a5568;
    background: #edf2f7;
}

body.light-mode .icon-btn:hover {
    background: var(--primary);
    color: white;
}

body.light-mode .domain-badge {
    color: #4a5568;
    border-color: #e2e8f0;
}

body.light-mode .domain-badge:hover {
    border-color: var(--primary);
    color: var(--primary);
}

body.light-mode .hero h1 {
    background: linear-gradient(135deg, #1a202c, #6c63ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

body.light-mode .result-actions button {
    background: #edf2f7;
    color: #4a5568;
}

body.light-mode .result-actions button:hover {
    background: var(--primary);
    color: white;
}

/* === جوابدار === */
@media (max-width: 900px) {
    .tools-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }
    .hero h1 {
        font-size: 1.8rem;
    }
    .hero-stats {
        gap: 15px;
        flex-wrap: wrap;
    }
}

@media (max-width: 600px) {
    .header-content {
        flex-direction: column;
        align-items: center;
        gap: 6px;
    }
    .logo {
        font-size: 1.2rem;
    }
    .domain-badge {
        font-size: 0.6rem;
    }
    .hero h1 {
        font-size: 1.3rem;
    }
    .hero p {
        font-size: 0.9rem;
    }
    .hero-stats {
        flex-direction: column;
        align-items: center;
        gap: 8px;
    }
    .tools-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    .tool-card {
        padding: 14px 10px;
    }
    .tool-card .tool-icon {
        font-size: 1.6rem;
    }
    .tool-card h3 {
        font-size: 0.8rem;
    }
    .dashboard {
        padding: 14px;
    }
    .workspace {
        padding: 14px;
    }
    .tool-options {
        grid-template-columns: 1fr;
    }
    .footer-content {
        flex-direction: column;
        text-align: center;
    }
    .result-actions {
        flex-wrap: wrap;
    }
    .result-actions button {
        font-size: 0.7rem;
        padding: 4px 10px;
    }
}