/**
 * Factory System ERP - Main Stylesheet (V35)
 * ملف الستايل الرئيسي لنظام المصنع
 */

/* ============================================
   1. Reset & Base
   ============================================ */
body,
html {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow-x: hidden;
}

#wpadminbar,
header,
footer,
.site-header,
.site-footer,
.widget-area,
.sidebar,
.page-header,
.entry-header {
    display: none !important;
}

.fs-fullscreen-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #f4f6f9;
    z-index: 999999;
    overflow: hidden;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    direction: rtl;
}

/* ============================================
   2. Layout
   ============================================ */
.erp-container {
    display: flex;
    height: 100%;
    width: 100%;
}

/* Sidebar */
.erp-sidebar {
    width: 260px;
    background: #1a1f2e;
    color: #fff;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow-y: auto;
    border-left: 1px solid rgba(255, 255, 255, 0.05);
    scrollbar-width: thin;
    scrollbar-color: #34495e #1a1f2e;
}

.erp-sidebar::-webkit-scrollbar {
    width: 6px;
}

.erp-sidebar::-webkit-scrollbar-track {
    background: #1a1f2e;
}

.erp-sidebar::-webkit-scrollbar-thumb {
    background: #34495e;
    border-radius: 3px;
}

.erp-sidebar h3 {
    text-align: center;
    padding: 18px 0;
    margin: 0;
    background: #141824;
    font-size: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    color: #4fc3f7;
    letter-spacing: 1px;
}

.erp-nav {
    flex-grow: 1;
}

.erp-nav a {
    display: block;
    padding: 11px 18px;
    color: #8899aa;
    text-decoration: none;
    transition: all 0.25s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    font-size: 13px;
    position: relative;
}

.erp-nav a:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #ecf0f1;
    padding-right: 22px;
}

.erp-nav a.active {
    background: rgba(52, 152, 219, 0.15);
    color: #4fc3f7;
    border-right: 3px solid #4fc3f7;
    padding-right: 15px;
    font-weight: 600;
}

.nav-section-title {
    padding: 10px 18px 4px;
    font-size: 10px;
    color: #546e7a;
    text-transform: uppercase;
    font-weight: 700;
    margin-top: 5px;
    letter-spacing: 1.5px;
}

/* Content Area */
.erp-content {
    flex: 1;
    padding: 25px 30px;
    overflow-y: auto;
    box-sizing: border-box;
    background: #f4f6f9;
}

/* ============================================
   3. UI Components
   ============================================ */

/* Cards */
.card {
    background: #fff;
    padding: 22px;
    border-radius: 10px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
    margin-bottom: 20px;
    border: 1px solid #e8ecf1;
    transition: all 0.2s ease;
}

.card:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.07);
}

/* Buttons */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    color: #fff;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
    font-size: 13px;
    transition: all 0.2s ease;
    font-family: inherit;
}

.btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

.btn:active {
    transform: translateY(0);
}

.btn-green {
    background: #27ae60;
}

.btn-blue {
    background: #2980b9;
}

.btn-red {
    background: #c0392b;
}

.btn-orange {
    background: #e67e22;
}

.btn-dark {
    background: #34495e;
}

.btn-purple {
    background: #8e44ad;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 11px;
}

.btn-lg {
    padding: 12px 24px;
    font-size: 15px;
}

.btn-outline {
    background: transparent;
    border: 2px solid #3498db;
    color: #3498db;
}

.btn-outline:hover {
    background: #3498db;
    color: #fff;
}

/* Forms */
input,
select,
textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #dde2e8;
    border-radius: 8px;
    box-sizing: border-box;
    margin-bottom: 10px;
    font-family: inherit;
    font-size: 13px;
    transition: border-color 0.2s ease;
    background: #fafbfc;
}

input:focus,
select:focus,
textarea:focus {
    border-color: #3498db;
    outline: none;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
    background: #fff;
}

/* Tables */
table.fs-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 13px;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
}

table.fs-table th {
    background: #1a1f2e;
    color: #fff;
    padding: 12px 10px;
    text-align: center;
    font-weight: 600;
    font-size: 12px;
    letter-spacing: 0.5px;
}

table.fs-table td {
    padding: 10px;
    border-bottom: 1px solid #f0f2f5;
    text-align: center;
    color: #555;
}

table.fs-table tr:hover {
    background: #f8f9fc;
}

table.fs-table tr:last-child td {
    border-bottom: none;
}

/* ============================================
   4. Stat Cards (Dashboard)
   ============================================ */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.stat-card {
    background: #fff;
    padding: 20px;
    border-radius: 10px;
    border: 1px solid #e8ecf1;
    text-align: center;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}

.stat-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
}

.stat-card .stat-icon {
    font-size: 28px;
    margin-bottom: 8px;
}

.stat-card .stat-value {
    font-size: 26px;
    font-weight: 700;
    color: #2c3e50;
    margin: 5px 0;
}

.stat-card .stat-label {
    font-size: 12px;
    color: #8899aa;
}

.stat-card .stat-change {
    font-size: 11px;
    margin-top: 5px;
    padding: 2px 8px;
    border-radius: 10px;
    display: inline-block;
}

.stat-change.up {
    background: #e8f5e9;
    color: #27ae60;
}

.stat-change.down {
    background: #ffebee;
    color: #c0392b;
}

/* Color variants */
.stat-blue::after {
    background: #3498db;
}

.stat-green::after {
    background: #27ae60;
}

.stat-red::after {
    background: #c0392b;
}

.stat-orange::after {
    background: #e67e22;
}

.stat-purple::after {
    background: #8e44ad;
}

.stat-gold::after {
    background: #f39c12;
}

.stat-teal::after {
    background: #00bcd4;
}

/* ============================================
   5. Alerts & Notifications  
   ============================================ */
.fs-alert {
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.fs-alert-success {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}

.fs-alert-error {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ffcdd2;
}

.fs-alert-warning {
    background: #fff8e1;
    color: #f57f17;
    border: 1px solid #ffecb3;
}

.fs-alert-info {
    background: #e3f2fd;
    color: #1565c0;
    border: 1px solid #bbdefb;
}

/* Notification Bell */
.notif-bell {
    position: relative;
    cursor: pointer;
    padding: 5px 8px;
    border-radius: 8px;
    transition: background 0.2s;
}

.notif-bell:hover {
    background: rgba(0, 0, 0, 0.05);
}

.notif-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #e74c3c;
    color: #fff;
    font-size: 10px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    border: 2px solid #fff;
    animation: notif-pulse 2s infinite;
}

@keyframes notif-pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

.notif-dropdown {
    position: absolute;
    top: 45px;
    left: 0;
    width: 350px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    display: none;
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #e8ecf1;
}

.notif-dropdown.show {
    display: block;
}

.notif-item {
    padding: 12px 15px;
    border-bottom: 1px solid #f5f5f5;
    cursor: pointer;
    transition: background 0.2s;
}

.notif-item:hover {
    background: #f8f9fc;
}

.notif-item.unread {
    background: #eef6ff;
    border-right: 3px solid #3498db;
}

.notif-item .notif-text {
    font-size: 13px;
    color: #333;
    margin-bottom: 4px;
}

.notif-item .notif-time {
    font-size: 11px;
    color: #999;
}

/* ============================================
   6. Charts Container  
   ============================================ */
.chart-container {
    background: #fff;
    padding: 20px;
    border-radius: 10px;
    border: 1px solid #e8ecf1;
    margin-bottom: 20px;
}

.chart-container h3 {
    margin: 0 0 15px;
    font-size: 15px;
    color: #2c3e50;
}

/* ============================================
   7. Tabs  
   ============================================ */
.fs-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 24px;
    background: #f1f5f9;
    padding: 5px;
    border-radius: 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.fs-tabs::-webkit-scrollbar {
    display: none;
}

.fs-tab {
    padding: 10px 18px;
    text-decoration: none;
    color: #64748b;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.25s ease;
    white-space: nowrap;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: none;
    background: transparent;
    line-height: 1.3;
}

.fs-tab:hover {
    color: #1e3a5f;
    background: rgba(255, 255, 255, 0.7);
}

.fs-tab.active {
    color: #1e3a5f;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
}

.fs-tab .badge {
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    padding: 1px 7px;
    border-radius: 10px;
    margin-right: 4px;
    font-weight: 700;
    line-height: 1.5;
}

/* ============================================
   8. Status Badges  
   ============================================ */
.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.status-new {
    background: #e3f2fd;
    color: #1565c0;
}

.status-processing {
    background: #fff3e0;
    color: #e65100;
}

.status-done {
    background: #e8f5e9;
    color: #2e7d32;
}

.status-problem {
    background: #ffebee;
    color: #c62828;
}

.status-waiting {
    background: #f3e5f5;
    color: #7b1fa2;
}

.status-shipped {
    background: #e0f2f1;
    color: #00695c;
}

/* ============================================
   9. Progress Bar  
   ============================================ */
.fs-progress {
    width: 100%;
    height: 8px;
    background: #e8ecf1;
    border-radius: 4px;
    overflow: hidden;
}

.fs-progress-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.fs-progress-bar.green {
    background: linear-gradient(90deg, #27ae60, #2ecc71);
}

.fs-progress-bar.blue {
    background: linear-gradient(90deg, #2980b9, #3498db);
}

.fs-progress-bar.red {
    background: linear-gradient(90deg, #c0392b, #e74c3c);
}

.fs-progress-bar.orange {
    background: linear-gradient(90deg, #e67e22, #f39c12);
}

/* ============================================
   10. Login Screen  
   ============================================ */
.fs-login-wrapper {
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #1a1f2e 0%, #2c3e50 100%);
}

.fs-login-card {
    width: 380px;
    text-align: center;
    background: #fff;
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.fs-login-card h2 {
    color: #1a1f2e;
    margin-bottom: 25px;
    font-size: 22px;
}

/* ============================================
   11. Toast Notifications  
   ============================================ */
.fs-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 25px;
    border-radius: 10px;
    color: #fff;
    font-weight: 600;
    z-index: 99999;
    animation: toast-slide 0.3s ease;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
}

@keyframes toast-slide {
    from {
        top: -50px;
        opacity: 0;
    }

    to {
        top: 20px;
        opacity: 1;
    }
}

/* ============================================
   12. Header Bar  
   ============================================ */
.erp-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background: #fff;
    border-radius: 10px;
    border: 1px solid #e8ecf1;
    margin-bottom: 20px;
}

.erp-user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.erp-avatar {
    width: 38px;
    height: 38px;
    background: #1a1f2e;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #4fc3f7;
    font-weight: 700;
    font-size: 16px;
}

.erp-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ============================================
   13. Empty States  
   ============================================ */
.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: #8899aa;
}

.empty-state .empty-icon {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
}

.empty-state .empty-text {
    font-size: 16px;
    margin-bottom: 5px;
}

.empty-state .empty-sub {
    font-size: 13px;
    color: #aab;
}

/* ============================================
   14. Loading Spinner  
   ============================================ */
.fs-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e8ecf1;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   15. Mobile Responsive  
   ============================================ */
@media (max-width: 768px) {
    .erp-container {
        flex-direction: column;
    }

    .erp-sidebar {
        width: 100%;
        height: auto;
        max-height: 120px;
        flex-direction: row;
        overflow-x: auto;
        padding: 0;
    }

    .erp-sidebar h3,
    .nav-section-title {
        display: none;
    }

    .erp-nav {
        display: flex;
        width: 100%;
    }

    .erp-nav a {
        border-bottom: none;
        border-right: 1px solid rgba(255, 255, 255, 0.05);
        padding: 12px 15px;
        white-space: nowrap;
        font-size: 12px;
    }

    .erp-nav a.active {
        border-right: none;
        border-bottom: 3px solid #4fc3f7;
    }

    .erp-content {
        padding: 15px;
    }

    div[style*="overflow-x:auto"],
    .card {
        overflow-x: auto;
    }

    .stat-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .notif-dropdown {
        width: 280px;
        right: -10px;
        left: auto;
    }

    .erp-header {
        flex-wrap: wrap;
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .stat-grid {
        grid-template-columns: 1fr;
    }

    .fs-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        gap: 4px;
        padding: 4px;
    }
}