/* Admin CRM Styling */
:root {
    --admin-bg: #f8fafc;
    --sidebar-bg: #1e293b;
    --sidebar-text: #94a3b8;
    --sidebar-active: #ffffff;
    --sidebar-accent: #38bdf8;
    --card-bg: #ffffff;
    --primary-blue: #0284c7;
    --accent-blue: #e0f2fe;
    --border-color: #e2e8f0;
    --text-main: #1e293b;
    --text-muted: #64748b;
}

.admin-body {
    background: var(--admin-bg);
    margin: 0;
    font-family: 'Outfit', 'Tajawal', sans-serif;
    color: var(--text-main);
}

.admin-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.admin-sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    box-sizing: border-box;
    z-index: 100;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #334155;
    margin-bottom: 2rem;
}

.admin-logo {
    height: 32px;
}

.sidebar-header span {
    color: white;
    font-weight: 700;
    font-size: 1.25rem;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    text-decoration: none;
    color: var(--sidebar-text);
    border-radius: 0.5rem;
    transition: all 0.3s;
    font-weight: 500;
}

.nav-item:hover {
    background: #334155;
    color: var(--sidebar-active);
}

.nav-item.active {
    background: var(--sidebar-accent);
    color: var(--sidebar-bg);
    font-weight: 700;
}

.nav-item.active i {
    color: var(--sidebar-bg);
}

.nav-item i {
    width: 20px;
    text-align: center;
}

.nav-item.logout {
    margin-top: auto;
    color: #f87171;
}

.nav-item.logout:hover {
    background: #450a0a;
}

/* Main Content */
.admin-main {
    flex: 1;
    margin-left: 260px;
    padding: 2rem;
    transition: all 0.3s;
}

.admin-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.admin-top-bar h1 {
    font-size: 1.5rem;
    margin: 0;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

/* Admin Language Switcher */
.lang-switcher-container-admin {
    display: flex;
    align-items: center;
    background: var(--accent-blue);
    padding: 0.4rem 0.8rem;
    border-radius: 0.75rem;
    border: 1px solid var(--primary-blue);
    gap: 0.5rem;
}

.lang-switcher-container-admin::before {
    content: "\f0ac";
    /* Globe icon */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    color: var(--primary-blue);
}

.lang-switcher-container-admin .lang-select {
    background: transparent !important;
    border: none !important;
    color: var(--primary-blue) !important;
    padding: 0 !important;
    font-weight: 600 !important;
    cursor: pointer;
    font-family: inherit;
    outline: none;
}

.lang-switcher-container-admin .lang-select option {
    background: white;
    color: var(--text-main);
}

.admin-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: white;
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    border: 1px solid var(--border-color);
    font-weight: 600;
}

.admin-user i {
    color: var(--primary-blue);
    font-size: 1.2rem;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.admin-section {
    animation: fadeIn 0.4s ease-out;
}

/* Stats */
.admin-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.admin-stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    transition: transform 0.3s;
}

.admin-stat-card:hover {
    transform: translateY(-5px);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

.stat-icon.insur {
    background: #dcfce7;
    color: #166534;
}

.stat-icon.bank {
    background: #dbeafe;
    color: #1e40af;
}

.stat-icon.telecom {
    background: #fef3c7;
    color: #92400e;
}

.stat-icon.total {
    background: #f3e8ff;
    color: #6b21a8;
}

.stat-info h3 {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.stat-info p {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
}

/* Content Card */
.admin-content-card {
    background: white;
    border-radius: 1rem;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    overflow: hidden;
}

.card-header {
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.card-header h2 {
    margin: 0;
    font-size: 1.25rem;
}

.header-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.search-wrapper {
    position: relative;
}

.search-wrapper i {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-wrapper input {
    padding: 0.5rem 1rem 0.5rem 2.25rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    width: 240px;
    outline: none;
    transition: border 0.3s;
}

.search-wrapper input:focus {
    border-color: var(--primary-blue);
}

.btn-add {
    background: var(--primary-blue);
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.3s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-add:hover {
    opacity: 0.9;
}

/* CRM Table */
.table-container {
    overflow-x: auto;
}

.crm-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

[dir="rtl"] .crm-table {
    text-align: right;
}

.crm-table th {
    background: #f8fafc;
    padding: 1rem 1.5rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 700;
    letter-spacing: 0.05em;
}

.crm-table td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.td-partner-name {
    font-weight: 600;
}

.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 2rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge.insur {
    background: #dcfce7;
    color: #166534;
}

.badge.bank {
    background: #dbeafe;
    color: #1e40af;
}

.badge.telecom {
    background: #fef3c7;
    color: #92400e;
}

.badge.offers {
    background: #f3e8ff;
    color: #6b21a8;
}

.action-btns {
    display: flex;
    gap: 0.5rem;
}

.btn-icon {
    width: 32px;
    height: 32px;
    border-radius: 0.4rem;
    border: 1px solid var(--border-color);
    background: white;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon.edit:hover {
    background: var(--accent-blue);
    border-color: var(--primary-blue);
    color: var(--primary-blue);
}

.btn-icon.delete:hover {
    background: #fee2e2;
    border-color: #ef4444;
    color: #ef4444;
}

/* Modal */
.admin-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.admin-modal.active {
    display: flex;
}

.admin-modal-content {
    background: white;
    width: 100%;
    max-width: 650px;
    border-radius: 1.5rem;
    overflow: hidden;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 1.5rem;
    background: #f8fafc;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.25rem;
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
}

.admin-form {
    padding: 1.5rem;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

.form-group.full-width {
    grid-column: span 2;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    box-sizing: border-box;
    font-family: inherit;
    outline: none;
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px var(--accent-blue);
}

.form-footer {
    padding-top: 2rem;
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

.btn-cancel {
    padding: 0.75rem 1.5rem;
    background: #f1f5f9;
    border: none;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
}

.btn-save {
    padding: 0.75rem 1.5rem;
    background: var(--primary-blue);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
}

/* RTL Support */
[dir="rtl"] .admin-sidebar {
    right: 0;
    left: auto;
    border-left: 1px solid #334155;
    border-right: none;
}

[dir="rtl"] .admin-main {
    margin-right: 260px;
    margin-left: 0;
}

[dir="rtl"] .search-wrapper i {
    right: 0.75rem;
    left: auto;
}

[dir="rtl"] .search-wrapper input {
    padding: 0.5rem 2.25rem 0.5rem 1rem;
}


[dir="rtl"] .form-footer {
    justify-content: flex-start;
}

/* Login Overlay Styling */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--sidebar-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.login-box {
    background: white;
    padding: 3rem;
    border-radius: 1.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 400px;
    text-align: center;
    animation: slideUp 0.4s ease-out;
}

.login-logo {
    height: 60px;
    margin-bottom: 2rem;
}

.login-box h2 {
    margin-bottom: 1.5rem;
    font-size: 1.75rem;
    color: var(--sidebar-bg);
}

.login-form .form-group {
    text-align: left;
    margin-bottom: 1.5rem;
}

[dir="rtl"] .login-form .form-group {
    text-align: right;
}

.login-form input {
    width: 100%;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    font-size: 1rem;
    margin-top: 0.5rem;
    outline: none;
    transition: all 0.3s;
}

.login-form input:focus {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 4px var(--accent-blue);
}

.login-form .btn-login {
    width: 100%;
    padding: 1rem;
    background: var(--primary-blue);
    color: white;
    border: none;
    border-radius: 0.75rem;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.3s;
}

.login-form .btn-login:hover {
    background: #0274ae;
}

.error-msg {
    color: #ef4444;
    margin-top: 1rem;
    font-weight: 600;
    font-size: 0.9rem;
}