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

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #8b5cf6;
    --success: #10b981;
    --background: #0f172a;
    --surface: #1e293b;
    --card: #ffffff;
    --text: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
    --shadow: rgba(0, 0, 0, 0.1);
}

body {
    font-family: 'Tajawal', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    line-height: 1.8;
    direction: rtl;
}

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

header {
    text-align: center;
    color: white;
    margin-bottom: 40px;
    padding: 40px 20px;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 12px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.95;
}

#tool-finder {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    margin-bottom: 30px;
}

/* Progress Bar */
.progress-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 40px;
    padding: 0 20px;
    direction: ltr; /* Keep progress bar left-to-right for visual consistency */
    flex-direction: row-reverse; /* But reverse the order for Arabic */
}

.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--text-light);
    transition: all 0.3s;
}

.progress-step.active {
    color: var(--primary);
}

.progress-step.completed {
    color: var(--success);
}

.progress-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    transition: all 0.3s;
}

.progress-step.active .progress-circle {
    background: var(--primary);
    color: white;
    transform: scale(1.1);
}

.progress-step.completed .progress-circle {
    background: var(--success);
    color: white;
}

.progress-line {
    width: 80px;
    height: 2px;
    background: var(--border);
    margin: 0 10px;
}

/* Steps */
.step {
    display: none;
    animation: fadeIn 0.4s ease-in;
}

.step.active {
    display: block;
}

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

.step h2 {
    font-size: 1.8rem;
    color: var(--text);
    margin-bottom: 8px;
}

.step-description {
    color: var(--text-light);
    margin-bottom: 30px;
}

/* Options */
.options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 32px;
}

.options input {
    display: none;
}

.options label {
    padding: 20px 24px;
    background: #f8fafc;
    border: 2px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 16px;
}

.options label:hover {
    border-color: var(--primary);
    background: #f0f4ff;
    transform: translateX(-4px); /* RTL: reversed direction */
}

.options input:checked + label {
    border-color: var(--primary);
    background: linear-gradient(135deg, #f0f4ff 0%, #e8eeff 100%);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
}

.icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.label-text {
    font-weight: 600;
    font-size: 1.05rem;
    flex: 1;
    text-align: right;
}

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

/* Buttons */
.button-group {
    display: flex;
    gap: 12px;
    justify-content: space-between;
}

button {
    padding: 14px 32px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s;
    font-family: inherit;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
    background: #e2e8f0;
    color: var(--text);
}

.btn-secondary:hover {
    background: #cbd5e1;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

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

/* Results */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.results-count {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 8px 20px;
    border-radius: 20px;
    font-weight: 600;
}

/* Category Filter */
.category-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border);
}

.filter-btn {
    padding: 8px 16px;
    background: #f8fafc;
    border: 2px solid var(--border);
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    transition: all 0.3s;
}

.filter-btn:hover {
    border-color: var(--primary);
    background: #f0f4ff;
    transform: translateY(-2px);
}

.filter-btn.active {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border-color: var(--primary);
}

#results-container {
    max-height: 600px;
    overflow-y: auto;
    padding-left: 10px; /* RTL: switched from padding-right */
}

#results-container::-webkit-scrollbar {
    width: 8px;
}

#results-container::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 10px;
}

#results-container::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 10px;
}

.tool-card {
    background: white;
    padding: 28px;
    margin-bottom: 20px;
    border-radius: 16px;
    border: 1px solid var(--border);
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.tool-card::before {
    content: '';
    position: absolute;
    right: 0; /* RTL: changed from left */
    top: 0;
    height: 100%;
    width: 4px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
}

.tool-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px var(--shadow);
}

.tool-card-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 16px;
    gap: 16px;
}

.tool-card h3 {
    font-size: 1.5rem;
    color: var(--text);
    margin: 0;
}

.category {
    display: inline-block;
    padding: 6px 14px;
    background: linear-gradient(135deg, #f0f4ff, #e8eeff);
    color: var(--primary);
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
}

.tool-card p {
    color: var(--text-light);
    margin: 12px 0;
    line-height: 1.7;
}

.price {
    color: var(--success);
    font-weight: 700;
    font-size: 1.2rem;
    margin: 16px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.price::before {
    content: '✅';
    font-size: 1rem;
}

.tool-features {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 16px 0;
}

.feature-tag {
    padding: 4px 12px;
    background: #f1f5f9;
    border-radius: 12px;
    font-size: 0.85rem;
    color: var(--text-light);
}

.tool-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
    padding: 12px 24px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s;
}

.tool-link:hover {
    transform: translateX(-4px); /* RTL: reversed direction */
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

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

.no-results h3 {
    font-size: 1.5rem;
    margin-bottom: 12px;
    color: var(--text);
}

/* Footer */
footer {
    text-align: center;
    color: white;
    padding: 20px;
    opacity: 0.9;
}

footer a {
    color: white;
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.8rem;
    }

    #tool-finder {
        padding: 24px;
        border-radius: 16px;
    }

    .step h2 {
        font-size: 1.5rem;
    }

    .progress-bar {
        padding: 0;
    }

    .progress-step span {
        font-size: 0.85rem;
    }

    .progress-line {
        width: 40px;
    }

    .button-group {
        flex-direction: column;
    }

    button {
        width: 100%;
    }

    .results-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .tool-card {
        padding: 20px;
    }

    .tool-card-header {
        flex-direction: column;
    }
}

@media print {
    body {
        background: white;
    }

    .button-group,
    footer {
        display: none;
    }
}
