/* ===== CSS Reset & Variables ===== */
:root {
    --bg: #f0f4ff;
    --card: #ffffff;
    --text: #1e293b;
    --text2: #64748b;
    --primary: #4361ee;
    --primary2: #3a0ca3;
    --accent: #f72585;
    --success: #06d6a0;
    --warning: #ffd166;
    --danger: #ef476f;
    --border: #e2e8f0;
    --tab-bg: #e8edf8;
    --chat-bg: #f8faff;
    --msg-bot: #e8edf8;
    --shadow: 0 8px 30px rgba(67,97,238,0.12);
    --shadow2: 0 4px 15px rgba(0,0,0,0.08);
}

body.dark {
    --bg: #0a0f1e;
    --card: #111827;
    --text: #f1f5f9;
    --text2: #94a3b8;
    --border: #1e293b;
    --tab-bg: #1e293b;
    --chat-bg: #0f172a;
    --msg-bot: #1e293b;
}

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

body {
    font-family: 'Tajawal', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    transition: all 0.3s ease;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 10px;
}

/* ===== Focus Ring ===== */
input:focus, select:focus, textarea:focus, button:focus {
    outline: 4px solid rgba(67,97,238,0.1);
    outline-offset: 2px;
}

/* ===== Animations ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

.fadeInUp {
    animation: fadeInUp 0.4s ease forwards;
}

.slideInRight {
    animation: slideInRight 0.3s ease forwards;
}

.fadeOut {
    animation: fadeOut 0.3s ease forwards;
}

/* ===== Login/Register Screens ===== */
.login-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-container {
    background: var(--card);
    padding: 40px 30px;
    border-radius: 32px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow);
    text-align: center;
    animation: fadeInUp 0.5s ease;
}

.login-container .logo {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    margin: 0 auto 20px;
}

.login-container h2 {
    font-size: 26px;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 8px;
}

.login-container > p {
    color: var(--text2);
    font-size: 14px;
    margin-bottom: 25px;
}

.error-msg {
    background: rgba(239,71,111,0.1);
    color: var(--danger);
    padding: 12px;
    border-radius: 12px;
    margin-bottom: 15px;
    font-size: 13px;
    display: none;
}

.login-container input,
.login-container select {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border);
    border-radius: 14px;
    font-family: 'Tajawal', sans-serif;
    font-size: 14px;
    margin-bottom: 12px;
    background: var(--bg);
    color: var(--text);
    transition: border-color 0.3s;
}

.login-container input:focus,
.login-container select:focus {
    border-color: var(--primary);
}

.btn-primary-full {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--primary), var(--primary2));
    color: white;
    font-family: 'Tajawal', sans-serif;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primary-full:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.auth-link {
    display: inline-block;
    margin-top: 18px;
    color: var(--primary);
    text-decoration: none;
    font-size: 14px;
    cursor: pointer;
}

.auth-link:hover {
    text-decoration: underline;
}

/* ===== Main App ===== */
.app-hidden {
    display: none;
}

.app-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
}

/* ===== Header Card ===== */
.header-card {
    background: linear-gradient(135deg, var(--primary), var(--primary2), var(--accent));
    border-radius: 28px;
    padding: 80px 30px 30px;
    position: relative;
    overflow: hidden;
    text-align: center;
    color: white;
}

.header-card::before,
.header-card::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
}

.header-card::before {
    width: 200px;
    height: 200px;
    top: -100px;
    right: -50px;
}

.header-card::after {
    width: 150px;
    height: 150px;
    bottom: -75px;
    left: -30px;
}

.header-top-btns {
    position: absolute;
    top: 15px;
    left: 0;
    right: 0;
    padding: 0 15px;
    display: flex;
    justify-content: space-between;
}

.btn-icon {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(10px);
    cursor: pointer;
    font-size: 18px;
    transition: transform 0.2s;
}

.btn-icon:hover {
    transform: scale(1.1);
}

.header-logo {
    width: 70px;
    height: 70px;
    background: rgba(255,255,255,0.2);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    margin: 0 auto 15px;
}

.header-card h1 {
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 5px;
}

.header-card > p {
    font-size: 16px;
    opacity: 0.9;
}

.admin-badge {
    display: inline-block;
    background: linear-gradient(135deg, #ffd700, #ff8c00);
    color: #333;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    margin-top: 10px;
}

.btn-logout {
    position: absolute;
    bottom: 20px;
    left: 20px;
    padding: 10px 16px;
    border-radius: 50px;
    border: none;
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(10px);
    color: white;
    cursor: pointer;
    font-family: 'Tajawal', sans-serif;
    font-size: 13px;
    transition: transform 0.2s;
}

.btn-logout:hover {
    transform: scale(1.05);
}

/* ===== Tabs ===== */
.tabs-container {
    margin-top: 25px;
    overflow-x: auto;
    padding-bottom: 5px;
}

.tabs {
    display: flex;
    gap: 8px;
    background: var(--card);
    padding: 10px;
    border-radius: 50px;
    box-shadow: var(--shadow2);
    min-width: min-content;
}

.tab {
    padding: 10px 18px;
    border: none;
    border-radius: 50px;
    background: transparent;
    color: var(--text2);
    font-family: 'Tajawal', sans-serif;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.3s;
}

.tab:hover {
    background: var(--tab-bg);
}

.tab.active {
    background: linear-gradient(135deg, var(--primary), var(--primary2));
    color: white;
    box-shadow: 0 4px 15px rgba(67,97,238,0.3);
}

/* ===== Tab Contents ===== */
.tab-contents {
    margin-top: 25px;
}

.tab-content {
    display: none;
    animation: fadeInUp 0.4s ease;
}

.tab-content.active {
    display: block;
}

/* ===== Cards ===== */
.card {
    background: var(--card);
    border-radius: 20px;
    padding: 25px;
    box-shadow: var(--shadow2);
    margin-bottom: 20px;
}

.card h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 15px;
    color: var(--text);
}

/* ===== Stats Grid ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--card);
    border-radius: 20px;
    padding: 20px;
    text-align: center;
    box-shadow: var(--shadow2);
}

.gradient-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary2));
    color: white;
}

.gradient-accent {
    background: linear-gradient(135deg, var(--accent), #b5179e);
    color: white;
}

.gradient-success {
    background: linear-gradient(135deg, var(--success), #048a69);
    color: white;
}

.stat-value {
    font-size: 38px;
    font-weight: 900;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 13px;
    opacity: 0.85;
}

/* ===== Progress Card ===== */
.progress-card {
    text-align: center;
}

.progress-bar {
    width: 100%;
    height: 16px;
    background: var(--border);
    border-radius: 10px;
    overflow: hidden;
    margin: 15px 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--success), var(--primary));
    border-radius: 10px;
    transition: width 0.5s ease;
}

.progress-text {
    font-size: 14px;
    color: var(--text2);
    margin-bottom: 15px;
}

.badges-display {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.badge-item {
    background: var(--tab-bg);
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ===== Streak Bar ===== */
.streak-card {
    text-align: center;
}

.streak-bar {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 15px;
}

.streak-item {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    border: 2px solid var(--border);
    transition: all 0.3s;
}

.streak-item.completed {
    background: var(--success);
    color: white;
    border-color: var(--success);
}

.streak-item.today {
    border-color: var(--primary);
    animation: pulse 2s infinite;
}

.streak-item span {
    font-size: 11px;
}

/* ===== Personal Stats ===== */
.personal-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
}

.stat-mini {
    background: var(--card);
    border-radius: 16px;
    padding: 20px;
    text-align: center;
    box-shadow: var(--shadow2);
}

.stat-mini i {
    font-size: 24px;
    margin-bottom: 8px;
}

.stat-mini-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--text);
}

.stat-mini-label {
    font-size: 12px;
    color: var(--text2);
    margin-top: 5px;
}

/* ===== AI Modes Grid ===== */
.modes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.mode-card {
    background: var(--card);
    border: 2px solid var(--border);
    border-radius: 18px;
    padding: 25px 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.mode-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

.mode-card.active {
    border-color: var(--primary);
    box-shadow: 0 4px 20px rgba(67,97,238,0.2);
}

.mode-icon {
    font-size: 36px;
    margin-bottom: 10px;
}

.mode-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 5px;
}

.mode-desc {
    font-size: 12px;
    color: var(--text2);
}

/* ===== AI Panels ===== */
.ai-panel {
    display: none;
}

.ai-panel.active {
    display: block;
    animation: fadeInUp 0.4s ease;
}

/* ===== Chat Box ===== */
.chat-box {
    height: 380px;
    overflow-y: auto;
    background: var(--chat-bg);
    border-radius: 18px;
    padding: 20px;
    margin-bottom: 15px;
}

.chat-message {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
}

.chat-message.bot {
    align-items: flex-start;
}

.chat-message.user {
    align-items: flex-end;
}

.chat-bubble {
    max-width: 82%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 15px;
    line-height: 1.6;
}

.chat-message.bot .chat-bubble {
    background: var(--msg-bot);
    border-bottom-left-radius: 6px;
}

.chat-message.user .chat-bubble {
    background: linear-gradient(135deg, var(--primary), var(--primary2));
    color: white;
    border-bottom-right-radius: 6px;
}

/* ===== Typing Indicator ===== */
.typing-indicator {
    display: flex;
    gap: 5px;
    padding: 12px 16px;
    background: var(--msg-bot);
    border-radius: 16px;
    width: fit-content;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: var(--text2);
    border-radius: 50%;
    animation: bounce 1s infinite;
}

.typing-dot:nth-child(1) { animation-delay: 0s; }
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

/* ===== Send Row ===== */
.send-row {
    display: flex;
    gap: 10px;
}

.send-row textarea {
    flex: 1;
    padding: 14px;
    border: 2px solid var(--border);
    border-radius: 14px;
    font-family: 'Tajawal', sans-serif;
    font-size: 14px;
    resize: none;
    background: var(--card);
    color: var(--text);
}

.send-row textarea:focus {
    border-color: var(--primary);
}

.btn-send {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    border: none;
    background: linear-gradient(135deg, var(--primary), var(--primary2));
    color: white;
    font-size: 18px;
    cursor: pointer;
    transition: transform 0.2s;
}

.btn-send:hover {
    transform: scale(1.05);
}

/* ===== Quiz Settings ===== */
.quiz-settings {
    margin-bottom: 20px;
}

.input-group {
    margin-bottom: 15px;
}

.input-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text);
}

.input-group input,
.input-group select,
.input-group textarea {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid var(--border);
    border-radius: 12px;
    font-family: 'Tajawal', sans-serif;
    font-size: 14px;
    background: var(--bg);
    color: var(--text);
}

.input-group input:focus,
.input-group select:focus,
.input-group textarea:focus {
    border-color: var(--primary);
}

.btn-primary {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), var(--primary2));
    color: white;
    font-family: 'Tajawal', sans-serif;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s;
}

.btn-primary:hover {
    transform: translateY(-2px);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ===== Quiz Container ===== */
.quiz-container {
    background: var(--card);
    border-radius: 20px;
    padding: 25px;
    box-shadow: var(--shadow2);
}

.quiz-item {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.quiz-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.quiz-question {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 15px;
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.quiz-option {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: 12px;
    background: var(--card);
    text-align: right;
    font-family: 'Tajawal', sans-serif;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
}

.quiz-option:hover {
    border-color: var(--primary);
}

.quiz-option.correct {
    background: rgba(6,214,160,0.2);
    border-color: var(--success);
    color: var(--success);
}

.quiz-option.wrong {
    background: rgba(239,71,111,0.2);
    border-color: var(--danger);
    color: var(--danger);
}

.quiz-explain {
    margin-top: 10px;
    padding: 12px;
    background: var(--chat-bg);
    border-radius: 10px;
    font-size: 13px;
    color: var(--text2);
    display: none;
}

.quiz-explain.show {
    display: block;
}

.quiz-result {
    text-align: center;
    padding: 20px;
    margin-top: 20px;
}

.result-badge {
    display: inline-block;
    padding: 10px 25px;
    border-radius: 50px;
    font-size: 18px;
    font-weight: 700;
}

.result-badge.good {
    background: rgba(6,214,160,0.2);
    color: var(--success);
}

.result-badge.bad {
    background: rgba(239,71,111,0.2);
    color: var(--danger);
}

/* ===== Summary Output ===== */
.summary-output {
    background: var(--chat-bg);
    border-radius: 16px;
    padding: 18px;
    margin-top: 20px;
    white-space: pre-wrap;
    font-size: 14px;
    line-height: 1.8;
    display: none;
}

.summary-output.show {
    display: block;
}

/* ===== Plan Output ===== */
.plan-output {
    margin-top: 20px;
}

.plan-title {
    background: linear-gradient(135deg, var(--primary), var(--primary2));
    color: white;
    padding: 15px 20px;
    border-radius: 16px;
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 15px;
    display: none;
}

.plan-title.show {
    display: block;
}

.plan-tips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
    display: none;
}

.plan-tips.show {
    display: flex;
}

.plan-tip {
    background: rgba(247,37,133,0.15);
    color: var(--accent);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
}

.study-plan-item {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    padding: 15px;
    background: var(--card);
    border-right: 4px solid var(--primary);
    border-radius: 12px;
    margin-bottom: 10px;
    display: none;
}

.study-plan-item.show {
    display: flex;
}

.plan-day {
    font-size: 20px;
    font-weight: 800;
    color: var(--primary);
    min-width: 40px;
}

.plan-tasks {
    flex: 1;
}

.plan-task-item {
    margin-bottom: 5px;
    font-size: 14px;
}

/* ===== Forum ===== */
.create-post-card {
    margin-bottom: 25px;
}

.post-input-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.post-input-row textarea {
    flex: 1;
    padding: 12px;
    border: 2px solid var(--border);
    border-radius: 12px;
    font-family: 'Tajawal', sans-serif;
    font-size: 14px;
    resize: none;
    background: var(--bg);
    color: var(--text);
}

.post-input-row textarea:focus {
    border-color: var(--primary);
}

.avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    flex-shrink: 0;
}

.post-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.upload-image-btn {
    padding: 8px 14px;
    border: 2px dashed var(--border);
    border-radius: 10px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s;
}

.upload-image-btn:hover {
    border-color: var(--primary);
}

.upload-image-btn input {
    display: none;
}

.image-preview {
    max-width: 100px;
    max-height: 80px;
    display: none;
}

.image-preview.show {
    display: block;
}

.image-preview img {
    max-width: 100%;
    max-height: 80px;
    border-radius: 10px;
}

.btn-primary-sm {
    padding: 10px 20px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), var(--primary2));
    color: white;
    font-family: 'Tajawal', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    margin-right: auto;
}

/* ===== Posts ===== */
.posts-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.post-card {
    background: var(--card);
    border-radius: 18px;
    padding: 20px;
    box-shadow: var(--shadow2);
    animation: fadeInUp 0.4s ease;
    position: relative;
}

.post-card .delete-post-btn {
    position: absolute;
    top: 15px;
    left: 15px;
    padding: 6px 10px;
    border: none;
    border-radius: 8px;
    background: rgba(239,71,111,0.1);
    color: var(--danger);
    font-size: 12px;
    cursor: pointer;
    display: none;
}

.post-card.show-delete .delete-post-btn {
    display: block;
}

.post-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.post-author-info {
    flex: 1;
}

.post-author {
    font-size: 15px;
    font-weight: 700;
}

.post-date-stage {
    font-size: 12px;
    color: var(--text2);
    display: flex;
    gap: 8px;
}

.stage-badge {
    background: var(--tab-bg);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
}

.post-text {
    font-size: 14px;
    line-height: 1.7;
    margin-bottom: 12px;
}

.post-image {
    max-width: 100%;
    max-height: 280px;
    border-radius: 16px;
    margin-bottom: 12px;
}

.post-actions-row {
    display: flex;
    gap: 15px;
    border-top: 1px solid var(--border);
    padding-top: 12px;
}

.post-action-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 12px;
    border: none;
    border-radius: 10px;
    background: transparent;
    font-family: 'Tajawal', sans-serif;
    font-size: 13px;
    cursor: pointer;
    color: var(--text2);
    transition: all 0.3s;
}

.post-action-btn:hover {
    background: var(--tab-bg);
}

.post-action-btn.liked {
    color: var(--danger);
}

/* ===== Role Badges ===== */
.admin-badge {
    display: inline-block;
    background: linear-gradient(135deg, #ffd700, #ff8c00);
    color: #333;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    vertical-align: middle;
}

.dev-badge {
    display: inline-block;
    background: linear-gradient(135deg, #6c5ce7, #a29bfe);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    vertical-align: middle;
}

.post-action-btn.liked i {
    animation: pulse 0.3s;
}

/* ===== Comments ===== */
.comments-section {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border);
    display: none;
}

.comments-section.show {
    display: block;
}

.comment-item {
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.comment-item:last-child {
    border-bottom: none;
}

.comment-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
}

.comment-author {
    font-size: 13px;
    font-weight: 700;
}

.comment-date {
    font-size: 11px;
    color: var(--text2);
}

.comment-text {
    font-size: 13px;
    line-height: 1.6;
}

.comment-input-row {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.comment-input-row input {
    flex: 1;
    padding: 10px 12px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-family: 'Tajawal', sans-serif;
    font-size: 13px;
    background: var(--bg);
    color: var(--text);
}

.comment-input-row input:focus {
    border-color: var(--primary);
}

.comment-input-row button {
    padding: 10px 14px;
    border: none;
    border-radius: 10px;
    background: var(--primary);
    color: white;
    cursor: pointer;
}

/* ===== Tasks ===== */
.task-filters {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.filter-btn {
    padding: 10px 18px;
    border: 2px solid var(--border);
    border-radius: 50px;
    background: var(--card);
    font-family: 'Tajawal', sans-serif;
    font-size: 13px;
    cursor: pointer;
    color: var(--text2);
    transition: all 0.3s;
}

.filter-btn:hover,
.filter-btn.active {
    border-color: var(--primary);
    color: var(--primary);
}

.tasks-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.task-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: var(--card);
    border-radius: 16px;
    box-shadow: var(--shadow2);
    transition: opacity 0.3s;
}

.task-item.completed {
    opacity: 0.5;
}

.task-content {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.task-badge {
    background: rgba(67,97,238,0.15);
    color: var(--primary);
    padding: 4px 10px;
    border-radius: 10px;
    font-size: 12px;
}

.task-title {
    font-size: 14px;
    font-weight: 600;
}

.task-time {
    font-size: 12px;
    color: var(--text2);
}

.task-actions {
    display: flex;
    gap: 8px;
}

.task-complete-btn {
    padding: 8px 14px;
    border: none;
    border-radius: 10px;
    background: rgba(6,214,160,0.15);
    color: var(--success);
    font-size: 13px;
    cursor: pointer;
}

.task-delete-btn {
    padding: 8px 10px;
    border: none;
    border-radius: 10px;
    background: rgba(239,71,111,0.1);
    color: var(--danger);
    font-size: 13px;
    cursor: pointer;
}

.task-completed-text {
    color: var(--success);
    font-size: 13px;
}

/* ===== Schedule ===== */
.schedule-card {
    overflow-x: auto;
}

.schedule-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.schedule-table th {
    background: linear-gradient(135deg, var(--primary), var(--primary2));
    color: white;
    padding: 14px;
    font-size: 14px;
    font-weight: 600;
}

.schedule-table th:first-child {
    border-radius: 12px 0 0 0;
}

.schedule-table th:last-child {
    border-radius: 0 12px 0 0;
}

.schedule-table td {
    padding: 12px;
    text-align: center;
    border-bottom: 1px solid var(--border);
}

.schedule-table tbody tr:nth-child(even) {
    background: var(--chat-bg);
}

.schedule-input {
    width: 100%;
    padding: 8px;
    border: none;
    background: transparent;
    font-family: 'Tajawal', sans-serif;
    font-size: 13px;
    color: var(--text);
    text-align: center;
}

.schedule-input:focus {
    background: var(--tab-bg);
    border-radius: 6px;
}

.schedule-delete-btn {
    padding: 6px 10px;
    border: none;
    border-radius: 8px;
    background: rgba(239,71,111,0.1);
    color: var(--danger);
    font-size: 13px;
    cursor: pointer;
}

.schedule-actions {
    display: flex;
    gap: 10px;
}

.btn-secondary {
    padding: 14px 20px;
    border: 2px solid var(--primary);
    border-radius: 12px;
    background: transparent;
    color: var(--primary);
    font-family: 'Tajawal', sans-serif;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

/* ===== Settings ===== */
.settings-card {
    margin-bottom: 20px;
}

.theme-toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.toggle-btn {
    width: 56px;
    height: 30px;
    border-radius: 15px;
    background: var(--border);
    border: none;
    cursor: pointer;
    position: relative;
    transition: background 0.3s;
}

body.dark .toggle-btn {
    background: var(--primary);
}

.toggle-slider {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: white;
    position: absolute;
    top: 3px;
    right: 3px;
    transition: transform 0.3s;
}

body.dark .toggle-slider {
    transform: translateX(-26px);
}

.danger-zone {
    border: 2px solid rgba(239,71,111,0.3);
}

.danger-zone h3 {
    color: var(--danger);
}

.btn-danger {
    padding: 14px 20px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--danger), #d63447);
    color: white;
    font-family: 'Tajawal', sans-serif;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

/* ===== Admin Panel ===== */
.admin-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.admin-stat {
    background: var(--card);
    border-radius: 16px;
    padding: 20px;
    text-align: center;
    box-shadow: var(--shadow2);
}

.admin-stat i {
    font-size: 28px;
    color: var(--primary);
    margin-bottom: 10px;
}

.admin-stat-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--text);
}

.admin-stat-label {
    font-size: 12px;
    color: var(--text2);
    margin-top: 5px;
}

.reports-list,
.users-table-wrapper {
    max-height: 320px;
    overflow-y: auto;
}

.report-item {
    padding: 15px;
    border-bottom: 1px solid var(--border);
}

.report-item:last-child {
    border-bottom: none;
}

.report-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.report-author {
    font-size: 13px;
    font-weight: 700;
}

.report-date {
    font-size: 11px;
    color: var(--text2);
}

.report-content {
    font-size: 12px;
    color: var(--text2);
    margin-bottom: 5px;
}

.report-reason {
    font-size: 12px;
    color: var(--danger);
    margin-bottom: 10px;
}

.report-resolve-btn {
    padding: 8px 14px;
    border: none;
    border-radius: 10px;
    background: rgba(6,214,160,0.15);
    color: var(--success);
    font-size: 13px;
    cursor: pointer;
}

.users-table {
    width: 100%;
    border-collapse: collapse;
}

.users-table th {
    background: var(--tab-bg);
    padding: 12px;
    font-size: 13px;
    font-weight: 600;
    text-align: right;
}

.users-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

.role-badge {
    padding: 4px 10px;
    border-radius: 10px;
    font-size: 12px;
}

.role-admin {
    background: linear-gradient(135deg, #ffd700, #ff8c00);
    color: #333;
}

.role-user {
    background: var(--tab-bg);
    color: var(--text2);
}

/* ===== Modals ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.open {
    display: flex;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
}

.modal-card {
    position: relative;
    background: var(--card);
    border-radius: 28px;
    padding: 30px;
    width: 90%;
    max-width: 400px;
    box-shadow: var(--shadow);
    text-align: center;
    animation: fadeInUp 0.3s ease;
}

.modal-card h3 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 10px;
}

.modal-card p {
    color: var(--text2);
    font-size: 14px;
    margin-bottom: 20px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.btn-ghost {
    padding: 14px 20px;
    border: 2px solid var(--border);
    border-radius: 12px;
    background: transparent;
    color: var(--text2);
    font-family: 'Tajawal', sans-serif;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

/* ===== Daily Message Modal ===== */
.daily-message-card {
    max-width: 380px;
}

.daily-emoji {
    font-size: 48px;
    margin-bottom: 15px;
}

.daily-message-card h3 {
    margin-bottom: 15px;
}

.daily-message-card p {
    line-height: 1.7;
    margin-bottom: 10px;
}

.daily-time {
    display: block;
    font-size: 12px;
    color: var(--text2);
    margin-bottom: 20px;
}

/* ===== Toast ===== */
.toast-container {
    position: fixed;
    bottom: 28px;
    right: 28px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 2000;
}

.toast {
    background: linear-gradient(135deg, var(--success), var(--primary));
    color: white;
    padding: 14px 24px;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: var(--shadow);
    animation: slideInRight 0.3s ease;
}

.toast.fadeOut {
    animation: fadeOut 0.3s ease forwards;
}

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 40px 20px;
}

.empty-state i {
    font-size: 48px;
    color: var(--text2);
    margin-bottom: 15px;
    opacity: 0.5;
}

.empty-state p {
    color: var(--text2);
    font-size: 14px;
}

/* ===== Role Badges in Users Table ===== */
.role-badge {
    padding: 4px 10px;
    border-radius: 10px;
    font-size: 12px;
}

.role-admin {
    background: linear-gradient(135deg, #ffd700, #ff8c00);
    color: #333;
}

.role-dev {
    background: linear-gradient(135deg, #6c5ce7, #a29bfe);
    color: white;
}

.role-user {
    background: var(--tab-bg);
    color: var(--text2);
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
    body {
        padding: 12px;
    }

    .app-container {
        padding: 12px;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .stat-card {
        padding: 15px;
    }

    .stat-value {
        font-size: 28px;
    }

    .personal-stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .header-card {
        padding: 20px 15px;
        padding-top: 75px;
    }

    .header-card h1 {
        font-size: 22px;
    }

    .modes-grid {
        grid-template-columns: 1fr 1fr;
    }

    .chat-box {
        height: 300px;
    }

    .send-row {
        flex-direction: column;
    }

    .btn-send {
        width: 100%;
        height: 45px;
    }

    .modal-card {
        padding: 25px 20px;
        margin: 15px;
    }

    .toast-container {
        bottom: 15px;
        right: 15px;
        left: 15px;
    }

    .toast {
        text-align: center;
    }
}
