/**
 * Dreams Interpreter - Frontend Styles
 * التصميم الروحاني القديم لتفسير الأحلام
 */

/* === الألوان الأساسية === */
:root {
    --dreams-primary: #2c1810; /* بني داكن */
    --dreams-secondary: #4a3426; /* بني متوسط */
    --dreams-accent: #8b6f47; /* ذهبي قديم */
    --dreams-text: #d4c5b0; /* بيج فاتح */
    --dreams-bg: #1a1511; /* أسود بني */
    --dreams-border: #3e2f23; /* بني للحدود */
    --dreams-mystical: #9b8b7a; /* رمادي دافئ */
    --dreams-moon: #e8dcc4; /* لون القمر */
    --dreams-stars: #f4e8d0; /* لون النجوم */
}

/* === الحاوي الرئيسي === */
.dreams-container {
    background-color: var(--dreams-bg);
    color: var(--dreams-text);
    padding: 40px;
    border-radius: 8px;
    border: 2px solid var(--dreams-border);
    position: relative;
    font-family: 'Amiri', 'Traditional Arabic', serif;
    max-width: 800px;
    margin: 0 auto;
}

/* === الخلفية الروحانية === */
.dreams-container.mystical-theme {
    background-image: 
        radial-gradient(circle at 20% 50%, rgba(139, 111, 71, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 50%, rgba(139, 111, 71, 0.1) 0%, transparent 50%);
}

/* === رأس الصفحة === */
.dreams-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 30px;
    border-bottom: 1px solid var(--dreams-border);
}

.dreams-title {
    color: var(--dreams-accent);
    font-size: 2.5em;
    margin-bottom: 15px;
    font-weight: normal;
    letter-spacing: 2px;
}

.dreams-intro p {
    font-size: 1.1em;
    opacity: 0.9;
    line-height: 1.8;
}

/* === صندوق المعلومات === */
.dreams-info-box {
    background-color: var(--dreams-secondary);
    border: 1px solid var(--dreams-border);
    border-radius: 6px;
    padding: 20px;
    margin-bottom: 30px;
}

.dreams-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.dreams-info-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.dreams-info-label {
    font-size: 0.9em;
    opacity: 0.7;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.dreams-info-value {
    font-size: 1.2em;
    color: var(--dreams-moon);
    font-weight: bold;
}

.dreams-points {
    color: var(--dreams-accent);
}

.dreams-login-link {
    color: var(--dreams-accent);
    text-decoration: none;
    border-bottom: 1px dotted var(--dreams-accent);
    transition: opacity 0.3s ease;
}

.dreams-login-link:hover {
    opacity: 0.8;
}

/* === منطقة الدردشة === */
.dreams-chat-container {
    background-color: rgba(26, 21, 17, 0.5);
    border: 1px solid var(--dreams-border);
    border-radius: 6px;
    min-height: 500px;
    position: relative;
    overflow: hidden;
}

/* === شاشة البداية === */
.dreams-start-screen {
    display: none;
    padding: 60px 40px;
    text-align: center;
}

.dreams-start-screen.active {
    display: block;
}

.dreams-welcome {
    max-width: 500px;
    margin: 0 auto;
}

.dreams-mystical-symbol {
    font-size: 4em;
    color: var(--dreams-moon);
    margin-bottom: 20px;
    opacity: 0.8;
}

.dreams-welcome h3 {
    color: var(--dreams-accent);
    font-size: 1.8em;
    margin-bottom: 15px;
    font-weight: normal;
}

.dreams-instructions {
    background-color: rgba(74, 52, 38, 0.3);
    border-radius: 6px;
    padding: 25px;
    margin: 30px 0;
    text-align: right;
}

.dreams-instructions h4 {
    color: var(--dreams-moon);
    margin-bottom: 15px;
}

.dreams-instructions ol {
    list-style: arabic-indic;
    padding-right: 20px;
    line-height: 1.8;
}

/* === الأزرار === */
.dreams-btn {
    background-color: var(--dreams-accent);
    color: var(--dreams-bg);
    border: none;
    padding: 12px 30px;
    border-radius: 4px;
    font-size: 1.1em;
    cursor: pointer;
    transition: opacity 0.3s ease;
    font-family: inherit;
}

.dreams-btn:hover {
    opacity: 0.85;
}

.dreams-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.dreams-btn-primary {
    background-color: var(--dreams-accent);
}

.dreams-btn-secondary {
    background-color: var(--dreams-secondary);
    color: var(--dreams-text);
}

.dreams-btn-outline {
    background-color: transparent;
    border: 1px solid var(--dreams-accent);
    color: var(--dreams-accent);
}

/* === منطقة الدردشة === */
.dreams-chat-area {
    display: none;
    height: 100%;
    flex-direction: column;
}

.dreams-chat-area.active {
    display: flex;
}

.dreams-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    scroll-behavior: smooth;
}

/* === رسائل الدردشة === */
.dreams-message {
    margin-bottom: 20px;
    opacity: 0;
    transform: translateY(10px);
    animation: dreamsFadeIn 0.5s ease forwards;
}

@keyframes dreamsFadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dreams-message-user {
    text-align: left;
}

.dreams-message-ai {
    text-align: right;
}

.dreams-message-content {
    display: inline-block;
    max-width: 70%;
    padding: 15px 20px;
    border-radius: 8px;
    line-height: 1.6;
}

.dreams-message-user .dreams-message-content {
    background-color: var(--dreams-secondary);
    border-bottom-left-radius: 2px;
}

.dreams-message-ai .dreams-message-content {
    background-color: rgba(139, 111, 71, 0.2);
    border: 1px solid var(--dreams-border);
    border-bottom-right-radius: 2px;
}

/* === منطقة الإدخال === */
.dreams-input-area {
    border-top: 1px solid var(--dreams-border);
    padding: 20px;
}

.dreams-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.dreams-input {
    flex: 1;
    background-color: var(--dreams-secondary);
    border: 1px solid var(--dreams-border);
    color: var(--dreams-text);
    padding: 12px 15px;
    border-radius: 4px;
    resize: vertical;
    min-height: 50px;
    font-family: inherit;
    font-size: 1em;
}

.dreams-input:focus {
    outline: none;
    border-color: var(--dreams-accent);
}

.dreams-send-btn {
    background-color: var(--dreams-accent);
    border: none;
    color: var(--dreams-bg);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
}

.dreams-send-btn:hover:not(:disabled) {
    opacity: 0.85;
}

.dreams-send-icon {
    font-size: 1.5em;
}

/* === مؤشر الكتابة === */
.dreams-typing-indicator {
    padding: 20px;
    text-align: center;
}

.dreams-typing-indicator span {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--dreams-mystical);
    margin: 0 3px;
    opacity: 0.4;
    animation: dreamsTyping 1.4s infinite;
}

.dreams-typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.dreams-typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes dreamsTyping {
    0%, 60%, 100% {
        opacity: 0.4;
    }
    30% {
        opacity: 1;
    }
}

/* === شاشة النتيجة === */
.dreams-result-screen {
    display: none;
    padding: 40px;
}

.dreams-result-screen.active {
    display: block;
}

.dreams-result-content {
    max-width: 600px;
    margin: 0 auto;
}

.dreams-interpretation {
    background-color: rgba(74, 52, 38, 0.2);
    border: 1px solid var(--dreams-border);
    border-radius: 6px;
    padding: 30px;
    margin: 20px 0;
    line-height: 1.8;
    font-size: 1.1em;
}

.dreams-result-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin: 30px 0;
}

/* === التقييم === */
.dreams-rating {
    text-align: center;
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid var(--dreams-border);
}

.dreams-stars {
    font-size: 2em;
    margin-top: 15px;
}

.dreams-star {
    color: var(--dreams-mystical);
    cursor: pointer;
    transition: color 0.3s ease;
    margin: 0 5px;
}

.dreams-star:hover,
.dreams-star.active {
    color: var(--dreams-accent);
}

/* === حالة التحميل === */
.dreams-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(26, 21, 17, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.dreams-loading-content {
    text-align: center;
}

.dreams-loader {
    width: 60px;
    height: 60px;
    border: 3px solid var(--dreams-border);
    border-top-color: var(--dreams-accent);
    border-radius: 50%;
    margin: 0 auto 20px;
    animation: dreamsSpin 1s linear infinite;
}

@keyframes dreamsSpin {
    to {
        transform: rotate(360deg);
    }
}

/* === المؤثرات الروحانية === */
.dreams-mystical-effects {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    overflow: hidden;
}

.dreams-stars-bg {
    position: absolute;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(2px 2px at 20% 30%, var(--dreams-stars), transparent),
        radial-gradient(2px 2px at 60% 70%, var(--dreams-stars), transparent),
        radial-gradient(1px 1px at 50% 50%, var(--dreams-stars), transparent);
    background-size: 200px 200px;
    opacity: 0.3;
}

.dreams-moon {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background-color: var(--dreams-moon);
    border-radius: 50%;
    opacity: 0.2;
    box-shadow: 0 0 20px var(--dreams-moon);
}

/* === سجل التفسيرات === */
.dreams-history-container {
    background-color: var(--dreams-bg);
    color: var(--dreams-text);
    padding: 30px;
    border-radius: 8px;
    border: 1px solid var(--dreams-border);
}

.dreams-history-item {
    background-color: var(--dreams-secondary);
    border: 1px solid var(--dreams-border);
    border-radius: 6px;
    padding: 20px;
    margin-bottom: 20px;
}

.dreams-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.dreams-history-date {
    font-size: 0.9em;
    opacity: 0.7;
}

.dreams-history-rating {
    color: var(--dreams-accent);
}

.dreams-view-full {
    color: var(--dreams-accent);
    text-decoration: none;
    border-bottom: 1px dotted var(--dreams-accent);
    margin-top: 15px;
    display: inline-block;
}

/* === الإشعارات === */
.dreams-notice {
    padding: 15px 20px;
    border-radius: 4px;
    margin-bottom: 20px;
    border: 1px solid;
}

.dreams-notice-error {
    background-color: rgba(139, 0, 0, 0.1);
    border-color: #8b0000;
    color: #ff6b6b;
}

/* === استجابة الهاتف === */
@media (max-width: 768px) {
    .dreams-container {
        padding: 20px;
    }
    
    .dreams-title {
        font-size: 2em;
    }
    
    .dreams-message-content {
        max-width: 85%;
    }
    
    .dreams-result-actions {
        flex-direction: column;
    }
    
    .dreams-btn {
        width: 100%;
    }
}