/* منظومة جرد الأجهزة المكتبية - ملف التصميم الرئيسي */

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

:root {
    --primary-color: #9ca3af;
    --secondary-color: #6b7280;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --maintenance-color: #f59e0b;
    --retired-color: #6b7280;
    --bg-color: #f3f4f6;
    --card-bg: #ffffff;
    --text-color: #1f2937;
    --border-color: #e5e7eb;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.3);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.15), 0 4px 6px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.2), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
}

.barcode-font {
    font-family: 'Libre Barcode 39 Text', cursive;
    font-size: 36px;
    font-weight: 400;
}

body {
    font-family: 'Cairo', sans-serif;
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    color: var(--text-color);
    line-height: 1.6;
    direction: rtl;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* الهيدر */
header {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--glass-border);
    box-shadow: var(--shadow-md);
    margin-bottom: 30px;
    position: sticky;
    top: 0;
    z-index: 100;
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    flex-wrap: wrap;
}

header h1 {
    color: var(--primary-color);
    font-size: 24px;
    font-weight: 700;
}

nav {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

nav a {
    color: var(--text-color);
    text-decoration: none;
    padding: 10px 15px;
    border-radius: 6px;
    transition: all 0.3s;
    font-weight: 500;
}

nav a:hover {
    background-color: var(--bg-color);
    color: var(--primary-color);
}

nav a.active {
    background-color: var(--primary-color);
    color: white;
}

/* الأزرار */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    text-decoration: none;
    font-family: 'Cairo', sans-serif;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
    font-size: 14px;
    margin: 0;
}

/* مسافات بين الأزرار عند استخدامها معاً (للاستخدام خارج flexbox) */
.btn-group .btn + .btn {
    margin-right: 12px;
}

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

.btn-primary:hover {
    background-color: #6b7280;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background-color: #475569;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-small {
    padding: 8px 16px;
    font-size: 12px;
}

.btn-icon {
    display: inline-block;
    padding: 8px 12px;
    text-decoration: none;
    margin: 0 3px;
    font-size: 18px;
    transition: transform 0.2s;
}

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

/* الإحصائيات */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    text-align: center;
    transition: all 0.3s ease;
}

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

.stat-card h3 {
    font-size: 14px;
    color: var(--secondary-color);
    margin-bottom: 10px;
    font-weight: 500;
}

.stat-card .stat-number {
    font-size: 36px;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-card.active .stat-number {
    color: var(--success-color);
}

.stat-card.maintenance .stat-number {
    color: var(--maintenance-color);
}

.stat-card.retired .stat-number {
    color: var(--retired-color);
}

/* الأقسام */
section {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    margin-bottom: 30px;
}

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

.section-header .btn {
    margin: 0;
}

.section-header h2 {
    color: var(--text-color);
    font-size: 24px;
    font-weight: 700;
}

/* الجداول */
.devices-table-container {
    overflow-x: auto;
}

.devices-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.devices-table thead {
    background-color: var(--bg-color);
}

.devices-table th {
    padding: 15px;
    text-align: right;
    font-weight: 600;
    color: var(--text-color);
    border-bottom: 2px solid var(--border-color);
}

.devices-table td {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
}

.devices-table tbody tr:hover {
    background-color: var(--bg-color);
}

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

/* علامات الحالة */
.status-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.status-active {
    background-color: #d1fae5;
    color: #065f46;
}

.status-inactive {
    background-color: #f3f4f6;
    color: #374151;
}

.status-maintenance {
    background-color: #fef3c7;
    color: #92400e;
}

.status-retired {
    background-color: #e5e7eb;
    color: #4b5563;
}

/* النماذج */
.form-section {
    max-width: 800px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-color);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-family: 'Cairo', sans-serif;
    font-size: 14px;
    transition: border-color 0.3s;
}

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

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

.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    flex-wrap: wrap;
    align-items: center;
}

.form-actions .btn {
    margin: 0;
    margin-right: 15px;
}

.form-actions .btn:last-child {
    margin-right: 0;
}

/* التنبيهات */
.alert {
    padding: 15px 20px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-weight: 500;
}

.alert-success {
    background-color: #d1fae5;
    color: #065f46;
    border-right: 4px solid var(--success-color);
}

.alert-error {
    background-color: #fee2e2;
    color: #991b1b;
    border-right: 4px solid var(--danger-color);
}

/* عرض الجهاز */
.device-view {
    max-width: 1000px;
    margin: 0 auto;
}

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

.device-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.info-card {
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow);
}

.info-card h3 {
    margin-bottom: 15px;
    color: var(--primary-color);
    font-size: 18px;
}

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

.info-table {
    width: 100%;
}

.info-table th {
    text-align: right;
    padding: 8px 0;
    color: var(--secondary-color);
    font-weight: 500;
    width: 40%;
}

.info-table td {
    padding: 8px 0;
    font-weight: 600;
}

.barcode-display {
    text-align: center;
    padding: 20px;
    background: white;
    border-radius: 6px;
    margin-bottom: 15px;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.barcode-display img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 10px;
    background: white;
}

.barcode-text {
    margin-top: 10px;
    font-family: monospace;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-color);
    word-break: break-all;
}

.barcode-link {
    font-family: monospace;
    color: var(--primary-color);
    text-decoration: none;
}

.barcode-link:hover {
    text-decoration: underline;
}

/* البحث */
.search-box {
    margin-bottom: 20px;
}

.search-box input {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-family: 'Cairo', sans-serif;
    font-size: 14px;
}

/* مسح الباركود */
.scan-section {
    max-width: 800px;
    margin: 0 auto;
}

.scan-box {
    padding: 20px;
}

.scan-form {
    margin-bottom: 30px;
}

.scan-input-group {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    align-items: stretch;
}

.scan-input-group .btn {
    white-space: nowrap;
}

.scan-input-group input {
    flex: 1;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-family: 'Cairo', sans-serif;
    font-size: 16px;
}

.camera-section {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.camera-section button {
    align-self: flex-start;
}

.camera-section video {
    border-radius: 8px;
    border: 2px solid var(--border-color);
}

.device-result {
    margin-top: 30px;
}

.device-info-card {
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 25px;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-md);
}

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

.device-info-header h4 {
    font-size: 20px;
    color: var(--text-color);
}

.device-info-details p {
    margin-bottom: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.device-info-actions {
    margin-top: 20px;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: center;
}

.device-info-actions .btn {
    margin: 0;
    margin-right: 15px;
}

.device-info-actions .btn:last-child {
    margin-right: 0;
}

/* التقارير */
.filter-box {
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.filter-form {
    width: 100%;
}

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

.filter-group:last-child {
    display: flex;
    flex-direction: row;
    gap: 12px;
    align-items: center;
}

.filter-group:last-child .btn {
    margin: 0;
    margin-right: 12px;
}

.filter-group:last-child .btn:last-child {
    margin-right: 0;
}

.filter-group {
    display: flex;
    flex-direction: column;
}

.filter-group label {
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 14px;
}

.filter-group select {
    padding: 10px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-family: 'Cairo', sans-serif;
}

.stats-section {
    margin-bottom: 30px;
}

.stats-section h3 {
    margin-bottom: 20px;
    color: var(--text-color);
    font-size: 20px;
}

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

.report-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.report-table th {
    background-color: var(--bg-color);
    padding: 12px;
    text-align: right;
    font-weight: 600;
    border-bottom: 2px solid var(--border-color);
}

.report-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
}

.report-list-section {
    margin-top: 30px;
}

/* الفوتر */
footer {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid var(--glass-border);
    padding: 20px;
    margin-top: 50px;
    text-align: center;
    color: var(--secondary-color);
    box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* الإجراءات */
.actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    align-items: center;
}

.device-actions {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: center;
}

.device-actions .btn {
    margin: 0;
    margin-right: 15px;
}

.device-actions .btn:last-child {
    margin-right: 0;
}

/* الطباعة */
@media print {
    header,
    footer,
    nav,
    .btn,
    .filter-box,
    .print-header {
        display: none;
    }

    body {
        background: white;
    }

    section {
        box-shadow: none;
        page-break-inside: avoid;
    }
}

/* استجابة للشاشات الصغيرة */
@media (max-width: 768px) {
    header .container {
        flex-direction: column;
        align-items: flex-start;
    }

    nav {
        width: 100%;
        margin-top: 15px;
    }

    nav a {
        flex: 1;
        text-align: center;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }

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

    .device-info-grid {
        grid-template-columns: 1fr;
    }

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

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

