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

html, body {
    direction: rtl;
    text-align: right;
}

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

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

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

header h1 {
    font-size: 2em;
    margin-bottom: 10px;
    font-weight: 600;
}

header .subtitle {
    font-size: 1.1em;
    opacity: 0.9;
    font-weight: 300;
}

.search-section {
    padding: 25px 20px;
    background: #f8f9fa;
    border-bottom: 2px solid #e9ecef;
    position: relative;
}

.search-box {
    width: 100%;
    padding: 15px 20px;
    font-size: 16px;
    border: 2px solid #ddd;
    border-radius: 8px;
    transition: all 0.3s ease;
    font-family: inherit;
    background: white;
}

/* زر مسح الباركود */
.search-actions {
    margin-top: 10px;
}
.scan-btn {
    appearance: none;
    border: 1px solid #ddd;
    background: #fff;
    color: #333;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}
.scan-btn:hover {
    background: #f6f6f6;
    border-color: #ccc;
}

/* نافذة الماسح */
.scanner-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.scanner-content {
    width: min(640px, 92vw);
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}
.scanner-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-bottom: 1px solid #eee;
    font-weight: 600;
}
.close-scanner {
    appearance: none;
    border: none;
    background: transparent;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    color: #666;
}
.scanner-viewport {
    width: 100%;
    height: min(420px, 65vh);
    background: #000;
    position: relative;
}
/* تلميح */
.scanner-hint {
    padding: 10px 14px;
    font-size: 12px;
    color: #666;
    border-top: 1px solid #eee;
}

/* إطار إرشادي بسيط داخل الفيديو */
.scanner-viewport::after {
    content: "";
    position: absolute;
    inset: 15% 12%;
    border: 2px dashed rgba(255,255,255,0.7);
    border-radius: 8px;
    pointer-events: none;
}

.loading-indicator {
    display: none;
    color: #667eea;
    font-size: 14px;
    margin-top: 10px;
    font-weight: 500;
}

.loading-indicator.active {
    display: block;
}

.results-section {
    padding: 25px 20px;
    min-height: 200px;
}

.no-search-message,
.no-results-message {
    text-align: center;
    color: #999;
    font-size: 1.1em;
    padding: 40px 20px;
}

.no-results-message {
    color: #e74c3c;
}

.table-wrapper {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

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

.results-table thead {
    background: #f0f2f5;
    position: sticky;
    top: 0;
    z-index: 10;
}

.results-table th {
    padding: 15px;
    text-align: right;
    font-weight: 600;
    color: #667eea;
    border-bottom: 2px solid #e9ecef;
    white-space: nowrap;
}

.results-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #e9ecef;
    word-wrap: break-word;
    max-width: 300px;
}

.results-table tbody tr {
    transition: background-color 0.2s ease;
}

.results-table tbody tr:hover {
    background-color: #f8f9fa;
}

.results-table tbody tr:nth-child(even) {
    background-color: #fcfcfd;
}

footer {
    background: #f8f9fa;
    padding: 20px;
    text-align: center;
    border-top: 1px solid #e9ecef;
    color: #666;
    font-size: 0.95em;
}

footer p {
    margin: 5px 0;
}

.config-info {
    font-size: 0.85em;
    color: #999;
}

#lastUpdate {
    color: #667eea;
    font-weight: 500;
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    header {
        padding: 20px 15px;
    }

    header h1 {
        font-size: 1.5em;
    }

    header .subtitle {
        font-size: 1em;
    }

    .search-section {
        padding: 15px;
    }

    .search-box {
        padding: 12px 15px;
        font-size: 16px;
    }

    .results-section {
        padding: 15px;
    }

    .results-table th,
    .results-table td {
        padding: 10px;
        font-size: 0.9em;
    }

    .no-search-message,
    .no-results-message {
        font-size: 1em;
        padding: 30px 15px;
    }

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

@media (max-width: 480px) {
    header h1 {
        font-size: 1.3em;
    }

    header .subtitle {
        font-size: 0.9em;
    }

    .search-box {
        font-size: 16px;
        padding: 10px 12px;
    }

    .results-table th,
    .results-table td {
        padding: 8px;
        font-size: 0.8em;
    }

    .results-table {
        font-size: 0.9em;
    }
}

