/* ========== متغيرات CSS ========== */
:root {
    --primary-color: #6c5ce7;
    --primary-dark: #5b4cdb;
    --secondary-color: #00cec9;
    --success-color: #00b894;
    --warning-color: #fdcb6e;
    --danger-color: #e74c3c;
    --info-color: #74b9ff;
    --purple-color: #a29bfe;
    --orange-color: #e17055;
    
    --bg-dark: #1a1a2e;
    --bg-darker: #16213e;
    --bg-card: #1f1f3a;
    --bg-card-hover: #2a2a4a;
    
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --text-muted: #6c6c7c;
    
    --border-color: rgba(255, 255, 255, 0.1);
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    
    --sidebar-width: 260px;
    --header-height: 70px;
}

/* ========== Reset & Base ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--bg-dark) 0%, var(--bg-darker) 100%);
    color: var(--text-primary);
    min-height: 100vh;
    direction: rtl;
}

/* ========== Layout ========== */
.admin-container {
    display: flex;
    min-height: 100vh;
}

/* ========== Sidebar ========== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-card);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    z-index: 100;
}

.logo-section {
    padding: 25px 20px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.logo-section .logo {
    width: 60px;
    height: 60px;
    border-radius: 15px;
    margin-bottom: 10px;
}

.logo-section h2 {
    font-size: 18px;
    color: var(--primary-color);
}

.nav-menu {
    flex: 1;
    padding: 20px 0;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 25px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.3s ease;
    border-right: 3px solid transparent;
}

.nav-item:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: rgba(108, 92, 231, 0.1);
    color: var(--primary-color);
    border-right-color: var(--primary-color);
}

.nav-item .icon {
    font-size: 20px;
}

.nav-item .text {
    font-size: 14px;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
}

.back-link {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 12px 15px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.back-link:hover {
    background: var(--bg-card-hover);
    color: var(--primary-color);
}

/* ========== Main Content ========== */
.main-content {
    flex: 1;
    margin-right: var(--sidebar-width);
    padding: 20px 30px;
    min-height: 100vh;
}

/* ========== Header ========== */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

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

.header .date {
    color: var(--text-secondary);
    font-size: 14px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.search-box {
    position: relative;
}

.search-box input {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 25px;
    padding: 12px 45px 12px 20px;
    color: var(--text-primary);
    width: 250px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.1);
}

.search-box .search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-card);
    padding: 8px 15px;
    border-radius: 25px;
}

.user-avatar {
    font-size: 24px;
}

/* ========== Stats Grid ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: 15px;
    padding: 25px;
    display: flex;
    align-items: center;
    gap: 15px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

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

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 4px;
    height: 100%;
}

.stat-card.primary::before { background: var(--primary-color); }
.stat-card.success::before { background: var(--success-color); }
.stat-card.warning::before { background: var(--warning-color); }
.stat-card.info::before { background: var(--info-color); }
.stat-card.purple::before { background: var(--purple-color); }
.stat-card.orange::before { background: var(--orange-color); }

.stat-icon {
    font-size: 40px;
    opacity: 0.8;
}

.stat-info h3 {
    font-size: 28px;
    margin-bottom: 5px;
}

.stat-info p {
    color: var(--text-secondary);
    font-size: 13px;
}

.stat-trend {
    position: absolute;
    top: 15px;
    left: 15px;
    font-size: 12px;
    padding: 3px 8px;
    border-radius: 10px;
}

.stat-trend.up {
    background: rgba(0, 184, 148, 0.2);
    color: var(--success-color);
}

.stat-trend.down {
    background: rgba(231, 76, 60, 0.2);
    color: var(--danger-color);
}

/* ========== Charts Grid ========== */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.chart-card {
    background: var(--bg-card);
    border-radius: 15px;
    padding: 25px;
}

.chart-card h3 {
    margin-bottom: 20px;
    font-size: 16px;
    color: var(--text-secondary);
}

.chart-container {
    height: 250px;
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    gap: 10px;
    padding: 20px 0;
}

/* Simple Bar Chart */
.bar {
    width: 40px;
    background: linear-gradient(180deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border-radius: 8px 8px 0 0;
    transition: all 0.3s ease;
    position: relative;
}

.bar:hover {
    opacity: 0.8;
    transform: scaleY(1.05);
}

.bar::after {
    content: attr(data-value);
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    color: var(--text-secondary);
}

/* ========== Recent Section ========== */
.recent-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
}

.recent-card {
    background: var(--bg-card);
    border-radius: 15px;
    padding: 25px;
}

.recent-card h3 {
    margin-bottom: 20px;
    font-size: 16px;
}

.recent-list {
    max-height: 300px;
    overflow-y: auto;
}

.recent-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 10px;
    background: var(--bg-card-hover);
    transition: all 0.3s ease;
}

.recent-item:hover {
    background: rgba(108, 92, 231, 0.1);
}

.recent-item .icon {
    font-size: 24px;
}

.recent-item .info {
    flex: 1;
}

.recent-item .info .title {
    font-size: 14px;
    margin-bottom: 3px;
}

.recent-item .info .subtitle {
    font-size: 12px;
    color: var(--text-secondary);
}

.recent-item .time {
    font-size: 12px;
    color: var(--text-muted);
}

/* ========== Sections ========== */
.section {
    display: none;
}

.section.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.section-header h2 {
    font-size: 24px;
}

.section-desc {
    color: var(--text-secondary);
    margin-top: 5px;
}

/* ========== Filters ========== */
.filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.filters select,
.filters input {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 15px;
    color: var(--text-primary);
    font-size: 14px;
}

.filters select:focus,
.filters input:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* ========== Buttons ========== */
.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(108, 92, 231, 0.4);
}

.btn-secondary {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: var(--bg-card);
    border-color: var(--primary-color);
}

.btn-danger {
    background: var(--danger-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.btn-filter {
    background: var(--secondary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
}

.btn-export {
    background: var(--success-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
}

/* ========== Table ========== */
.table-container {
    background: var(--bg-card);
    border-radius: 15px;
    overflow: hidden;
}

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

.data-table th,
.data-table td {
    padding: 15px;
    text-align: right;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background: var(--bg-card-hover);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 13px;
}

.data-table tbody tr {
    transition: all 0.3s ease;
}

.data-table tbody tr:hover {
    background: rgba(108, 92, 231, 0.05);
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 12px;
}

.status-badge.completed {
    background: rgba(0, 184, 148, 0.2);
    color: var(--success-color);
}

.status-badge.missed {
    background: rgba(231, 76, 60, 0.2);
    color: var(--danger-color);
}

.status-badge.busy {
    background: rgba(253, 203, 110, 0.2);
    color: var(--warning-color);
}

.action-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    padding: 5px;
    transition: all 0.3s ease;
}

.action-btn:hover {
    transform: scale(1.2);
}

/* ========== Pagination ========== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 20px;
}

.pagination button {
    background: var(--bg-card-hover);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 15px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.pagination button.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.pagination button:hover:not(.active) {
    border-color: var(--primary-color);
}

/* ========== Employees Grid ========== */
.employees-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.employee-card {
    background: var(--bg-card);
    border-radius: 15px;
    padding: 25px;
    text-align: center;
    transition: all 0.3s ease;
}

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

.employee-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    margin: 0 auto 15px;
}

.employee-card h4 {
    font-size: 18px;
    margin-bottom: 5px;
}

.employee-card .department {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 15px;
}

.employee-stats {
    display: flex;
    justify-content: space-around;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.employee-stats .stat {
    text-align: center;
}

.employee-stats .stat .value {
    font-size: 20px;
    font-weight: bold;
    color: var(--primary-color);
}

.employee-stats .stat .label {
    font-size: 12px;
    color: var(--text-secondary);
}

/* ========== Analytics Grid ========== */
.analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
}

.analytics-card {
    background: var(--bg-card);
    border-radius: 15px;
    padding: 25px;
}

.analytics-card.full-width {
    grid-column: 1 / -1;
}

.analytics-card h3 {
    margin-bottom: 20px;
    font-size: 16px;
}

.date-range {
    display: flex;
    align-items: center;
    gap: 10px;
}

.date-range input {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 15px;
    color: var(--text-primary);
}

/* ========== Transcripts Section ========== */
.transcripts-container {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 20px;
    min-height: 500px;
}

.transcript-list {
    background: var(--bg-card);
    border-radius: 15px;
    padding: 20px;
    max-height: 600px;
    overflow-y: auto;
}

.transcript-item {
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 10px;
    background: var(--bg-card-hover);
    cursor: pointer;
    transition: all 0.3s ease;
}

.transcript-item:hover,
.transcript-item.active {
    background: rgba(108, 92, 231, 0.2);
    border-right: 3px solid var(--primary-color);
}

.transcript-item .phone {
    font-weight: bold;
    margin-bottom: 5px;
}

.transcript-item .meta {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
}

.transcript-viewer {
    background: var(--bg-card);
    border-radius: 15px;
    padding: 25px;
    display: flex;
    flex-direction: column;
}

.transcript-header {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.transcript-meta {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 10px;
}

.transcript-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: var(--bg-card-hover);
    border-radius: 10px;
    margin-bottom: 20px;
}

.transcript-content .placeholder {
    text-align: center;
    color: var(--text-muted);
    padding: 50px;
}

.transcript-content .message {
    margin-bottom: 15px;
    padding: 12px 15px;
    border-radius: 12px;
    max-width: 80%;
}

.transcript-content .message.agent {
    background: rgba(108, 92, 231, 0.2);
    margin-left: auto;
}

.transcript-content .message.customer {
    background: var(--bg-card);
    margin-right: auto;
}

.transcript-content .message .speaker {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 5px;
}

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

/* ========== Missed Calls Grid ========== */
.missed-stats {
    display: flex;
    gap: 20px;
}

.missed-stats .stat {
    background: var(--bg-card);
    padding: 8px 15px;
    border-radius: 20px;
}

.missed-stats .stat strong {
    color: var(--danger-color);
}

.missed-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
}

.missed-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 20px;
    border-right: 4px solid var(--danger-color);
}

.missed-card .phone {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 10px;
}

.missed-card .details {
    font-size: 13px;
    color: var(--text-secondary);
}

.missed-card .actions {
    margin-top: 15px;
    display: flex;
    gap: 10px;
}

.missed-card .btn-callback {
    background: var(--success-color);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
}

/* ========== Settings Grid ========== */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
}

.settings-card {
    background: var(--bg-card);
    border-radius: 15px;
    padding: 25px;
}

.settings-card h3 {
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 0;
    border-bottom: 1px solid var(--border-color);
}

.setting-item:last-of-type {
    border-bottom: none;
}

.setting-item label {
    color: var(--text-secondary);
}

.setting-item input[type="text"],
.setting-item input[type="email"] {
    background: var(--bg-card-hover);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 8px 12px;
    color: var(--text-primary);
    width: 200px;
}

.setting-item .status {
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 12px;
}

.setting-item .status.connected {
    background: rgba(0, 184, 148, 0.2);
    color: var(--success-color);
}

.setting-item .status.disconnected {
    background: rgba(231, 76, 60, 0.2);
    color: var(--danger-color);
}

/* Switch Toggle */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-card-hover);
    transition: 0.3s;
    border-radius: 26px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    right: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--primary-color);
}

input:checked + .slider:before {
    transform: translateX(-24px);
}

/* ========== Modal ========== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border-radius: 20px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow: hidden;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 18px;
}

.close-modal {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 28px;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close-modal:hover {
    color: var(--danger-color);
}

.modal-body {
    padding: 25px;
    overflow-y: auto;
    max-height: calc(80vh - 80px);
}

/* Progress Bar */
.transcribe-progress {
    text-align: center;
    padding: 30px;
}

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

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    width: 0%;
    transition: width 0.3s ease;
}

/* ========== Scrollbar ========== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-darker);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-card-hover);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* ========== Responsive ========== */
@media (max-width: 1200px) {
    .transcripts-container {
        grid-template-columns: 1fr;
    }
    
    .transcript-list {
        max-height: 300px;
    }
}

@media (max-width: 992px) {
    .sidebar {
        width: 70px;
    }
    
    .logo-section h2,
    .nav-item .text,
    .back-link .text {
        display: none;
    }
    
    .nav-item {
        justify-content: center;
        padding: 14px;
    }
    
    .main-content {
        margin-right: 70px;
    }
    
    .charts-grid,
    .analytics-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    /* إخفاء السايدبار وإظهار زر القائمة */
    .sidebar {
        position: fixed;
        right: -280px;
        width: 280px;
        transition: right 0.3s ease;
        z-index: 1000;
    }
    
    .sidebar.open {
        right: 0;
    }
    
    .logo-section h2,
    .nav-item .text,
    .back-link .text {
        display: block;
    }
    
    .nav-item {
        justify-content: flex-start;
        padding: 14px 25px;
    }
    
    .main-content {
        margin-right: 0;
        padding: 15px;
    }
    
    /* زر فتح القائمة */
    .mobile-menu-btn {
        display: flex !important;
    }
    
    /* خلفية شفافة عند فتح القائمة */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }
    
    .sidebar-overlay.show {
        display: block;
    }
    
    .header {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }
    
    .header-left {
        width: 100%;
        justify-content: space-between;
    }
    
    .search-box {
        width: 100%;
        order: 3;
    }
    
    .search-box input {
        width: 100%;
    }
    
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    
    .stat-card {
        padding: 15px;
    }
    
    .stat-card .value {
        font-size: 24px;
    }
    
    .filters {
        flex-direction: column;
        gap: 10px;
        padding: 15px;
    }
    
    .filters select,
    .filters input {
        width: 100%;
    }
    
    /* جدول المكالمات - تمرير أفقي */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .data-table {
        min-width: 800px;
    }
    
    .data-table th,
    .data-table td {
        padding: 10px 8px;
        font-size: 13px;
    }
    
    /* بطاقات الموظفين */
    .employees-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    
    .employee-card {
        padding: 15px;
    }
    
    /* المكالمات الفائتة */
    .missed-grid {
        grid-template-columns: 1fr;
    }
    
    /* الرسوم البيانية */
    .charts-grid {
        grid-template-columns: 1fr;
    }
    
    .chart-container {
        padding: 15px;
    }
    
    /* الأقسام الأخيرة */
    .recent-section {
        grid-template-columns: 1fr;
    }
    
    /* Modal */
    .modal-content {
        width: 95%;
        margin: 10px;
        max-height: 90vh;
    }
    
    .modal-header {
        padding: 15px;
    }
    
    .modal-body {
        padding: 15px;
    }
}

@media (max-width: 576px) {
    .main-content {
        padding: 10px;
    }
    
    .header {
        padding: 10px;
    }
    
    .page-title {
        font-size: 18px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .stat-card {
        padding: 12px;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
    
    .stat-card .icon {
        font-size: 24px;
        margin-bottom: 0;
    }
    
    .stat-card .info {
        text-align: left;
    }
    
    .stat-card .value {
        font-size: 20px;
    }
    
    .stat-card .label {
        font-size: 11px;
    }
    
    /* بطاقات الموظفين */
    .employees-grid {
        grid-template-columns: 1fr;
    }
    
    /* حجم النصوص */
    .section-title {
        font-size: 16px;
    }
    
    .card-title {
        font-size: 14px;
    }
    
    /* الأزرار */
    .btn-primary,
    .btn-secondary {
        padding: 10px 15px;
        font-size: 13px;
    }
    
    .action-btn {
        padding: 6px 8px;
        font-size: 12px;
    }
    
    /* Transcripts */
    .transcripts-container {
        gap: 15px;
    }
    
    .transcript-list {
        max-height: 200px;
    }
    
    .transcript-content {
        padding: 15px;
        font-size: 14px;
    }
    
    /* إحصائيات المكالمات الفائتة */
    .missed-stats {
        flex-direction: column;
        gap: 10px;
    }
    
    .missed-stat-card {
        padding: 12px 15px;
    }
    
    /* Pagination */
    .pagination {
        flex-wrap: wrap;
        gap: 5px;
    }
    
    .pagination button {
        padding: 8px 12px;
        font-size: 12px;
    }
    
    /* تصدير */
    #export-calls {
        width: 100%;
        margin-top: 10px;
    }
    
    /* فلاتر */
    .filter-group {
        flex-direction: column;
    }
    
    .filter-group label {
        margin-bottom: 5px;
    }
}

/* ========== زر القائمة للهاتف ========== */
.mobile-menu-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mobile-menu-btn:hover {
    background: var(--bg-card-hover);
}

/* ========== تحسينات اللمس ========== */
@media (hover: none) and (pointer: coarse) {
    .nav-item,
    .btn-primary,
    .btn-secondary,
    .action-btn,
    .stat-card,
    .employee-card,
    .missed-card,
    .transcript-item {
        min-height: 44px;
    }
    
    .data-table td,
    .data-table th {
        padding: 12px 10px;
    }
}

/* ========== قسم المستخدمين الأونلاين ========== */
.online-users-section {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 25px;
}

.online-card,
.last-login-card {
    background: var(--bg-card);
    border-radius: 15px;
    padding: 20px;
    border: 1px solid var(--border-color);
}

.online-header,
.last-login-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.online-header h3,
.last-login-header h3 {
    font-size: 16px;
    color: var(--text-primary);
}

.online-count {
    background: var(--success-color);
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: bold;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(0, 184, 148, 0.4);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(0, 184, 148, 0);
    }
}

.online-users-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 200px;
    overflow-y: auto;
}

.online-user-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    background: var(--bg-card-hover);
    border-radius: 10px;
    transition: all 0.3s ease;
}

.online-user-item:hover {
    transform: translateX(-5px);
    background: rgba(0, 184, 148, 0.1);
}

.online-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    position: relative;
}

.online-avatar::after {
    content: '';
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 10px;
    height: 10px;
    background: var(--success-color);
    border-radius: 50%;
    border: 2px solid var(--bg-card);
}

.online-user-info {
    flex: 1;
}

.online-user-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.online-user-time {
    font-size: 12px;
    color: var(--text-muted);
}

.online-duration {
    background: rgba(0, 184, 148, 0.2);
    color: var(--success-color);
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 11px;
}

.no-users,
.no-login {
    text-align: center;
    padding: 30px;
    color: var(--text-muted);
    font-size: 14px;
}

/* آخر تسجيل دخول */
.last-login-info {
    padding: 15px;
}

.last-login-user {
    display: flex;
    align-items: center;
    gap: 15px;
}

.last-login-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--info-color), var(--primary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.last-login-details {
    flex: 1;
}

.last-login-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.last-login-time {
    font-size: 13px;
    color: var(--text-secondary);
}

.last-login-time span {
    color: var(--info-color);
    font-weight: 500;
}

/* Responsive للقسم */
@media (max-width: 768px) {
    .online-users-section {
        grid-template-columns: 1fr;
    }
}

/* ========== قسم الشركات ========== */
.companies-stats {
    display: flex;
    gap: 20px;
    margin-bottom: 25px;
}

.stat-mini {
    background: var(--bg-card);
    padding: 20px 30px;
    border-radius: 12px;
    text-align: center;
    border: 1px solid var(--border-color);
}

.stat-mini.active {
    background: linear-gradient(135deg, var(--success-color) 0%, #00cec9 100%);
}

.stat-mini .stat-number {
    display: block;
    font-size: 32px;
    font-weight: bold;
    color: var(--text-primary);
}

.stat-mini .stat-label {
    font-size: 13px;
    color: var(--text-secondary);
}

.stat-mini.active .stat-label {
    color: rgba(255, 255, 255, 0.9);
}

.companies-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

.company-card {
    background: var(--bg-card);
    border-radius: 15px;
    padding: 25px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.company-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.company-card.inactive {
    opacity: 0.6;
    border-color: var(--danger-color);
}

.company-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.company-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.company-info h4 {
    font-size: 18px;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.company-info .admin-name {
    font-size: 13px;
    color: var(--text-muted);
}

.company-badge {
    margin-right: auto;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.company-badge.active {
    background: rgba(0, 184, 148, 0.2);
    color: var(--success-color);
}

.company-badge.inactive {
    background: rgba(231, 76, 60, 0.2);
    color: var(--danger-color);
}

.company-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 20px;
    padding: 15px;
    background: var(--bg-card-hover);
    border-radius: 10px;
}

.company-stat {
    text-align: center;
}

.company-stat-value {
    display: block;
    font-size: 20px;
    font-weight: bold;
    color: var(--text-primary);
}

.company-stat-label {
    font-size: 11px;
    color: var(--text-muted);
}

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

.company-actions button {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.3s ease;
}

.company-actions .btn-view {
    background: var(--primary-color);
    color: white;
}

.company-actions .btn-edit {
    background: var(--warning-color);
    color: #333;
}

.company-actions .btn-delete {
    background: var(--danger-color);
    color: white;
}

.company-actions button:hover {
    transform: scale(1.05);
}

.subscription-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 15px;
    font-size: 11px;
    margin-top: 5px;
}

.subscription-badge.basic {
    background: rgba(116, 185, 255, 0.2);
    color: var(--info-color);
}

.subscription-badge.pro {
    background: rgba(162, 155, 254, 0.2);
    color: var(--purple-color);
}

.subscription-badge.unlimited {
    background: rgba(253, 203, 110, 0.2);
    color: var(--warning-color);
}

/* Responsive للشركات */
@media (max-width: 768px) {
    .companies-grid {
        grid-template-columns: 1fr;
    }
    
    .companies-stats {
        flex-direction: column;
    }
}

