/* =====================================================
   لوحة الإدارة - قسم الحسابات الآمنة
   ===================================================== */

:root {
    --admin-primary: #0d1b46;
    --admin-secondary: #005a9e;
    --admin-accent: #00b8d9;
    --admin-success: #10b981;
    --admin-warning: #f59e0b;
    --admin-danger: #ef4444;
    --admin-info: #3b82f6;
    --admin-bg: #f1f5f9;
    --admin-sidebar: #0d1b46;
    --admin-sidebar-hover: #1e3a8a;
    --admin-text: #1e293b;
    --admin-text-light: #64748b;
    --admin-border: #e2e8f0;
    --admin-card-bg: #ffffff;
    --admin-shadow: 0 2px 12px rgba(13, 27, 70, 0.08);
}

* { box-sizing: border-box; }

body {
    font-family: 'Cairo', sans-serif;
    background: var(--admin-bg);
    color: var(--admin-text);
    margin: 0;
    direction: rtl;
}

/* =================== LOGIN =================== */
.login-body {
    min-height: 100vh;
    background: linear-gradient(135deg, #0d1b46 0%, #005a9e 50%, #00b8d9 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.login-body::before,
.login-body::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
}

.login-body::before {
    width: 400px; height: 400px;
    top: -100px; right: -100px;
}

.login-body::after {
    width: 300px; height: 300px;
    bottom: -80px; left: -80px;
}

.login-container {
    width: 100%;
    max-width: 460px;
    z-index: 2;
}

.login-box {
    background: #fff;
    padding: 50px 40px;
    border-radius: 20px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.3);
}

.login-header { text-align: center; margin-bottom: 35px; }

.login-icon {
    width: 90px;
    height: 90px;
    line-height: 90px;
    background: linear-gradient(135deg, #0d1b46, #00b8d9);
    color: #fff;
    border-radius: 50%;
    margin: 0 auto 20px;
    font-size: 36px;
    box-shadow: 0 10px 30px rgba(13, 27, 70, 0.3);
}

.login-header h2 { color: var(--admin-primary); margin-bottom: 5px; font-weight: 800; }
.login-header p { color: var(--admin-text-light); margin: 0; font-size: 14px; }

.login-form .form-label {
    color: var(--admin-text);
    font-weight: 600;
    margin-bottom: 6px;
}

.login-form .form-label i { color: var(--admin-accent); margin-left: 6px; }

.login-form .form-control {
    border-radius: 10px;
    border: 1px solid var(--admin-border);
    padding: 12px 16px;
}

.login-form .form-control:focus {
    border-color: var(--admin-accent);
    box-shadow: 0 0 0 3px rgba(0, 184, 217, 0.15);
}

.btn-login {
    background: linear-gradient(135deg, #0d1b46, #00b8d9);
    color: #fff;
    border: none;
    padding: 14px;
    border-radius: 10px;
    font-weight: 700;
    margin-top: 10px;
    transition: all 0.3s;
}

.btn-login:hover {
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(13, 27, 70, 0.3);
}

.login-footer {
    text-align: center;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid var(--admin-border);
}

.login-footer a {
    color: var(--admin-text-light);
    text-decoration: none;
    font-size: 14px;
}

/* زر تثبيت التطبيق داخل صفحة الدخول */
.login-install-wrap {
    margin-top: 18px;
    text-align: center;
}

.btn-install-app {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    background: #fff;
    color: var(--admin-primary);
    border: 1.5px solid var(--admin-accent);
    padding: 11px 14px;
    border-radius: 10px;
    font-family: inherit;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-install-app.show { display: flex; }

.btn-install-app:hover {
    background: var(--admin-accent);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 184, 217, 0.25);
}

/* =================== LOGIN RESPONSIVE =================== */
@media (max-width: 575px) {
    .login-body { padding: 16px; align-items: flex-start; }
    .login-container { max-width: 100%; margin-top: 24px; }
    .login-box {
        padding: 32px 22px;
        border-radius: 16px;
    }
    .login-header { margin-bottom: 26px; }
    .login-icon {
        width: 70px;
        height: 70px;
        line-height: 70px;
        font-size: 28px;
        margin-bottom: 16px;
    }
    .login-header h2 { font-size: 22px; }
    .login-header p { font-size: 13px; }
    .login-form .form-control-lg {
        font-size: 15px;
        padding: 11px 14px;
    }
    .btn-login.btn-lg {
        font-size: 16px;
        padding: 13px;
    }
    .login-footer { margin-top: 20px; padding-top: 16px; }
}

@media (max-width: 360px) {
    .login-box { padding: 26px 18px; }
    .login-header h2 { font-size: 20px; }
}

/* =================== ADMIN LAYOUT =================== */
.admin-body {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: 270px;
    background: var(--admin-sidebar);
    color: rgba(255, 255, 255, 0.9);
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 1000;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 20px 25px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-brand {
    color: #fff;
    text-decoration: none;
    font-size: 18px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-brand i { color: var(--admin-accent); font-size: 26px; }

.sidebar-toggle {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
}

.sidebar-nav { padding: 15px 0; }
.sidebar-nav ul { list-style: none; padding: 0; margin: 0; }

.nav-section {
    color: rgba(255, 255, 255, 0.4);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    padding: 15px 25px 8px;
    font-weight: 700;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 25px;
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    transition: all 0.25s;
    font-size: 14px;
    border-right: 3px solid transparent;
}

.sidebar-nav a i {
    width: 20px;
    text-align: center;
    font-size: 16px;
}

.sidebar-nav a:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    border-right-color: var(--admin-accent);
}

.sidebar-nav a.active {
    background: rgba(0, 184, 217, 0.15);
    color: #fff;
    border-right-color: var(--admin-accent);
    font-weight: 600;
}

.sidebar-nav .badge { margin-right: auto; font-size: 10px; }

/* Main */
.admin-main {
    flex: 1;
    margin-right: 270px;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.admin-topbar {
    background: #fff;
    padding: 12px 25px;
    box-shadow: var(--admin-shadow);
    display: flex;
    align-items: center;
    gap: 15px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-toggle {
    background: transparent;
    border: none;
    font-size: 22px;
    color: var(--admin-text);
    cursor: pointer;
    display: none;
}

.topbar-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--admin-primary);
    margin: 0;
    flex: 1;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-user-btn {
    color: var(--admin-text) !important;
    text-decoration: none;
    font-weight: 600;
    border: none;
}

.admin-user-btn i { color: var(--admin-accent); font-size: 22px; margin-left: 6px; }

.admin-content { flex: 1; padding: 25px; }

.admin-footer {
    background: #fff;
    padding: 15px 25px;
    text-align: center;
    color: var(--admin-text-light);
    font-size: 14px;
    border-top: 1px solid var(--admin-border);
}

.admin-footer p { margin: 0; }

/* =================== WELCOME =================== */
.welcome-banner {
    background: linear-gradient(135deg, #0d1b46, #005a9e, #00b8d9);
    color: #fff;
    padding: 30px;
    border-radius: 16px;
    margin-bottom: 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    box-shadow: var(--admin-shadow);
}

.welcome-banner h2 { color: #fff; margin: 0 0 5px 0; }
.welcome-banner p { margin: 0; opacity: 0.9; }

.welcome-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* =================== STAT CARDS =================== */
.stat-card {
    background: #fff;
    padding: 25px;
    border-radius: 14px;
    box-shadow: var(--admin-shadow);
    display: flex;
    align-items: center;
    gap: 18px;
    transition: all 0.3s;
    border-right: 4px solid;
    height: 100%;
}

.stat-card:hover { transform: translateY(-5px); box-shadow: 0 8px 25px rgba(13, 27, 70, 0.12); }

.stat-card.stat-primary { border-color: var(--admin-primary); }
.stat-card.stat-success { border-color: var(--admin-success); }
.stat-card.stat-warning { border-color: var(--admin-warning); }
.stat-card.stat-info { border-color: var(--admin-info); }

.stat-icon {
    width: 65px;
    height: 65px;
    line-height: 65px;
    text-align: center;
    border-radius: 14px;
    font-size: 28px;
    color: #fff;
    flex-shrink: 0;
}

.stat-primary .stat-icon { background: linear-gradient(135deg, #0d1b46, #1e3a8a); }
.stat-success .stat-icon { background: linear-gradient(135deg, #10b981, #059669); }
.stat-warning .stat-icon { background: linear-gradient(135deg, #f59e0b, #d97706); }
.stat-info .stat-icon { background: linear-gradient(135deg, #3b82f6, #2563eb); }

.stat-info h3 { color: var(--admin-primary); margin: 0; font-size: 28px; font-weight: 800; }
.stat-info p { margin: 0; color: var(--admin-text); font-weight: 600; font-size: 14px; }
.stat-info small { color: var(--admin-text-light); font-size: 12px; }

/* =================== ADMIN CARDS =================== */
.admin-card {
    background: #fff;
    border-radius: 14px;
    border: none;
    box-shadow: var(--admin-shadow);
    overflow: hidden;
}

.admin-card .card-header {
    background: #fff;
    border-bottom: 1px solid var(--admin-border);
    padding: 18px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.admin-card .card-header h5 {
    margin: 0;
    color: var(--admin-primary);
    font-weight: 700;
    font-size: 16px;
}

.admin-card .card-header h5 i { color: var(--admin-accent); margin-left: 8px; }

.admin-card .card-body { padding: 22px; }

.svc-icon-mini {
    width: 38px;
    height: 38px;
    line-height: 38px;
    background: rgba(0, 184, 217, 0.1);
    color: var(--admin-accent);
    border-radius: 10px;
    text-align: center;
    font-size: 16px;
    flex-shrink: 0;
}

/* =================== MESSAGES =================== */
.message-item { border-bottom: 1px solid var(--admin-border); }
.message-item:last-child { border-bottom: none; }

.message-item a {
    display: flex;
    gap: 12px;
    padding: 16px 22px;
    text-decoration: none;
    color: var(--admin-text);
    align-items: center;
    transition: background 0.2s;
}

.message-item a:hover { background: var(--admin-bg); }
.message-item.unread { background: rgba(0, 184, 217, 0.04); }
.message-item.unread strong { color: var(--admin-primary); }

.msg-avatar {
    width: 42px;
    height: 42px;
    line-height: 42px;
    text-align: center;
    background: linear-gradient(135deg, var(--admin-primary), var(--admin-accent));
    color: #fff;
    border-radius: 50%;
    font-weight: 700;
    flex-shrink: 0;
}

.msg-info { flex: 1; min-width: 0; }
.msg-info strong { display: block; color: var(--admin-text); font-size: 14px; }
.msg-info p {
    color: var(--admin-text-light);
    margin: 2px 0;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.msg-info small { color: var(--admin-text-light); font-size: 11px; }

.msg-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--admin-danger);
    flex-shrink: 0;
}

/* =================== QUICK SERVICE CARD =================== */
.quick-service-card {
    background: var(--admin-bg);
    padding: 16px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s;
}

.quick-service-card:hover { background: rgba(0, 184, 217, 0.08); }

.qsc-icon {
    width: 50px;
    height: 50px;
    line-height: 50px;
    background: #fff;
    color: var(--admin-primary);
    border-radius: 12px;
    text-align: center;
    font-size: 22px;
    flex-shrink: 0;
}

.qsc-body { flex: 1; min-width: 0; }
.qsc-body h6 { margin: 0; font-size: 14px; color: var(--admin-text); }
.qsc-body small { color: var(--admin-text-light); font-size: 12px; }

.qsc-action {
    width: 36px;
    height: 36px;
    line-height: 36px;
    text-align: center;
    background: #fff;
    color: var(--admin-primary);
    border-radius: 8px;
    transition: all 0.2s;
}

.qsc-action:hover { background: var(--admin-accent); color: #fff; }

/* =================== FORMS =================== */
.form-card {
    background: #fff;
    border-radius: 14px;
    box-shadow: var(--admin-shadow);
    padding: 30px;
    margin-bottom: 20px;
}

.form-section-title {
    font-weight: 700;
    color: var(--admin-primary);
    border-bottom: 2px solid var(--admin-accent);
    padding-bottom: 8px;
    margin-bottom: 20px;
    display: inline-block;
}

.admin-content .form-control,
.admin-content .form-select {
    border-radius: 8px;
    border: 1px solid var(--admin-border);
    padding: 10px 14px;
    transition: all 0.2s;
}

.admin-content .form-control:focus,
.admin-content .form-select:focus {
    border-color: var(--admin-accent);
    box-shadow: 0 0 0 3px rgba(0, 184, 217, 0.15);
}

.image-preview-box {
    width: 100%;
    max-width: 280px;
    height: 180px;
    border: 2px dashed var(--admin-border);
    border-radius: 10px;
    background: var(--admin-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-bottom: 12px;
}

.image-preview-box img {
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
}

.image-preview-box .placeholder {
    color: var(--admin-text-light);
    text-align: center;
    font-size: 14px;
}

.btn-save {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    border: none;
    padding: 10px 28px;
    border-radius: 8px;
    font-weight: 700;
}

.btn-save:hover { color: #fff; transform: translateY(-2px); }

/* =================== TABLES =================== */
.admin-content .table {
    color: var(--admin-text);
    background: #fff;
}

.admin-content .table thead th {
    background: var(--admin-bg);
    color: var(--admin-primary);
    font-weight: 700;
    border-bottom: 2px solid var(--admin-border);
    text-transform: none;
    font-size: 14px;
}

.admin-content .table tbody td {
    padding: 12px 14px;
    vertical-align: middle;
    border-color: var(--admin-border);
    font-size: 14px;
}

.action-btns { display: flex; gap: 5px; }

.action-btns .btn {
    width: 34px;
    height: 34px;
    line-height: 34px;
    padding: 0;
    text-align: center;
    border-radius: 8px;
    font-size: 14px;
}

/* Status toggle */
.status-toggle {
    display: inline-block;
    width: 50px;
    height: 26px;
    background: #cbd5e1;
    border-radius: 50px;
    position: relative;
    cursor: pointer;
    transition: all 0.3s;
}

.status-toggle::after {
    content: '';
    position: absolute;
    top: 3px;
    right: 3px;
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 50%;
    transition: all 0.3s;
}

.status-toggle.active { background: var(--admin-success); }
.status-toggle.active::after { right: 27px; }

/* Settings tabs */
.admin-card .nav-pills .nav-link {
    color: var(--admin-text);
    border-radius: 8px;
    font-size: 13px;
    padding: 8px 14px;
}

.admin-card .nav-pills .nav-link.active {
    background: var(--admin-primary);
    color: #fff;
}

/* =================== RESPONSIVE =================== */
@media (max-width: 991px) {
    .admin-sidebar { transform: translateX(100%); }
    .admin-sidebar.show { transform: translateX(0); }
    .admin-main { margin-right: 0; }
    .topbar-toggle { display: block; }
}

@media (max-width: 575px) {
    .admin-content { padding: 15px; }
    .form-card { padding: 20px; }
    .welcome-banner { padding: 20px; }
    .welcome-banner h2 { font-size: 22px; }
    .stat-card { padding: 18px; gap: 12px; }
    .stat-icon { width: 50px; height: 50px; line-height: 50px; font-size: 22px; }
    .stat-info h3 { font-size: 22px; }
}

/* ===== Banner Live Preview ===== */
.banner-preview {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 5;
    border-radius: 14px;
    overflow: hidden;
    background: #0d1b46;
    border: 1px solid #e3e8f0;
}

.banner-preview-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.banner-preview-empty {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #8a93a6;
    text-align: center;
    font-size: 14px;
}

.banner-preview-caption {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    text-align: right;
    gap: 12px;
    padding: 0 6%;
    color: #fff;
    background: linear-gradient(90deg, rgba(13, 27, 70, 0.78) 0%, rgba(13, 27, 70, 0.45) 45%, rgba(13, 27, 70, 0) 80%);
    pointer-events: none;
}

.banner-preview-title {
    font-size: 1.8rem;
    font-weight: 800;
    margin: 0;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
    max-width: 70%;
}

.banner-preview-title:empty,
.banner-preview-subtitle:empty {
    display: none;
}

.banner-preview-subtitle {
    font-size: 1rem;
    margin: 0;
    max-width: 65%;
    line-height: 1.7;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

.banner-preview-btn {
    margin-top: 4px;
}

@media (max-width: 575px) {
    .banner-preview { aspect-ratio: 4 / 3; }
    .banner-preview-title { font-size: 1.2rem; max-width: 85%; }
    .banner-preview-subtitle { font-size: 0.8rem; max-width: 85%; }
}

/* ===== روبوت التدريب السريع (لوحة الإدارة) ===== */
.admin-bot-wrap {
    position: fixed;
    bottom: 28px;
    left: 28px;
    z-index: 1080;
}

.admin-bot-toggle {
    position: relative;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    background: linear-gradient(135deg, #0d1b46 0%, #005a9e 60%, #00b8d9 100%);
    color: #fff;
    font-size: 25px;
    box-shadow: 0 10px 26px rgba(13, 27, 70, 0.4);
    transition: transform 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.admin-bot-toggle:hover { transform: scale(1.08); }

.admin-bot-tip {
    position: absolute;
    bottom: 14px;
    left: 72px;
    white-space: nowrap;
    background: #0d1b46;
    color: #fff;
    padding: 9px 16px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 700;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
    opacity: 0;
    visibility: hidden;
    transform: scale(0.8);
    transform-origin: left center;
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}

.admin-bot-tip::before {
    content: '';
    position: absolute;
    top: 50%;
    left: -7px;
    transform: translateY(-50%);
    border-top: 7px solid transparent;
    border-bottom: 7px solid transparent;
    border-right: 8px solid #0d1b46;
}

.admin-bot-tip.show {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}

.admin-bot-icon { animation: adminBotFloat 2.2s ease-in-out infinite; }
.admin-bot-close { display: none; }
.admin-bot-wrap.open .admin-bot-icon { display: none; }
.admin-bot-wrap.open .admin-bot-close { display: inline-block; }

@keyframes adminBotFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

.admin-bot-panel {
    position: absolute;
    bottom: 74px;
    left: 0;
    width: 330px;
    max-width: calc(100vw - 36px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 18px 50px rgba(13, 27, 70, 0.3);
    overflow: hidden;
    transform: translateY(16px) scale(0.97);
    opacity: 0;
    transform-origin: bottom left;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.admin-bot-wrap.open .admin-bot-panel {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.admin-bot-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 16px;
    background: linear-gradient(135deg, #0d1b46 0%, #005a9e 100%);
    color: #fff;
}

.admin-bot-header i { font-size: 22px; }
.admin-bot-header strong { display: block; font-size: 15px; }
.admin-bot-header span { font-size: 12px; opacity: 0.9; }

.admin-bot-body { padding: 16px; }
.admin-bot-body label { font-size: 13px; font-weight: 600; margin-bottom: 4px; display: block; }
.admin-bot-body .form-control { font-size: 14px; }

.admin-bot-alert {
    padding: 9px 12px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 10px;
}

.admin-bot-alert.ok { background: #d1fae5; color: #065f46; }
.admin-bot-alert.err { background: #fee2e2; color: #991b1b; }

.admin-bot-link {
    display: block;
    text-align: center;
    margin-top: 12px;
    font-size: 13px;
    font-weight: 600;
    color: #005a9e;
    text-decoration: none;
}

.admin-bot-link:hover { color: #0d1b46; }

@media (max-width: 575px) {
    .admin-bot-wrap { bottom: 18px; left: 18px; }
}
