:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --danger-color: #c0392b;
    --light-color: #ecf0f1;
    --dark-color: #2c3e50;
    --devices-color: #3498db;
    --repairs-color: #e67e22;
    --sales-color: #27ae60;
    --customers-color: #8e44ad;
    --suppliers-color: #16a085;
    --purchases-color: #9b59b6;
    --stock-color: #e74c3c
}

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

body {
    font-family: 'Cairo', sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    color: #333;
    transition: all .3s ease;
    overflow-x: hidden
}

body.fast-mode {
    background: linear-gradient(135deg, #ffeaa7 0%, #fab1a0 100%)
}

.main-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 10px
}

.content-area {
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    padding: 15px;
    margin-bottom: 15px
}

.section-title {
    color: var(--primary-color);
    text-align: center;
    margin-bottom: 20px;
    font-weight: 700;
    font-size: 1.5rem
}

.section-title:after {
    content: '';
    display: block;
    width: 80px;
    height: 3px;
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
    margin: 10px auto;
    border-radius: 2px
}

.separators {
    display: flex;
    justify-content: center;
    margin: 15px 0;
    flex-wrap: wrap
}

.separator {
    height: 4px;
    width: 25px;
    margin: 0 4px;
    border-radius: 2px
}

.separator-1 {
    background-color: var(--devices-color)
}

.separator-2 {
    background-color: var(--repairs-color)
}

.separator-3 {
    background-color: var(--sales-color)
}

.separator-4 {
    background-color: var(--customers-color)
}

.separator-5 {
    background-color: var(--suppliers-color)
}

.separator-6 {
    background-color: var(--purchases-color)
}

.separator-7 {
    background-color: var(--stock-color)
}

.system-card {
    background: white;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    transition: all .3s ease;
    border-top: 4px solid var(--secondary-color);
    height: 100%;
    text-align: center
}

.system-card.devices {
    border-top-color: var(--devices-color)
}

.system-card.devices .system-icon {
    color: var(--devices-color)
}

.system-card.repairs {
    border-top-color: var(--repairs-color)
}

.system-card.repairs .system-icon {
    color: var(--repairs-color)
}

.system-card.sales {
    border-top-color: var(--sales-color)
}

.system-card.sales .system-icon {
    color: var(--sales-color)
}

.system-card.customers {
    border-top-color: var(--customers-color)
}

.system-card.customers .system-icon {
    color: var(--customers-color)
}

.system-card.suppliers {
    border-top-color: var(--suppliers-color)
}

.system-card.suppliers .system-icon {
    color: var(--suppliers-color)
}

.system-card.purchases {
    border-top-color: var(--purchases-color)
}

.system-card.purchases .system-icon {
    color: var(--purchases-color)
}

.system-card.stock {
    border-top-color: var(--stock-color)
}

.system-card.stock .system-icon {
    color: var(--stock-color)
}

.system-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.12)
}

.system-icon {
    font-size: 2rem;
    margin-bottom: 10px;
    color: var(--secondary-color)
}

.system-title {
    color: var(--primary-color);
    font-weight: 600;
    margin-bottom: 10px;
    font-size: 1.1rem
}

.btn-system {
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 50px;
    font-weight: 500;
    transition: all .3s ease;
    text-decoration: none;
    display: inline-block;
    font-size: .8rem
}

.header-info {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: 12px;
    padding: 12px 10px;
    margin-bottom: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1)
}

.stats-box {
    text-align: center;
    padding: 8px 5px;
    cursor: pointer;
    transition: all .3s ease;
    border-radius: 8px
}

.stats-box:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.02)
}

.stats-number {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 3px
}

.stats-label {
    font-size: .7rem;
    opacity: .9
}

.controls {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 15px 0;
    padding: 12px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px
}

.controls .btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 12px;
    border-radius: 8px;
    font-weight: 500;
    transition: all .3s ease;
    border: 1px solid #dee2e6;
    background-color: white;
    color: var(--primary-color);
    font-size: .75rem
}

.controls .btn i {
    font-size: .8rem
}

.controls .btn-primary {
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
    color: white;
    border: none
}

.controls .btn.warning-active {
    background: linear-gradient(to right, var(--warning-color), #e67e22);
    color: white;
    border: none
}

.search-container {
    background: white;
    border-radius: 12px;
    padding: 15px;
    margin: 15px 0;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    border-top: 4px solid var(--accent-color)
}

.search-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 10px
}

.search-title {
    color: var(--primary-color);
    font-weight: 700;
    font-size: 1.1rem
}

.search-stats {
    color: var(--secondary-color);
    font-weight: 500;
    font-size: .75rem
}

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

.search-input {
    flex: 1;
    min-width: 200px;
    padding: 10px 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-family: 'Cairo', sans-serif;
    font-size: .85rem
}

.search-input:focus {
    border-color: var(--secondary-color);
    outline: none
}

.search-btn {
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: .8rem
}

.search-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center
}

.filter-btn {
    padding: 6px 12px;
    border: 2px solid #e9ecef;
    background-color: white;
    border-radius: 50px;
    font-weight: 500;
    transition: all .3s ease;
    color: var(--primary-color);
    font-size: .7rem
}

.filter-btn:hover,
.filter-btn.active {
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
    color: white;
    border-color: var(--secondary-color)
}

.modal-custom {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1050
}

.modal-custom.show {
    display: flex
}

.modal-form {
    background: white;
    border-radius: 12px;
    width: 95%;
    max-width: 650px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2)
}

.modal-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 12px 15px;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center
}

.modal-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0
}

.close-modal {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer
}

.modal-body {
    padding: 15px
}

.modal-footer {
    padding: 12px 15px;
    border-top: 1px solid #e9ecef;
    display: flex;
    justify-content: flex-end;
    gap: 10px
}

.form-group {
    margin-bottom: 12px
}

.form-label {
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 5px;
    display: block;
    font-size: .8rem
}

.form-control,
.form-select {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-family: 'Cairo', sans-serif;
    font-size: .85rem
}

.form-control:focus,
.form-select:focus {
    border-color: var(--secondary-color);
    outline: none
}

.form-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap
}

.form-col {
    flex: 1;
    min-width: 100%
}

@media(min-width:576px) {
    .form-col {
        min-width: 45%
    }
}

.spare-parts-group,
.sale-item-group,
.purchase-item-group {
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 10px
}

.spare-part-item,
.sale-item-row,
.purchase-item-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    align-items: center;
    flex-wrap: wrap
}

.spare-part-item input,
.sale-item-row select,
.sale-item-row input,
.purchase-item-row input {
    flex: 1;
    min-width: 80px
}

.sale-item-price,
.sale-item-total,
.purchase-item-total {
    background: #f8f9fa
}

.btn-remove-service {
    background: var(--danger-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    font-size: .7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0
}

.btn-add-service {
    background: var(--success-color);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 6px 12px;
    font-size: .7rem;
    margin-top: 5px;
    cursor: pointer;
    font-family: 'Cairo', sans-serif
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch
}

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

.data-table th,
.data-table td {
    padding: 10px 8px;
    text-align: right;
    border-bottom: 1px solid #e9ecef;
    font-size: .75rem
}

.data-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: var(--primary-color);
    position: sticky;
    top: 0;
    font-size: .7rem
}

.filter-select {
    max-width: 250px;
    margin: 0 auto 15px auto;
    padding: 8px 12px;
    border-radius: 8px;
    border: 2px solid #e9ecef;
    font-family: 'Cairo', sans-serif
}

.badge-status {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: .65rem;
    font-weight: 500
}

.badge-new {
    background-color: #27ae60;
    color: white
}

.badge-used {
    background-color: #f39c12;
    color: white
}

.badge-damaged {
    background-color: #e74c3c;
    color: white
}

.badge-repairing {
    background-color: #9b59b6;
    color: white
}

.badge-sold {
    background-color: #7f8c8d;
    color: white
}

.badge-received {
    background-color: #3498db;
    color: white
}

.badge-diagnosing {
    background-color: #9b59b6;
    color: white
}

.badge-repairing-status {
    background-color: #f39c12;
    color: white
}

.badge-waiting {
    background-color: #e67e22;
    color: white
}

.badge-ready {
    background-color: #2ecc71;
    color: white
}

.badge-delivered {
    background-color: #27ae60;
    color: white
}

.badge-cancelled {
    background-color: #e74c3c;
    color: white
}

.badge-paid {
    background-color: #27ae60;
    color: white
}

.badge-unpaid {
    background-color: #e74c3c;
    color: white
}

.badge-partial {
    background-color: #f39c12;
    color: white
}

.badge-debt {
    background-color: #9b59b6;
    color: white
}

.badge-low {
    background-color: #e74c3c;
    color: white
}

.btn-sm {
    padding: 4px 8px;
    font-size: .65rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin: 0 1px
}

.notification {
    position: fixed;
    top: 10px;
    left: 10px;
    right: 10px;
    max-width: 90%;
    margin: 0 auto;
    background: white;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    padding: 10px;
    z-index: 1100;
    display: none;
    border-right: 4px solid var(--success-color);
    font-size: .8rem
}

.notification.show {
    display: block;
    animation: slideIn .3s ease
}

.fast-mode-indicator {
    position: fixed;
    top: 5px;
    right: 5px;
    background: var(--warning-color);
    color: white;
    padding: 4px 8px;
    border-radius: 20px;
    font-size: .65rem;
    font-weight: bold;
    z-index: 1001;
    display: none
}

.action-buttons {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 15px;
    flex-wrap: wrap
}

.section-container {
    display: none
}

.section-container.active {
    display: block
}

.btn-action {
    padding: 8px 12px;
    border-radius: 8px;
    font-weight: 500;
    border: none;
    transition: all .3s ease;
    font-size: .7rem;
    cursor: pointer
}

.btn-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1)
}

.btn-primary {
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
    color: white
}

.btn-success {
    background: linear-gradient(to right, #27ae60, #2ecc71);
    color: white
}

.btn-warning {
    background: linear-gradient(to right, #f39c12, #e67e22);
    color: white
}

.btn-danger {
    background: linear-gradient(to right, #c0392b, #e74c3c);
    color: white
}

.btn-info {
    background: linear-gradient(to right, #3498db, #2980b9);
    color: white
}

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

.settings-floating-btn {
    position: fixed;
    top: 20px;
    left: 20px;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    cursor: pointer;
    z-index: 1000;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: all .3s ease;
    border: 3px solid rgba(255, 255, 255, 0.3)
}

.settings-floating-btn:hover {
    transform: scale(1.15) rotate(90deg);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.4)
}

.user-display-badge {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, rgba(44, 62, 80, 0.95), rgba(52, 152, 219, 0.95));
    color: white;
    padding: 8px 16px;
    border-radius: 25px;
    font-size: .85rem;
    font-weight: 600;
    z-index: 1000;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 8px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all .3s ease;
    cursor: default;
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis
}

.user-display-badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3)
}

@keyframes slideIn {
    from {
        transform: translateY(-100px);
        opacity: 0
    }

    to {
        transform: translateY(0);
        opacity: 1
    }
}

@keyframes pulse {
    0% {
        transform: scale(1)
    }

    50% {
        transform: scale(1.05)
    }

    100% {
        transform: scale(1)
    }
}

@media(max-width:375px) {
    .main-container {
        padding: 8px
    }

    .content-area {
        padding: 10px
    }

    .section-title {
        font-size: 1.2rem
    }

    .stats-number {
        font-size: 1rem
    }

    .stats-label {
        font-size: .6rem
    }

    .controls .btn {
        padding: 6px 10px;
        font-size: .7rem
    }
}

@media(max-width:320px) {
    .data-table th {
        font-size: .6rem
    }

    .data-table td {
        font-size: .55rem
    }
}

body.dark-mode {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%)
}

body.dark-mode .content-area,
body.dark-mode .system-card,
body.dark-mode .search-container,
body.dark-mode .modal-form {
    background: #2d2d44;
    color: #e0e0e0
}

body.dark-mode .form-control,
body.dark-mode .form-select {
    background: #3d3d5c;
    color: #e0e0e0;
    border-color: #555
}

body.dark-mode .data-table th {
    background-color: #3d3d5c;
    color: #e0e0e0
}

body.font-small {
    font-size: .9rem
}

body.font-large {
    font-size: 1.1rem
}

body.font-small .section-title {
    font-size: 1.3rem
}

body.font-large .section-title {
    font-size: 1.7rem
}

/* ====== قائمة المستخدم المنسدلة ====== */
.user-dropdown-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.user-display-badge {
    background: linear-gradient(135deg, rgba(44, 62, 80, 0.95), rgba(52, 152, 219, 0.95));
    color: white;
    padding: 8px 16px;
    border-radius: 25px;
    font-size: .85rem;
    font-weight: 600;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 8px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all .3s ease;
    cursor: pointer;
    user-select: none;
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-display-badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}

.user-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    min-width: 220px;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all .3s ease;
    z-index: 1001;
    border: 1px solid #e9ecef;
}

.user-dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-dropdown-header {
    padding: 15px;
    text-align: center;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

.user-dropdown-name {
    font-weight: 700;
    font-size: 1rem;
    margin-top: 5px;
}

.user-dropdown-role {
    font-size: .75rem;
    opacity: .9;
    margin-top: 2px;
}

.user-dropdown-divider {
    height: 1px;
    background: #e9ecef;
    margin: 0;
}

.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    color: var(--primary-color);
    text-decoration: none;
    font-size: .85rem;
    font-weight: 500;
    transition: all .2s ease;
    cursor: pointer;
    background: none;
    border: none;
    width: 100%;
    font-family: 'Cairo', sans-serif;
    text-align: right;
}

.user-dropdown-item:hover {
    background: #f8f9fa;
    color: var(--secondary-color);
    padding-right: 20px;
}

.user-dropdown-item i {
    font-size: .9rem;
    width: 20px;
    text-align: center;
}

.logout-btn {
    color: var(--danger-color) !important;
}

.logout-btn:hover {
    background: #ffebee !important;
    color: var(--danger-color) !important;
}

.user-dropdown-menu::before {
    content: '';
    position: absolute;
    top: -6px;
    right: 25px;
    width: 12px;
    height: 12px;
    background: white;
    transform: rotate(45deg);
    border-top: 1px solid #e9ecef;
    border-left: 1px solid #e9ecef;
}

.user-dropdown-header+.user-dropdown-divider+.user-dropdown-item::before {
    display: none;
}