/* Admin Panel Styles */
@import url('../style.css');

:root {
    --admin-primary: #4b7691;
    --admin-primary-dark: #3a6580;
    --admin-sidebar-bg: #2c3e50;
    --admin-sidebar-hover: #34495e;
    --admin-body-bg: #f5f7fa;
}

* {
    font-family: var(--font-family);
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    background: var(--admin-body-bg);
    direction: rtl;
}

/* Admin Layout */
.admin-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.admin-sidebar {
    width: 280px;
    background: var(--admin-sidebar-bg);
    color: #fff;
    /* position: fixed; removed */
    overflow-y: auto;
}

.sidebar-header {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: #fff;
    text-decoration: none;
}

.sidebar-nav {
    padding: 15px 0;
}

.nav-section-title {
    padding: 10px 20px;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.3s ease;
}

.sidebar-menu li a:hover,
.sidebar-menu li a.active {
    background: var(--admin-sidebar-hover);
    color: #fff;
}

.sidebar-menu li a i {
    width: 20px;
    text-align: center;
}

/* Logout Button in Sidebar */
.sidebar-menu li .logout-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.3s ease;
    background: transparent;
    border: none;
    width: 100%;
    cursor: pointer;
    font-size: inherit;
    font-family: inherit;
    text-align: right;
}

.sidebar-menu li .logout-btn:hover {
    background: rgba(231, 76, 60, 0.3);
    color: #e74c3c;
}

/* Main Content */
.admin-main {
    flex: 1;
    min-width: 0;
    padding: 0;
}

/* Top Bar */
.admin-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    padding: 15px 25px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 25px;
}

.topbar-title h1 {
    margin: 0;
    font-size: 1.4rem;
    color: #333;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.admin-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--admin-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.stat-card {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.stat-card .stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    margin-bottom: 15px;
}

.stat-card .stat-icon.users {
    background: rgba(52, 152, 219, 0.15);
    color: #3498db;
}

.stat-card .stat-icon.questions {
    background: rgba(46, 204, 113, 0.15);
    color: #2ecc71;
}

.stat-card .stat-icon.categories {
    background: rgba(155, 89, 182, 0.15);
    color: #9b59b6;
}

.stat-card .stat-icon.answers {
    background: rgba(241, 196, 15, 0.15);
    color: #f1c40f;
}

.stat-card .stat-number {
    font-size: 1.8rem;
    font-weight: bold;
    color: #333;
}

.stat-card .stat-label {
    color: #888;
    font-size: 0.9rem;
}

/* Data Table */
.data-card {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    padding: 25px;
}

.data-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #eee;
}

.data-card-title {
    font-size: 1.1rem;
    color: #333;
    margin: 0;
}

.btn-add {
    background: var(--admin-primary);
    color: #fff;
    border: none;
    padding: 8px 20px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.3s ease;
}

.btn-add:hover {
    background: var(--admin-primary-dark);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 15px 20px;
    text-align: right;
    border-bottom: 1px solid #eee;
}

.data-table th {
    background: #f8f9fa;
    color: #555;
    font-weight: 600;
}

.data-table tbody tr:hover {
    background: #f8f9fa;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: var(--admin-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.85rem;
}

.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
}

.status-badge.active {
    background: rgba(46, 204, 113, 0.15);
    color: #2ecc71;
}

.status-badge.inactive {
    background: rgba(231, 76, 60, 0.15);
    color: #e74c3c;
}

.status-badge.pending {
    background: rgba(241, 196, 15, 0.15);
    color: #f1c40f;
}

.action-btns {
    display: flex;
    gap: 8px;
}

.action-btn {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.action-btn.edit {
    background: rgba(52, 152, 219, 0.15);
    color: #3498db;
}

.action-btn.delete {
    background: rgba(231, 76, 60, 0.15);
    color: #e74c3c;
}

.action-btn.view {
    background: rgba(46, 204, 113, 0.15);
    color: #2ecc71;
}

.action-btn:hover {
    opacity: 0.8;
}

/* Login Page */
.admin-login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--admin-primary) 0%, var(--admin-primary-dark) 100%);
}

.login-card {
    background: #fff;
    border-radius: 15px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    color: var(--admin-primary);
    margin: 0 0 10px;
}

.login-header p {
    color: #888;
    margin: 0;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form .form-label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 500;
}

.login-form .form-control {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.login-form .form-control:focus {
    outline: none;
    border-color: var(--admin-primary);
}

.btn-login {
    width: 100%;
    background: var(--admin-primary);
    color: #fff;
    border: none;
    padding: 14px;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.3s ease;
}

.btn-login:hover {
    background: var(--admin-primary-dark);
}

/* Responsive */
@media (max-width: 992px) {
    .admin-sidebar {
        width: 70px;
    }

    .admin-sidebar .sidebar-menu li a span,
    .admin-sidebar .nav-section-title,
    .admin-sidebar .sidebar-logo span {
        display: none;
    }

    .admin-main {
        margin-right: 0px !important;
    }
}

/* Profile Dropdown */
.profile-dropdown {
    position: relative;
}

.profile-dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 8px;
    transition: background 0.3s ease;
}

.profile-dropdown-toggle:hover {
    background: #f5f5f5;
}

.profile-dropdown-toggle .admin-avatar {
    margin: 0;
}

.profile-dropdown-toggle .admin-name {
    color: #333;
    font-weight: 500;
}

.profile-dropdown-toggle i.fa-chevron-down {
    font-size: 0.75rem;
    color: #888;
}

.profile-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    padding: 10px 0;
    display: none;
    z-index: 1000;
}

.profile-dropdown-menu.show {
    display: block;
}

.profile-dropdown-menu a,
.profile-dropdown-menu .dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: #555;
    text-decoration: none;
    transition: all 0.3s ease;
    background: none;
    border: none;
    width: 100%;
    cursor: pointer;
    font-size: inherit;
    font-family: inherit;
    text-align: right;
}

.profile-dropdown-menu a:hover,
.profile-dropdown-menu .dropdown-item:hover {
    background: #f5f5f5;
    color: var(--admin-primary);
}

.profile-dropdown-menu .logout-item {
    border-top: 1px solid #eee;
    margin-top: 5px;
    padding-top: 15px;
    color: #dc3545;
}

.profile-dropdown-menu .logout-item:hover {
    background: rgba(220, 53, 69, 0.1);
}

.topbar-link {
    color: var(--admin-primary);
    text-decoration: none;
    margin-left: 20px;
}

/* RTL Select Arrow Fix */
.admin-form select,
select.form-control {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23333333' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: left 12px center;
    background-size: 16px 12px;
    padding-left: 40px;
}

/* Unified Button Styles */
.btn-sm {
    padding: 6px 12px !important;
    font-size: 0.85rem !important;
}

.btn-primary,
.btn-save,
.btn-add {
    background: var(--admin-primary) !important;
    color: #fff !important;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s;
}

.btn-primary:hover,
.btn-save:hover,
.btn-add:hover {
    background: var(--admin-primary-dark) !important;
    transform: translateY(-1px);
}

.btn-secondary {
    background: #f5f5f5 !important;
    color: #333 !important;
    border: 1px solid #ddd;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
}

.btn-danger {
    background: #dc3545 !important;
    color: #fff !important;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
}

.btn-danger:hover {
    background: #c82333 !important;
}