:root {
    --cat-bg: #ffffff;
    --cat-surface: #f8fafc;
    --cat-primary: #6366f1; /* Indigo */
    --cat-primary-dark: #4f46e5;
    --cat-text-main: #1e293b;
    --cat-text-light: #64748b;
    --cat-border: #e2e8f0;
    --cat-radius: 12px;
    --cat-shadow: 0 10px 30px -10px rgba(99, 102, 241, 0.2);
    --cat-primary: #4f46e5;
    --cat-border: #e5e7eb;
}


img.emoji {
  height: 1.5em !important;
  width: 1.5em !important;}

/* تنسيق رسالة طلب الدخول */
.cat-login-notice {
    text-align: center;
    padding: 3rem;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
}
.cat-login-notice h3 { margin-top: 0; color: #1f2937; }

/* إصلاح التخصيص المتقدم */
.cat-toggle-btn {
    background: none;
    border: none;
    color: var(--cat-primary);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 10px;
    width: 100%;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    margin-bottom: 10px;
}
.cat-toggle-btn:hover { text-decoration: underline; }
.cat-toggle-btn .arrow { transition: transform 0.3s; font-size: 0.8rem; }
.cat-toggle-btn.open .arrow { transform: rotate(180deg); }

.cat-advanced-content {
    /* إزالة أي إخفاء قسري */
    overflow: hidden;
    padding-top: 5px;
}

/* تحسين الحقول */
.cat-input-container {
    position: relative;
    margin-bottom: 1.5rem;
    border: 1px solid var(--cat-border);
    border-radius: 8px;
    background: #f9fafb;
}
.cat-input-container textarea, .cat-input-container input {
    background: transparent;
    border: none;
    width: 100%;
    padding: 1.5rem 1rem 0.5rem;
    font-size: 1rem;
    outline: none;
}
.cat-input-container label {
    position: absolute;
    top: 15px; right: 15px;
    color: #9ca3af;
    transition: 0.2s;
    pointer-events: none;
}
.cat-input-container textarea:focus + label,
.cat-input-container textarea:not(:placeholder-shown) + label,
.cat-input-container input:focus + label,
.cat-input-container input:not(:placeholder-shown) + label {
    top: 5px; font-size: 0.75rem; color: var(--cat-primary);
}

/* باقي التنسيقات (الزر، النتائج) كما هي في النسخة السابقة */
.cat-cta-btn {
    width: 100%;
    background: var(--cat-primary);
    color: #fff;
    padding: 15px;
    border-radius: 8px;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    font-weight: bold;
}
.cat-cta-btn:hover { background: #4338ca; }

.cat-pro-wrapper {
    background: var(--cat-bg);
    max-width: 680px;
    margin: 3rem auto;
    padding: 2.5rem;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.08);
    font-family: 'Tajawal', sans-serif;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.5);
}

/* Header */
.cat-head {
    text-align: center;
    margin-bottom: 2.5rem;
}

.cat-logo-icon {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--cat-primary), #818cf8);
    color: white;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    box-shadow: 0 8px 16px -4px rgba(99, 102, 241, 0.4);
}
.cat-logo-icon svg { width: 28px; height: 28px; }

.cat-head h2 { font-size: 2rem; color: var(--cat-text-main); margin: 0; font-weight: 800; }
.cat-head p { color: var(--cat-text-light); margin-top: 0.5rem; }

/* Floating Label Inputs */
.cat-input-container {
    position: relative;
    margin-bottom: 1.5rem;
    background: var(--cat-surface);
    border-radius: var(--cat-radius);
    border: 1px solid var(--cat-border);
    transition: all 0.3s ease;
}

.cat-input-container:focus-within {
    border-color: var(--cat-primary);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.cat-input-container textarea, 
.cat-input-container input {
    width: 100%;
    border: none;
    background: transparent;
    padding: 1.5rem 1rem 0.8rem;
    font-size: 1.1rem;
    color: var(--cat-text-main);
    outline: none;
    resize: none;
    font-family: inherit;
    border-radius: var(--cat-radius);
}

.cat-input-container label {
    position: absolute;
    top: 1.2rem;
    right: 1rem;
    color: var(--cat-text-light);
    transition: all 0.2s ease;
    pointer-events: none;
    font-size: 1rem;
}

.cat-input-container textarea:focus + label,
.cat-input-container textarea:not(:placeholder-shown) + label,
.cat-input-container input:focus + label,
.cat-input-container input:not(:placeholder-shown) + label {
    top: 0.4rem;
    font-size: 0.75rem;
    color: var(--cat-primary);
    font-weight: 600;
}

/* Custom Selects */
.cat-grid-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.cat-select-wrapper {
    position: relative;
}

.cat-select-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--cat-text-light);
    margin-bottom: 0.4rem;
    margin-right: 0.5rem;
}

.cat-custom-select {
    position: relative;
    background: var(--cat-surface);
    border: 1px solid var(--cat-border);
    border-radius: 10px;
}

.cat-custom-select select {
    width: 100%;
    padding: 12px 15px;
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    border: none;
    font-size: 0.95rem;
    color: var(--cat-text-main);
    cursor: pointer;
    font-family: inherit;
    outline: none;
}

.cat-select-arrow {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.7rem;
    color: var(--cat-primary);
    pointer-events: none;
}

/* Button */
.cat-cta-btn {
    width: 100%;
    background: linear-gradient(135deg, var(--cat-primary), var(--cat-primary-dark));
    color: white;
    padding: 16px;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.cat-cta-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -5px rgba(79, 70, 229, 0.4);
}

/* Results */
.cat-result-card {
    margin-top: 2rem;
    background: #fff;
    border: 1px solid var(--cat-border);
    border-radius: 16px;
    padding: 0;
    overflow: hidden;
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(40px); }
    to { opacity: 1; transform: translateY(0); }
}

.cat-result-header {
    background: var(--cat-surface);
    padding: 1.5rem;
    text-align: center;
    border-bottom: 1px solid var(--cat-border);
}

.score-badge {
    display: inline-block;
    width: 80px;
    height: 80px;
    line-height: 80px;
    border-radius: 50%;
    font-size: 2rem;
    font-weight: 900;
    color: white;
    margin-bottom: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.cat-result-body { padding: 1.5rem; }

.cat-insight {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.95rem;
    line-height: 1.6;
}
.cat-insight.bad { background: #fef2f2; border-right: 4px solid #ef4444; color: #991b1b; }
.cat-insight.good { background: #f0fdf4; border-right: 4px solid #10b981; color: #065f46; }

/* Paywall Overlay */
.cat-paywall-overlay {
    display: none;
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(5px);
    z-index: 10;
    align-items: center;
    justify-content: center;
}
.cat-paywall-box {
    background: white;
    padding: 2rem;
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.2);
    text-align: center;
    max-width: 90%;
    width: 400px;
    border: 1px solid var(--cat-border);
}
.cat-upgrade-link {
    display: inline-block;
    background: #111;
    color: #fff;
    text-decoration: none;
    padding: 12px 24px;
    border-radius: 30px;
    font-weight: bold;
    margin-top: 15px;
}

/* Advanced Toggle */
.cat-advanced-toggle input { display: none; }
.cat-advanced-toggle label {
    display: block; text-align: center;
    font-size: 0.85rem; color: var(--cat-primary);
    cursor: pointer; margin-bottom: 1rem;
    text-decoration: underline;
}
.cat-advanced-content { display: none; margin-top: 10px; }
.cat-advanced-toggle input:checked ~ .cat-advanced-content { display: block; animation: fadeIn 0.3s; }



/* --- Dashboard Layout --- */
.cat-dashboard-container {
    display: flex;
    background: #f8fafc;
    border-radius: 20px;
    overflow: hidden;
    min-height: 600px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.05);
    font-family: 'Tajawal', sans-serif;
    border: 1px solid #e2e8f0;
}

/* Sidebar */
.cat-sidebar {
    width: 260px;
    background: #fff;
    border-left: 1px solid #e2e8f0;
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
}

.cat-user-profile-summary {
    text-align: center;
    margin-bottom: 40px;
}
.cat-avatar img {
    border-radius: 50%;
    border: 4px solid #f1f5f9;
}
.cat-badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 800;
    margin-top: 5px;
    color: #fff;
}
.cat-badge.basic { background: #64748b; }
.cat-badge.pro { background: linear-gradient(135deg, #4f46e5, #818cf8); }
.cat-badge.teams { background: linear-gradient(135deg, #7c3aed, #a78bfa); }

.nav-item {
    display: flex;
    align-items: center;
    width: 100%;
    background: none;
    border: none;
    padding: 12px 15px;
    margin-bottom: 5px;
    border-radius: 10px;
    color: #64748b;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
    text-align: right;
}
.nav-item .icon { margin-left: 10px; font-size: 1.1rem; }
.nav-item:hover { background: #f1f5f9; color: #334155; }
.nav-item.active { background: #e0e7ff; color: #4f46e5; }
.nav-item.logout { color: #ef4444; margin-top: auto; }
.nav-item.logout:hover { background: #fee2e2; }

/* Content Area */
.cat-content-area {
    flex: 1;
    padding: 40px;
    overflow-y: auto;
}

.cat-tab-content { display: none; animation: fadeIn 0.4s ease; }
.cat-tab-content.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.cat-header-area { margin-bottom: 30px; }
.cat-header-area h2 { margin: 0 0 5px; color: #1e293b; }
.cat-header-area p { color: #94a3b8; margin: 0; }

/* Stats Cards */
.cat-stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}
.cat-stat-card {
    background: #fff;
    padding: 20px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.02);
    border: 1px solid #f1f5f9;
}
.cat-stat-card.highlight { border-color: #4f46e5; background: #eef2ff; }
.stat-icon {
    width: 50px; height: 50px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem;
}
.stat-icon.blue { background: #e0f2fe; color: #0284c7; }
.stat-icon.orange { background: #ffedd5; color: #ea580c; }
.stat-icon.green { background: #dcfce7; color: #16a34a; }

.stat-info .label { display: block; font-size: 0.85rem; color: #64748b; }
.stat-info .value { font-size: 1.5rem; font-weight: 800; color: #1e293b; }

/* Progress Bar */
.cat-usage-progress {
    background: #fff;
    padding: 25px;
    border-radius: 16px;
    border: 1px solid #f1f5f9;
}
.progress-info { display: flex; justify-content: space-between; margin-bottom: 10px; font-weight: bold; }
.progress-track { height: 10px; background: #f1f5f9; border-radius: 5px; overflow: hidden; margin-bottom: 10px; }
.progress-fill { height: 100%; background: #4f46e5; transition: width 0.5s ease; }

/* Settings Grid */
.cat-settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
}
@media (max-width: 768px) { .cat-settings-grid { grid-template-columns: 1fr; } }

.cat-card-box {
    background: #fff;
    padding: 25px;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
}
.cat-card-box h3 { margin-top: 0; border-bottom: 1px solid #f1f5f9; padding-bottom: 15px; margin-bottom: 20px; font-size: 1.1rem; }

.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 5px; font-size: 0.9rem; color: #475569; font-weight: 500; }
.form-group input {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 0.95rem;
}
.input-disabled { background: #f8fafc; color: #94a3b8; border-color: #e2e8f0; cursor: not-allowed; }

.cat-btn-save {
    width: 100%;
    background: #1e293b;
    color: #fff;
    padding: 12px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: 0.2s;
}
.cat-btn-save:hover { background: #0f172a; }

/* Table */
.cat-table-wrapper { background: #fff; border-radius: 16px; overflow: hidden; border: 1px solid #f1f5f9; }
.cat-history-table { width: 100%; border-collapse: collapse; }
.cat-history-table th { background: #f8fafc; padding: 15px; text-align: right; font-size: 0.85rem; color: #64748b; }
.cat-history-table td { padding: 15px; border-bottom: 1px solid #f1f5f9; color: #334155; }
.cat-tag { background: #f1f5f9; padding: 4px 8px; border-radius: 4px; font-size: 0.75rem; color: #475569; }
.score-indicator { padding: 4px 10px; border-radius: 12px; font-size: 0.8rem; font-weight: bold; color: #fff; }
.score-indicator.good { background: #10b981; }
.score-indicator.avg { background: #f59e0b; }
.score-indicator.bad { background: #ef4444; }

/* Responsive */
@media (max-width: 768px) {
    .cat-dashboard-container { flex-direction: column; }
    .cat-sidebar { width: 100%; border-right: none; border-bottom: 1px solid #e2e8f0; }
    .cat-content-area { padding: 20px; }
}