* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    direction: rtl;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
}

header h1 {
    font-size: 2.5em;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.btn-logout {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid white;
    padding: 10px 25px;
}

.btn-logout:hover {
    background: white;
    color: #667eea;
}

/* التبويبات */
.tabs {
    display: flex;
    background: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
}

.tab-btn {
    flex: 1;
    padding: 20px;
    background: none;
    border: none;
    font-size: 1.1em;
    font-weight: 600;
    color: #6c757d;
    cursor: pointer;
    transition: all 0.3s;
}

.tab-btn:hover {
    background: #e9ecef;
    color: #495057;
}

.tab-btn.active {
    background: white;
    color: #667eea;
    border-bottom: 3px solid #667eea;
}

/* محتوى التبويبات */
.tab-content {
    display: none;
    padding: 30px;
    animation: fadeIn 0.5s;
}

.tab-content.active {
    display: block;
}

@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: 30px;
}

.section-header h2 {
    color: #333;
    font-size: 1.8em;
}

/* الأزرار */
.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-edit {
    background: #ffc107;
    color: #333;
    padding: 8px 16px;
    margin: 0 5px;
}

.btn-delete {
    background: #dc3545;
    color: white;
    padding: 8px 16px;
    margin: 0 5px;
}

.btn-view {
    background: #17a2b8;
    color: white;
    padding: 8px 16px;
    margin: 0 5px;
}

.btn-invoices {
    background: #28a745;
    color: white;
    padding: 8px 16px;
    margin: 0 5px;
    flex: 1;
}

.btn-invoices:hover {
    background: #218838;
}

/* بطاقات الموردين البسيطة */
.suppliers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.supplier-card-simple {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s;
    cursor: pointer;
    border: 2px solid transparent;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.supplier-card-simple:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
    border-color: #667eea;
}

.supplier-name {
    display: flex;
    align-items: center;
    gap: 15px;
}

.supplier-name i {
    font-size: 2em;
    color: #667eea;
}

.supplier-name h3 {
    margin: 0;
    color: #333;
    font-size: 1.3em;
}

.supplier-arrow {
    color: #667eea;
    font-size: 1.2em;
    transition: transform 0.3s;
}

.supplier-card-simple:hover .supplier-arrow {
    transform: translateX(-5px);
}

/* صفحة تفاصيل المورد */
.details-header {
    margin-bottom: 30px;
}

.details-header .btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.supplier-details-page {
    max-width: 1000px;
    margin: 0 auto;
}

.supplier-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 3px solid #667eea;
}

.supplier-header h1 {
    color: #333;
    font-size: 2.5em;
    margin: 0;
}

.supplier-id-badge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 10px 25px;
    border-radius: 30px;
    font-size: 1.2em;
    font-weight: bold;
}

.details-cards {
    display: grid;
    gap: 25px;
    margin-bottom: 30px;
}

.detail-card {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border-right: 5px solid #667eea;
}

.detail-card h3 {
    color: #667eea;
    font-size: 1.5em;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-content {
    padding: 10px 0;
}

.info-row {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.info-label {
    font-weight: 600;
    color: #6c757d;
    font-size: 0.95em;
}

.info-value {
    color: #333;
    font-size: 1.1em;
}

.phone-link {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
}

.phone-link:hover {
    color: #764ba2;
    transform: translateX(-3px);
}

.social-links {
    display: flex;
    gap: 15px;
}

.social-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 25px;
    border-radius: 10px;
    text-decoration: none;
    color: white;
    font-weight: 600;
    transition: all 0.3s;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

.social-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.social-btn.whatsapp {
    background: #25D366;
}

.social-btn.whatsapp:hover {
    background: #20ba5a;
}

.social-btn.telegram {
    background: #0088cc;
}

.social-btn.telegram:hover {
    background: #006699;
}

.financial-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.financial-box {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 15px;
    border-right: 5px solid;
}

.financial-box.paid {
    border-color: #28a745;
}

.financial-box.withdraw {
    border-color: #ffc107;
}

.financial-box.due {
    border-color: #dc3545;
}

.financial-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5em;
    color: white;
}

.financial-box.paid .financial-icon {
    background: #28a745;
}

.financial-box.withdraw .financial-icon {
    background: #ffc107;
}

.financial-box.due .financial-icon {
    background: #dc3545;
}

.financial-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.financial-label {
    font-size: 0.9em;
    color: #6c757d;
    font-weight: 600;
}

.financial-amount {
    font-size: 1.3em;
    font-weight: bold;
    color: #333;
}

.action-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.btn-large {
    flex: 1;
    min-width: 200px;
    padding: 15px 30px;
    font-size: 1.1em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

/* الجداول */
.table-container {
    overflow-x: auto;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

th, td {
    padding: 15px;
    text-align: center;
    border-bottom: 1px solid #dee2e6;
}

th {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.9em;
    letter-spacing: 0.5px;
}

tbody tr {
    transition: background 0.3s;
}

tbody tr:hover {
    background: #f8f9fa;
}

/* الفلاتر */
.filters {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.filters label {
    font-weight: 600;
    color: #495057;
}

.filters select {
    padding: 10px 15px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    font-size: 1em;
    min-width: 200px;
}

/* المودال */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s;
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 30px;
    border-radius: 15px;
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideDown 0.3s;
}

.modal-large {
    max-width: 900px;
}

@keyframes slideDown {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.close {
    color: #aaa;
    float: left;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
}

.close:hover {
    color: #000;
}

.modal-content h2 {
    margin-bottom: 25px;
    color: #667eea;
    font-size: 1.8em;
}

/* النموذج */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #495057;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    font-size: 1em;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    margin-top: 30px;
}

/* قسم المنتجات في الفاتورة */
.items-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin: 20px 0;
}

.invoice-item {
    background: white;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 15px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    position: relative;
}

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

.item-header h4 {
    color: #667eea;
}

.remove-item {
    background: #dc3545;
    color: white;
    border: none;
    padding: 5px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9em;
}

.remove-item:hover {
    background: #c82333;
}

.product-search {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.product-search input {
    flex: 1;
}

.btn-search {
    background: #17a2b8;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}

.btn-search:hover {
    background: #138496;
}

.product-info {
    background: #e7f3ff;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    border-right: 4px solid #667eea;
}

.product-info p {
    margin: 5px 0;
    color: #495057;
}

.product-info strong {
    color: #333;
}

.product-not-found {
    background: #ffe7e7;
    padding: 15px;
    border-radius: 8px;
    border-right: 4px solid #dc3545;
    color: #721c24;
    text-align: center;
}

.invoice-summary {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin-top: 20px;
}

.invoice-summary .form-group input {
    font-weight: 600;
    font-size: 1.1em;
}

/* تصميم متجاوب */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.5em;
    }

    .header-content {
        flex-direction: column;
        gap: 15px;
    }

    .section-header {
        flex-direction: column;
        gap: 15px;
    }

    .suppliers-grid {
        grid-template-columns: 1fr;
    }

    .supplier-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .supplier-header h1 {
        font-size: 1.8em;
    }

    .financial-grid {
        grid-template-columns: 1fr;
    }

    .action-buttons {
        flex-direction: column;
    }

    .btn-large {
        width: 100%;
        min-width: auto;
    }

    .social-links {
        flex-direction: column;
    }

    .social-btn {
        width: 100%;
        justify-content: center;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .modal-content {
        width: 95%;
        margin: 10% auto;
    }

    table {
        font-size: 0.85em;
    }

    th, td {
        padding: 10px 5px;
    }
}