/* ===== public/assets/css/style.css ===== */
/* Mostafa Automation - Main Stylesheet */

/* ===== Reset & Base ===== */
/* أضف هذا في ملف style.css */

/* تنسيق badge المستخدم */
.badge {
    padding: 4px 8px;
    border-radius: 50px;
    font-size: 11px;
    font-weight: 600;
    display: inline-block;
}

.badge-info {
    background: #cce5ff;
    color: #004085;
    border: 1px solid #b8daff;
}

.badge-secondary {
    background: #e2e3e5;
    color: #383d41;
    border: 1px solid #d6d8db;
}

/* تنسيق C_User badge */
.cuser-badge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 5px 10px;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
    box-shadow: 0 2px 5px rgba(102,126,234,0.3);
}

/* تنسيق أزرار الإجراءات */
.btn-small {
    padding: 6px 10px;
    font-size: 12px;
    border-radius: 50px;
    border: none;
    cursor: pointer;
    margin: 0 3px;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}

.btn-view {
    background: #1877f2;
    color: white;
}

.btn-retry {
    background: #28a745;
    color: white;
}

.btn-delete {
    background: #dc3545;
    color: white;
}

.btn-small:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 10px rgba(0,0,0,0.2);
}

.btn-small:active {
    transform: translateY(0);
}

/* تنسيق صف الجدول عند التحديث */
@keyframes highlight {
    0% { background-color: #fff3cd; }
    100% { background-color: transparent; }
}

tr.highlight {
    animation: highlight 1s ease;
}
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

body {
    background: #f0f2f5;
    color: #1c1e21;
    line-height: 1.6;
    direction: rtl;
}

/* ===== Navbar ===== */
.navbar {
    background: linear-gradient(135deg, #1877f2 0%, #166fe5 100%);
    color: white;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-brand {
    font-size: 24px;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-brand::before {
    content: "🤖";
    font-size: 28px;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 25px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255,255,255,0.1);
    padding: 8px 15px;
    border-radius: 50px;
}

.admin-badge {
    background: #ffd700;
    color: #333;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: bold;
}

.api-token {
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.3s;
}

.api-token:hover {
    opacity: 1;
}

.logout-btn {
    padding: 8px 20px;
    background: white;
    color: #1877f2;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 5px;
}

.logout-btn:hover {
    background: #e7f3ff;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

/* ===== Container ===== */
.container {
    max-width: 1400px;
    margin: 30px auto;
    padding: 0 20px;
}

/* ===== Cards ===== */
.card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: all 0.3s;
    border: 1px solid rgba(0,0,0,0.05);
}

.card:hover {
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.card h3 {
    margin-bottom: 20px;
    color: #1c1e21;
    font-size: 22px;
    border-bottom: 2px solid #e4e6eb;
    padding-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ===== Stats Card ===== */
.stats-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 25px;
    color: white;
    box-shadow: 0 10px 30px rgba(102,126,234,0.3);
}

.stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.stats-header h3 {
    color: white;
    border-bottom-color: rgba(255,255,255,0.3);
}

.last-update {
    font-size: 13px;
    background: rgba(255,255,255,0.2);
    padding: 5px 10px;
    border-radius: 50px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
}

.stat-item {
    text-align: center;
    padding: 20px;
    background: rgba(255,255,255,0.15);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    transition: transform 0.3s;
    border: 1px solid rgba(255,255,255,0.2);
}

.stat-item:hover {
    transform: translateY(-5px);
    background: rgba(255,255,255,0.25);
}

.stat-number {
    font-size: 36px;
    font-weight: bold;
    line-height: 1.2;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 14px;
    opacity: 0.9;
    font-weight: 500;
}

/* ===== Forms ===== */
.form-group {
    margin-bottom: 25px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #444;
    font-size: 14px;
}

input[type="text"],
input[type="password"],
textarea,
select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e4e6eb;
    border-radius: 10px;
    font-size: 15px;
    transition: all 0.3s;
    background: #f8f9fa;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #1877f2;
    box-shadow: 0 0 0 4px rgba(24,119,242,0.1);
    background: white;
}

textarea {
    resize: vertical;
    min-height: 120px;
    font-family: 'Courier New', monospace;
    direction: ltr;
    text-align: left;
}

.hint {
    display: block;
    margin-top: 8px;
    color: #65676b;
    font-size: 12px;
    background: #f0f2f5;
    padding: 5px 10px;
    border-radius: 5px;
}

/* ===== Buttons ===== */
.btn-primary {
    background: linear-gradient(135deg, #1877f2 0%, #166fe5 100%);
    color: white;
    padding: 14px 28px;
    border: none;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(24,119,242,0.4);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-refresh {
    padding: 10px 20px;
    background: #e4e6eb;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 5px;
}

.btn-refresh:hover:not(:disabled) {
    background: #d8dadf;
    transform: scale(1.05);
}

.btn-refresh:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ===== Status Badges ===== */
.status-badge {
    padding: 6px 12px;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
    white-space: nowrap;
}

.status-pending {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.status-processing {
    background: #cce5ff;
    color: #004085;
    border: 1px solid #b8daff;
}

.status-completed {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status-failed {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* ===== Table ===== */
.table-responsive {
    overflow-x: auto;
    border-radius: 10px;
    border: 1px solid #e4e6eb;
    background: white;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1000px;
}

th {
    text-align: right;
    padding: 15px;
    background: #f8f9fa;
    color: #495057;
    font-weight: 600;
    font-size: 14px;
    border-bottom: 2px solid #dee2e6;
}

td {
    padding: 15px;
    border-bottom: 1px solid #e9ecef;
    vertical-align: middle;
}

tr:hover {
    background: #f8f9fa;
}

tr:last-child td {
    border-bottom: none;
}

/* ===== Result Preview ===== */
.result-preview {
    max-width: 220px;
    max-height: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 11px;
    background: #f8f9fa;
    padding: 8px;
    border-radius: 5px;
    cursor: pointer;
    border: 1px solid #e9ecef;
    position: relative;
    white-space: nowrap;
    word-break: break-word;
    transition: background 0.2s ease;
}

.result-preview:hover {
    background: #ffffff;
    border-color: #1877f2;
}

.result-preview:hover::after {
    content: attr(data-full);
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 6px;
    background: white;
    border: 1px solid #1877f2;
    padding: 10px;
    width: 300px;
    border-radius: 6px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    white-space: pre-wrap;
    z-index: 1000;
    max-width: 400px;
    
}/* ===== Action Buttons ===== */
.btn-small {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 50px;
    border: none;
    cursor: pointer;
    margin: 0 3px;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.btn-view {
    background: #1877f2;
    color: white;
}

.btn-retry {
    background: #28a745;
    color: white;
}

.btn-delete {
    background: #dc3545;
    color: white;
}

.btn-small:hover {
    transform: translateY(-2px);
    filter: brightness(110%);
    box-shadow: 0 3px 8px rgba(0,0,0,0.2);
}

/* ===== Filter Section ===== */
.filter-section {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 8px 20px;
    border-radius: 50px;
    background: #f1f3f5;
    color: #2c3e50;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 5px;
}

.filter-btn:hover {
    background: #1877f2;
    color: white;
    transform: translateY(-2px);
}

.filter-btn.active {
    background: #1877f2;
    color: white;
    box-shadow: 0 5px 15px rgba(24,119,242,0.3);
}

/* ===== Messages ===== */
.success-message {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    padding: 15px 25px;
    border-radius: 50px;
    margin-top: 20px;
    text-align: center;
    animation: slideIn 0.5s ease;
    box-shadow: 0 5px 20px rgba(40,167,69,0.3);
}

.error-message {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
    padding: 15px 25px;
    border-radius: 50px;
    margin-bottom: 20px;
    text-align: center;
    animation: slideIn 0.5s ease;
    box-shadow: 0 5px 20px rgba(220,53,69,0.3);
}

@keyframes slideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ===== Modal ===== */
.modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.7);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 30px;
    border-radius: 20px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    animation: slideDown 0.4s;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close {
    position: absolute;
    left: 25px;
    top: 20px;
    font-size: 30px;
    font-weight: bold;
    color: #666;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s;
}

.close:hover {
    color: #000;
    background: #f0f2f5;
    transform: rotate(90deg);
}

/* ===== Loading Spinner ===== */
.loading-spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid rgba(24,119,242,0.2);
    border-top: 3px solid #1877f2;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== Badges ===== */
.badge {
    padding: 3px 8px;
    border-radius: 50px;
    font-size: 11px;
    font-weight: 600;
}

.badge-info {
    background: #cce5ff;
    color: #004085;
}

.badge-secondary {
    background: #e2e3e5;
    color: #383d41;
}

.cuser-badge {
    background: #e3f2fd;
    color: #0d47a1;
    padding: 4px 10px;
    border-radius: 50px;
    font-size: 11px;
    font-weight: bold;
    font-family: monospace;
    display: inline-block;
}

.cuser-null {
    background: #f5f5f5;
    color: #999;
    padding: 4px 10px;
    border-radius: 50px;
    font-size: 11px;
    font-style: italic;
}

/* ===== Last Action Badge ===== */
.last-action-badge {
    background: #e3f2fd;
    color: #0d47a1;
    padding: 5px 12px;
    border-radius: 50px;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 8px;
}

/* ===== Notification Toast ===== */
.notification-toast {
    position: fixed;
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 15px 30px;
    border-radius: 50px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    z-index: 9999;
    animation: slideDown 0.4s;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
    direction: rtl;
}

/* ===== Tasks Header ===== */
.tasks-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.tasks-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* ===== File Info ===== */
.file-info {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    margin-top: 20px;
    font-size: 12px;
    color: #666;
    border: 1px dashed #ddd;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: space-between;
}

/* ===== Text Utilities ===== */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-left {
    text-align: left;
}

.error {
    color: #dc3545;
    font-weight: 600;
}

.success {
    color: #28a745;
    font-weight: 600;
}

/* ===== API Status ===== */
.api-status {
    background: #e3f2fd;
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-right: 4px solid #1877f2;
}

/* ===== New Task Indicator ===== */
.new-task-indicator {
    width: 12px;
    height: 12px;
    background: #4caf50;
    border-radius: 50%;
    display: inline-block;
    margin-left: 5px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.7; }
    100% { transform: scale(1); opacity: 1; }
}

/* ===== Responsive Design ===== */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }
    
    .nav-menu {
        flex-direction: column;
        width: 100%;
    }
    
    .user-info {
        width: 100%;
        justify-content: center;
    }
    
    .logout-btn {
        width: 100%;
        justify-content: center;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .container {
        padding: 0 10px;
    }
    
    .card {
        padding: 15px;
    }
    
    .filter-section {
        justify-content: center;
    }
    
    .modal-content {
        width: 95%;
        margin: 10% auto;
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .tasks-controls {
        flex-direction: column;
        width: 100%;
    }
    
    .btn-refresh {
        width: 100%;
        justify-content: center;
    }
    
    .stat-number {
        font-size: 28px;
    }
}

/* ===== RTL Specific ===== */
input[type="text"],
input[type="password"],
textarea {
    text-align: right;
}

textarea {
    text-align: left;
    direction: ltr;
}

/* ===== Print Styles ===== */
@media print {
    .navbar,
    .filter-section,
    .btn-refresh,
    .btn-small,
    .modal {
        display: none !important;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    table {
        font-size: 10pt;
    }
}