:root {
    --bg-main: #090d16;
    --bg-card: #111827;
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --primary: #10b981;
    --primary-hover: #059669;
    --border-color: rgba(255, 255, 255, 0.08);
    --glow-color: rgba(16, 185, 129, 0.15);
}

[data-theme="light"] {
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --primary: #0d9488;
    --primary-hover: #0f766e;
    --border-color: rgba(0, 0, 0, 0.08);
    --glow-color: rgba(13, 148, 136, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Cairo', sans-serif;
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    overflow-x: hidden;
    position: relative;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.glow-sphere {
    position: absolute;
    width: 400px;
    height: 400px;
    background: var(--glow-color);
    filter: blur(100px);
    border-radius: 50%;
    z-index: -1;
}

#glow1 { top: -100px; right: -100px; }
#glow2 { top: 60%; left: -100px; }

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 8%;
    background-color: rgba(9, 13, 22, 0.8);
    backdrop-filter: blur(12px);
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    border-bottom: 1px solid var(--border-color);
}

[data-theme="light"] nav {
    background-color: rgba(248, 250, 252, 0.8);
}

.logo {
    font-family: 'Orbitron', sans-serif;
    font-size: 24px;
    font-weight: 900;
    color: var(--text-main);
}

.logo span {
    color: var(--primary);
}

.nav-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 25px;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 600;
    transition: color 0.3s;
}

.nav-links a:hover, .nav-links a.active {
    color: var(--primary);
}

.tool-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.3s;
}

.tool-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

header#hero {
    min-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 120px 8% 60px;
    gap: 40px;
}

.hero-text {
    flex: 1;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background-color: var(--glow-color);
    color: var(--primary);
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}

.hero-text h1 {
    font-size: 45px;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 20px;
}

.hero-text h1 span {
    color: var(--primary);
}

.hero-text p {
    color: var(--text-muted);
    font-size: 17px;
    line-height: 1.7;
    margin-bottom: 30px;
}

.cta-buttons {
    display: flex;
    gap: 15px;
}

.btn {
    padding: 12px 28px;
    border-radius: 10px;
    font-weight: 700;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: 0.3s;
    border: none;
    font-size: 15px;
}

.btn-primary {
    background-color: var(--primary);
    color: #ffffff;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px var(--glow-color);
}

.btn-secondary {
    background-color: var(--bg-card);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.hero-image-wrapper {
    flex: 1;
    display: flex;
    justify-content: center;
}

.profile-frame {
    width: 300px;
    height: 300px;
    border-radius: 30px;
    border: 3px solid var(--primary);
    overflow: hidden;
    box-shadow: 0 0 30px var(--glow-color);
    position: relative;
}

.profile-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

section {
    padding: 80px 8%;
}

.section-header {
    text-align: center;
    margin-bottom: 50px;
}

.section-header h2 {
    font-size: 35px;
    font-weight: 800;
    margin-bottom: 10px;
}

.section-header h2 span {
    color: var(--primary);
}

.section-header p {
    color: var(--text-muted);
}

.project-tabs {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.tab-btn {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.3s;
}

.tab-btn.active, .tab-btn:hover {
    background-color: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
}

.project-content {
    display: none;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.project-content.active {
    display: block;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.portfolio-detail {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: center;
}

.skill-bar-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.skill-info {
    display: flex;
    justify-content: space-between;
    font-weight: 700;
    margin-bottom: 5px;
    font-size: 14px;
}

.skill-line {
    width: 100%;
    height: 8px;
    background-color: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

.skill-fill {
    height: 100%;
    background-color: var(--primary);
    border-radius: 4px;
}

.landing-demo {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 30px;
    align-items: center;
}

.ai-chat-terminal {
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 380px;
}

.chat-terminal-header {
    background-color: var(--bg-card);
    padding: 12px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
    font-weight: 700;
}

.chat-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-msg {
    padding: 10px 14px;
    border-radius: 10px;
    max-width: 80%;
    font-size: 14px;
    line-height: 1.5;
}

.chat-msg.ai {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    align-self: flex-start;
}

.chat-msg.user {
    background-color: var(--primary);
    color: #ffffff;
    align-self: flex-end;
}

.chat-input-area {
    display: flex;
    padding: 10px;
    background-color: var(--bg-card);
    border-top: 1px solid var(--border-color);
}

.chat-text-input {
    flex: 1;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 10px 15px;
    border-radius: 8px;
    outline: none;
    font-size: 14px;
}

.chat-send-btn {
    background-color: var(--primary);
    color: #ffffff;
    border: none;
    width: 40px;
    border-radius: 8px;
    margin-right: 8px;
    cursor: pointer;
    transition: 0.3s;
}

[dir="ltr"] .chat-send-btn {
    margin-right: 0;
    margin-left: 8px;
}

.todo-app {
    max-width: 600px;
    margin: 0 auto;
}

.todo-input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.todo-input {
    flex: 1;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 12px 15px;
    border-radius: 10px;
    outline: none;
}

.priority-select {
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0 15px;
    border-radius: 10px;
    outline: none;
}

.todo-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 250px;
    overflow-y: auto;
}

.todo-item {
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    padding: 12px 15px;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
}

.stat-card {
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 30px;
    text-align: center;
}

.progress-ring-container {
    position: relative;
    width: 140px;
    height: 140px;
    margin: 20px auto 0;
}

.progress-ring-svg {
    width: 140px;
    height: 140px;
    transform: rotate(-90deg);
}

.progress-ring-circle-bg {
    fill: none;
    stroke: var(--border-color);
    stroke-width: 12;
}

.progress-ring-circle {
    fill: none;
    stroke: var(--primary);
    stroke-width: 12;
    stroke-dasharray: 377;
    stroke-dashoffset: 377;
    transition: stroke-dashoffset 0.8s ease;
    stroke-linecap: round;
}

.progress-ring-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    font-weight: 800;
    font-family: 'Orbitron', sans-serif;
}

/* تنسيقات قسم الخدمات المدفوعة */
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 40px;
}

.service-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 35px 25px;
    text-align: inherit;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    transition: all 0.3s ease;
}

.service-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
    box-shadow: 0 10px 30px var(--glow-color);
}

.service-card.featured {
    border: 2px solid var(--primary);
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(20, 184, 166, 0.05) 100%);
}

.badge-featured {
    position: absolute;
    top: -12px;
    right: 25px;
    background-color: var(--primary);
    color: #ffffff;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 50px;
}

[dir="ltr"] .badge-featured {
    right: auto;
    left: 25px;
}

.service-icon {
    width: 60px;
    height: 60px;
    background-color: var(--glow-color);
    color: var(--primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 20px;
}

.service-card h3 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 12px;
}

.service-card p {
    color: var(--text-muted);
    font-size: 15px;
    margin-bottom: 25px;
    line-height: 1.6;
}

.service-price {
    font-family: 'Orbitron', sans-serif;
    font-size: 22px;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 20px;
}

.contact-container {
    max-width: 650px;
    margin: 0 auto;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 40px;
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 30px;
}

.contact-form input, .contact-form textarea {
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 12px 15px;
    border-radius: 10px;
    outline: none;
    font-size: 15px;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.social-icon {
    width: 45px;
    height: 45px;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: 0.3s;
}

.social-icon:hover {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
}

.api-settings-modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(5px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 30px;
    border-radius: 20px;
    width: 90%;
    max-width: 450px;
    position: relative;
}

.modal-close-btn {
    position: absolute;
    top: 15px; left: 15px;
    background: none; border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
}

[dir="ltr"] .modal-close-btn {
    left: auto; right: 15px;
}

.toast-notification {
    position: fixed;
    bottom: 30px; right: 30px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 15px 25px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 3000;
    transform: translateY(100px);
    opacity: 0;
    transition: 0.3s ease;
}

.toast-notification.show {
    transform: translateY(0);
    opacity: 1;
}

footer {
    text-align: center;
    padding: 30px;
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 14px;
}

@media(max-width: 768px) {
    header#hero {
        flex-direction: column-reverse;
        text-align: center;
        padding-top: 100px;
    }
    .cta-buttons { justify-content: center; }
    .portfolio-detail, .landing-demo { grid-template-columns: 1fr; }
    .nav-links { display: none; }
}