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

body {
    font-family: 'Cairo', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    color: #333;
    line-height: 1.6;
}

.container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 800px;
    padding: 30px;
    position: relative;
    overflow: hidden;
}

/* رأس الصفحة */
header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}

header h1 {
    color: #4a5568;
    font-size: 2.2rem;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

header h1 i {
    color: #667eea;
}

.subtitle {
    color: #718096;
    font-size: 1.1rem;
}

/* منطقة الحالة */
.status-container {
    background: #f7fafc;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 25px;
    border: 2px solid #e2e8f0;
}

.status-box {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    padding: 15px;
    background: white;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

#statusIcon {
    font-size: 2rem;
    color: #667eea;
}

#statusText {
    font-size: 1.2rem;
    font-weight: 600;
    color: #4a5568;
}

.voice-selector {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.voice-selector label {
    font-weight: 600;
    color: #4a5568;
}

#voiceSelect {
    flex: 1;
    min-width: 200px;
    padding: 10px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-family: 'Cairo', sans-serif;
    font-size: 1rem;
    background: white;
    color: #4a5568;
    cursor: pointer;
}

/* زر التحكم */
.control-container {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.mic-btn, .stop-btn {
    padding: 18px 35px;
    border: none;
    border-radius: 50px;
    font-family: 'Cairo', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: all 0.3s ease;
    min-width: 180px;
}

.mic-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.mic-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.5);
}

.mic-btn:active {
    transform: translateY(0);
}

.stop-btn {
    background: #fed7d7;
    color: #c53030;
}

.stop-btn:hover {
    background: #feb2b2;
}

/* منطقة المحادثة */
.chat-container {
    background: #f7fafc;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 25px;
    height: 300px;
    overflow-y: auto;
    border: 2px solid #e2e8f0;
}

.messages {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.message {
    display: flex;
    gap: 15px;
    animation: fadeIn 0.3s ease;
}

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

.message.user {
    flex-direction: row-reverse;
}

.message.user .content {
    background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
    color: white;
    border-radius: 20px 20px 5px 20px;
}

.message.assistant .content {
    background: white;
    color: #4a5568;
    border-radius: 20px 20px 20px 5px;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: #667eea;
}

.message.user .avatar {
    background: #4299e1;
    color: white;
}

.content {
    max-width: 70%;
    padding: 15px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.time {
    display: block;
    font-size: 0.8rem;
    margin-top: 8px;
    opacity: 0.7;
}

/* الأوامر المقترحة */
.suggestions {
    background: white;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 25px;
    border: 2px solid #e2e8f0;
}

.suggestions h3 {
    color: #4a5568;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.suggestion-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.suggestion-btn {
    padding: 12px 20px;
    background: #f7fafc;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    color: #4a5568;
    font-family: 'Cairo', sans-serif;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-align: center;
}

.suggestion-btn:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
    transform: translateY(-2px);
}

/* الإعدادات */
.settings {
    background: white;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 25px;
    border: 2px solid #e2e8f0;
}

.settings h3 {
    color: #4a5568;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.setting-item {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    right: 0;
    left: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    right: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #667eea;
}

input:checked + .slider:before {
    transform: translateX(-26px);
}

.speed-control {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
}

#voiceSpeed {
    flex: 1;
}

#speedValue {
    min-width: 40px;
    font-weight: 600;
    color: #667eea;
}

/* التذييل */
footer {
    text-align: center;
    padding-top: 20px;
    border-top: 2px solid #f0f0f0;
    color: #718096;
    font-size: 0.9rem;
}

.browser-warning {
    color: #e53e3e;
    font-weight: 600;
    margin-top: 10px;
}

/* النوافذ المنبثقة */
.help-modal, .browser-modal {
    display: none;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 20px;
    padding: 30px;
    max-width: 500px;
    width: 100%;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    animation: modalAppear 0.3s ease;
}

@keyframes modalAppear {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.modal-content h2 {
    color: #4a5568;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-content ul {
    list-style-position: inside;
    margin: 20px 0;
}

.modal-content li {
    margin-bottom: 10px;
    color: #4a5568;
}

.close-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 50px;
    font-family: 'Cairo', sans-serif;
    font-size: 1rem;
    cursor: pointer;
    display: block;
    margin: 20px auto 0;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: #5a67d8;
    transform: translateY(-2px);
}

/* استجابة للشاشات الصغيرة */
@media (max-width: 768px) {
    .container {
        padding: 20px;
    }
    
    header h1 {
        font-size: 1.8rem;
        flex-direction: column;
        gap: 10px;
    }
    
    .mic-btn, .stop-btn {
        width: 100%;
    }
    
    .control-container {
        flex-direction: column;
    }
    
    .suggestion-buttons {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    
    .container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 1.5rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
}