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

body{
    font-family:'Cairo',sans-serif;
    background:#f5f5f5;
    direction:rtl;
    min-height:100vh;
    display:flex;
    flex-direction:column;
}

nav{
    background:#8b0000;
    color:white;
    text-align:center;
    padding:20px;
}

.logo{font-size:28px;font-weight:bold}

header{
    background:linear-gradient(to left,#b30000,#d10000);
    color:white;
    text-align:center;
    padding:55px 20px;
}

header h1{font-size:42px;margin-bottom:10px}

main{flex:1;padding:35px 60px}

.notification{
    display:none;
    padding:14px;
    border-radius:10px;
    margin-bottom:20px;
    text-align:center;
    font-weight:bold;

    position:fixed;
    top:90px;
    left:50%;
    transform:translateX(-50%);

    z-index:5000;
}

.notification.success{display:block;background:#e6f8ed;color:#1f7a3f;border:1px solid #1f7a3f}
.notification.error{display:block;background:#ffecec;color:#b30000;border:1px solid #b30000}
.notification.warning{display:block;background:#fff7e6;color:#b36b00;border:1px solid #d98200}

.stats{
    display:flex;
    gap:20px;
    flex-wrap:wrap;
    margin-bottom:30px;
}

.stat-box{
    background:white;
    flex:1;
    min-width:190px;
    padding:22px;
    text-align:center;
    border-radius:16px;
    box-shadow:0 4px 14px rgba(0,0,0,0.08);
}

.stat-box h3{color:#b30000;font-size:28px}

.top-actions{
    display:flex;
    gap:15px;
    margin-bottom:25px;
    flex-wrap:wrap;
}

.upload-btn,.category-btn,.log-btn{
    border:none;
    padding:14px 28px;
    border-radius:12px;
    cursor:pointer;
    font-size:18px;
    font-family:'Cairo',sans-serif;
    color:white;
}

.upload-btn{background:#b30000}
.category-btn{background:#555}
.log-btn{background:#1f7a3f}

.filters{
    display:flex;
    gap:15px;
    flex-wrap:wrap;
    margin-bottom:25px;
}

.filters input,.filters select{
    padding:13px;
    border:1px solid #ddd;
    border-radius:10px;
    font-size:16px;
    font-family:'Cairo',sans-serif;
}

.table-section{
    background:white;
    padding:20px;
    border-radius:18px;
    box-shadow:0 5px 20px rgba(0,0,0,0.08);
    overflow-x:auto;
}

table{width:100%;border-collapse:collapse;min-width:1250px}

th{
    background:#b30000;
    color:white;
    padding:14px;
}

td{
    padding:13px;
    text-align:center;
    border-bottom:1px solid #eee;
}

tr:hover{background:#fff3f3}

.view-btn,.download-btn,.edit-btn,.delete-btn{
    border:none;
    padding:8px 12px;
    border-radius:8px;
    cursor:pointer;
    font-family:'Cairo',sans-serif;
    color:white;
    margin:3px;
}

.view-btn{background:#555}
.download-btn{background:#b30000}
.edit-btn{background:#d98200}
.delete-btn{background:#333}

.uploaded{color:#1f7a3f;font-weight:bold}

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

.confirm-box{
    display:none;
    position:fixed;
    top:0;
    left:0;
    width:100%;
    height:100%;
    background:rgba(0,0,0,0.6);
    justify-content:center;
    align-items:center;
    z-index:5000;
}

.popup-content{
    background:white;
    width:90%;
    max-width:650px;
    max-height:88vh;

    overflow-y:auto;

    border-radius:20px;

    padding:25px;

    box-shadow:
    0 15px 40px rgba(0,0,0,0.25);

    animation:popupScale 0.25s ease;
}

.popup-content h2,.confirm-content h3{
    color:#b30000;
    margin-bottom:22px;
}

.upload-options{
    display:flex;
    gap:12px;
    justify-content:center;
    flex-wrap:wrap;
    margin-bottom:15px;
}

.option-btn{
    background:#f0f0f0;
    border:none;
    padding:14px 18px;
    border-radius:12px;
    cursor:pointer;
    font-family:'Cairo',sans-serif;
    font-size:16px;
}

.upload-status{
    background:#f8f8f8;
    border:1px dashed #ccc;
    padding:12px;
    border-radius:10px;
    margin-bottom:18px;
}

form{
    display:flex;
    flex-direction:column;
    gap:14px;
}

form input,form select,form textarea,.category-form input{
    padding:13px;
    border:1px solid #ddd;
    border-radius:10px;
    font-size:16px;
    font-family:'Cairo',sans-serif;
}

input[type="date"]{direction:ltr;text-align:left}

textarea{resize:none;height:90px}

.save-btn,.close-btn,.category-form button{
    border:none;
    padding:13px;
    border-radius:10px;
    cursor:pointer;font-family:'Cairo',sans-serif;
    color:white;
}

.save-btn,.category-form button{background:#b30000}
.close-btn{background:#555;margin-top:15px}

.category-form{
    display:flex;
    gap:10px;
    margin-bottom:20px;
}

#categoryList,#logList{
    list-style:none;
    text-align:right;
}

#categoryList li,#logList li{
    background:#f5f5f5;
    padding:12px;
    border-radius:10px;
    margin-bottom:10px;
}

.category-actions button{
    margin:5px;
    padding:6px 12px;
    border:none;
    border-radius:6px;
    cursor:pointer;
    color:white;
}

.category-actions .edit-cat{background:#d98200}
.category-actions .delete-cat{background:#333}

.confirm-actions{
    display:flex;
    justify-content:center;
    gap:15px;
    margin-top:25px;
}

.confirm-delete,.cancel-delete{
    border:none;
    padding:12px 25px;
    border-radius:10px;
    cursor:pointer;
    color:white;
    font-family:'Cairo',sans-serif;
}

.confirm-delete{background:#b30000}
.cancel-delete{background:#555}

footer{
    background:#8b0000;
    color:white;
    text-align:center;
    padding:18px;
}*{
    margin:0;
    padding:0;
    box-sizing:border-box;
}

body{
    font-family:'Cairo',sans-serif;
    background:#f5f5f5;
    direction:rtl;
    min-height:100vh;
    display:flex;
    flex-direction:column;
}

nav{
    background:#8b0000;
    color:white;
    text-align:center;
    padding:20px;
}

.logo{
    font-size:28px;
    font-weight:bold;
}

header{
    background:linear-gradient(to left,#b30000,#d10000);
    color:white;
    text-align:center;
    padding:55px 20px;
}

header h1{
    font-size:42px;
    margin-bottom:10px;
}

main{
    flex:1;
    padding:35px 60px;
}

.notification{
    display:none;
    padding:14px;
    border-radius:10px;
    margin-bottom:20px;
    text-align:center;
    font-weight:bold;
}

.notification.success{
    display:block;
    background:#e6f8ed;
    color:#1f7a3f;
    border:1px solid #1f7a3f;
}

.notification.error{
    display:block;
    background:#ffecec;
    color:#b30000;
    border:1px solid #b30000;
}

.notification.warning{
    display:block;
    background:#fff7e6;
    color:#b36b00;
    border:1px solid #d98200;
}

.stats{
    display:flex;
    gap:20px;
    flex-wrap:wrap;
    margin-bottom:30px;
}

.stat-box{
    background:white;
    flex:1;
    min-width:190px;
    padding:22px;
    text-align:center;
    border-radius:16px;
    box-shadow:0 4px 14px rgba(0,0,0,0.08);
}

.stat-box h3{
    color:#b30000;
    font-size:28px;
}

.top-actions{
    display:flex;
    gap:15px;
    margin-bottom:25px;
    flex-wrap:wrap;
}

.upload-btn,
.category-btn,
.log-btn{
    border:none;
    padding:14px 28px;
    border-radius:12px;
    cursor:pointer;
    font-size:18px;
    font-family:'Cairo',sans-serif;
    color:white;
}

.upload-btn{
    background:#b30000;
}

.category-btn{
    background:#555;
}

.log-btn{
    background:#1f7a3f;
}

.filters{
    display:flex;
    gap:15px;
    flex-wrap:wrap;
    margin-bottom:25px;
}

.filters input,
.filters select{
    padding:13px;
    border:1px solid #ddd;
    border-radius:10px;
    font-size:16px;
    font-family:'Cairo',sans-serif;
}

.table-section{
    background:white;
    padding:20px;
    border-radius:18px;
    box-shadow:0 5px 20px rgba(0,0,0,0.08);
    overflow-x:auto;
}

table{
    width:100%;
    border-collapse:collapse;
    min-width:1250px;
}

th{
    background:#b30000;
    color:white;
    padding:14px;
}

td{
    padding:13px;
    text-align:center;
    border-bottom:1px solid #eee;
}

.table-section tbody tr:hover{
    background:#e8fff0 !important;
}

.view-btn,
.download-btn,
.edit-btn,
.delete-btn{
    border:none;
    padding:8px 12px;
    border-radius:8px;
    cursor:pointer;
    font-family:'Cairo',sans-serif;
    color:white;
    margin:3px;
}

.view-btn{
    background:#555;
}

.download-btn{
    background:#b30000;
}

.edit-btn{
    background:#d98200;
}

.delete-btn{
    background:#333;
}

.uploaded{
    color:#1f7a3f;
    font-weight:bold;
}

.popup{
    position:fixed;
    inset:0;
    background:rgba(0,0,0,0.45);
    backdrop-filter:blur(6px);

    display:none;
    justify-content:center;
    align-items:center;

    z-index:3000;

    animation:fadeIn 0.25s ease;
}

.popup-content,
.confirm-content{
    background:white;
    width:600px;
    max-width:92%;
    padding:30px;
    border-radius:20px;
    text-align:center;
    max-height:90vh;
    overflow:auto;
}

.popup-content h2,
.confirm-content h3{
    color:#b30000;
    margin-bottom:22px;
}

.upload-options{
    display:flex;
    gap:12px;
    justify-content:center;
    flex-wrap:wrap;
    margin-bottom:15px;
}

.option-btn{
    background:#f0f0f0;
    border:none;
    padding:14px 18px;
    border-radius:12px;
    cursor:pointer;
    font-family:'Cairo',sans-serif;
    font-size:16px;
}

.upload-status{
    background:#f8f8f8;
    border:1px dashed #ccc;
    padding:12px;
    border-radius:10px;
    margin-bottom:18px;
}

form{
    display:flex;
    flex-direction:column;
    gap:14px;
}

form input,
form select,
form textarea,
.category-form input{
    padding:13px;
    border:1px solid #ddd;
    border-radius:10px;
    font-size:16px;
    font-family:'Cairo',sans-serif;
}input[type="date"]{
    direction:ltr;
    text-align:left;
}

textarea{
    resize:none;
    height:90px;
}

.save-btn,
.close-btn,
.category-form button{
    border:none;
    padding:13px;
    border-radius:10px;
    cursor:pointer;
    font-family:'Cairo',sans-serif;
    color:white;
}

.save-btn,
.category-form button{
    background:#b30000;
}

.close-btn{
    background:#555;
}

.category-form{
    display:flex;
    gap:10px;
    margin-bottom:20px;
}

#categoryList,
#logList{
    list-style:none;
    text-align:right;
}

#categoryList li,
#logList li{
    background:#f5f5f5;
    padding:12px;
    border-radius:10px;
    margin-bottom:10px;
}

.category-actions button{
    margin:5px;
    padding:6px 12px;
    border:none;
    border-radius:6px;
    cursor:pointer;
    color:white;
}

.category-actions .edit-cat{
    background:#d98200;
}

.category-actions .delete-cat{
    background:#333;
}

.confirm-actions{
    display:flex;
    justify-content:center;
    gap:15px;
    margin-top:25px;
}

.confirm-delete,
.cancel-delete{
    border:none;
    padding:12px 25px;
    border-radius:10px;
    cursor:pointer;
    color:white;
    font-family:'Cairo',sans-serif;
}

.confirm-delete{
    background:#b30000;
}

.cancel-delete{
    background:#555;
}

footer{
    background:#8b0000;
    color:white;
    text-align:center;
    padding:18px;
}
.hide-edit .edit-btn{
    display:none;
}

.hide-delete .delete-btn{
    display:none;
}

.hide-view .view-btn{
    display:none;
}

.hide-download .download-btn{
    display:none;
}
nav{
    background:#8b0000;
    color:white;
    display:flex;
    justify-content:space-between;
    align-items:center;
    padding:20px 40px;
}

.logout-btn{
    background:white;
    color:#8b0000;
    border:none;
    padding:10px 22px;
    border-radius:10px;
    cursor:pointer;
    font-family:'Cairo',sans-serif;
    font-weight:bold;
}
.popup-notification{
    display:none;
    padding:12px;
    border-radius:10px;
    margin-bottom:15px;
    font-weight:bold;
}

.popup-notification.error{
    display:block;
    background:#ffecec;
    color:#b30000;
    border:1px solid #b30000;
}

.popup-notification.warning{
    display:block;
    background:#fff7e6;
    color:#b36b00;
    border:1px solid #d98200;
}

.popup-notification.success{
    display:block;
    background:#e6f8ed;
    color:#1f7a3f;
    border:1px solid #1f7a3f;
}
.log-actions{
    display:flex;
    justify-content:center;
    gap:15px;
    margin-top:15px;
    position:sticky;
    bottom:0;
    background:white;
    padding:15px 0 5px;
    z-index:10;
}

.clear-log-btn{
    background:#b30000;
    color:white;
    border:none;
    width:140px;
    height:50px;
    border-radius:10px;
    cursor:pointer;
    font-family:'Cairo',sans-serif;
    font-size:18px;
}

.close-btn{
    width:140px;
    height:50px;
}
.log-actions .close-btn,
.log-actions .clear-log-btn{
    width:140px;
    height:50px;
    margin-top:0;
    display:flex;
    align-items:center;
    justify-content:center;
}
.file-viewer{
    display:none;
    position:fixed;
    top:0;
    left:0;
    width:100%;
    height:100%;
    background:rgba(0,0,0,0.65);
    z-index:2000;
    justify-content:center;
    align-items:center;
}

.viewer-content{
    background:white;
    width:85%;
    height:85%;
    border-radius:18px;
    overflow:hidden;
    display:flex;
    flex-direction:column;
}

.viewer-header{
    background:#8b0000;
    color:white;
    padding:15px 25px;
    display:flex;
    justify-content:space-between;
    align-items:center;
}

.viewer-header button{
    background:white;
    color:#8b0000;
    border:none;
    padding:9px 20px;
    border-radius:8px;
    cursor:pointer;
    font-family:'Cairo',sans-serif;
    font-weight:bold;
}

.viewer-body{
    flex:1;
    background:#f5f5f5;
    display:flex;
    justify-content:center;
    align-items:center;
    overflow:auto;
}

.viewer-body iframe{
    width:100%;
    height:100%;
    border:none;
}

.viewer-body img{
    max-width:95%;
    max-height:95%;
    border-radius:10px;
}
.drop-zone{
    border:2px dashed #b30000;
    border-radius:14px;
    padding:25px;
    text-align:center;
    color:#8b0000;
    background:#fff7f7;
    margin:15px 0;
    font-weight:bold;
}

.drop-zone.drag-over{
    background:#ffe1e1;
    border-color:#7a0000;
}
.files-preview{
    margin:15px 0;
    display:flex;
    flex-direction:column;
    gap:10px;
}

.preview-item{
    display:flex;
    justify-content:space-between;
    align-items:center;
    background:#f7f7f7;
    border:1px solid #ddd;
    border-radius:10px;
    padding:10px 14px;
    font-size:14px;
}

.preview-name{
    font-weight:bold;
    color:#333;
}

.preview-size{
    color:#8b0000;
}
.dashboard-stats{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(180px,1fr));
    gap:20px;
    margin:25px 0;
}

.dash-card{
    background:white;
    padding:25px;
    border-radius:16px;
    text-align:center;
    box-shadow:0 4px 14px rgba(0,0,0,0.08);
}

.dash-card h3{
    color:#b30000;
    font-size:28px;
    margin-bottom:8px;
}

.dash-card p{
    color:#555;
    font-weight:bold;
}
.table-section table{
    border-spacing:0;
}

.table-section thead th{
    position:sticky;
    top:0;
    z-index:5;
    background:#8b0000;
}

.table-section tbody tr{
    transition:0.25s;
}

.table-section tbody tr:hover{
    background:#e8fff0;
}
.table-section tbody tr:hover{
    background:#e8fff0 !important;
    transform:scale(1.005);
}

.file-badge{
    padding:6px 12px;
    border-radius:20px;
    font-weight:bold;
    font-size:13px;
    display:inline-block;
}

.badge-pdf{
    background:#ffe5e5;
    color:#b30000;
}

.badge-word{
    background:#e7f0ff;
    color:#0b4db3;
}

.badge-excel{
    background:#e7f8ec;
    color:#087a2f;
}

.badge-image{
    background:#fff3d9;
    color:#b36b00;
}

.badge-other{
    background:#eee;
    color:#444;
}
.image-preview-box{
    width:100%;
    height:100%;
    background:#2f2f2f;
    display:flex;
    justify-content:center;
    align-items:center;
    overflow:auto;
}

.image-preview-box img{
    max-width:95%;
    max-height:95%;
    object-fit:contain;
    border-radius:6px;
}
.image-preview-toolbar{
    background:#f5f5f5;
    padding:10px;
    text-align:left;
    border-bottom:1px solid #ddd;
}

.image-preview-toolbar button{
    background:#b30000;
    color:white;
    border:none;
    padding:10px 18px;
    border-radius:8px;
    cursor:pointer;
    font-family:'Cairo',sans-serif;
    font-size:15px;
}

.image-preview-toolbar button:hover{
    background:#8f0000;
}
nav{
    position:sticky;
    top:0;
    z-index:1000;
}

footer{
    position:fixed;
    bottom:0;
    left:0;
    width:100%;
    z-index:1000;
}

body{
    padding-bottom:70px;
}

.empty-table{
    text-align:center;
    padding:40px;
    color:#777;
    font-size:18px;
    font-weight:bold;
}
@keyframes fadeIn{

    from{
        opacity:0;
    }

    to{
        opacity:1;
    }
}

@keyframes popupScale{

    from{
        transform:scale(0.92);
        opacity:0;
    }

    to{
        transform:scale(1);
        opacity:1;
    }
}

/* Scroll احترافي */

.popup-content::-webkit-scrollbar{
    width:10px;
}

.popup-content::-webkit-scrollbar-thumb{
    background:#b30000;
    border-radius:10px;
}

.popup-content::-webkit-scrollbar-track{
    background:#f1f1f1;
}
.upload-progress{
    width:100%;
    height:12px;
    background:#eee;
    border-radius:20px;
    overflow:hidden;
    margin-top:10px;
}

.upload-progress-bar{
    width:0%;
    height:100%;
    background:linear-gradient(
        90deg,
        #b30000,
        #ff4d4d
    );

    transition:0.25s;
}
.pagination{
    display:flex;
    justify-content:center;
    align-items:center;
    gap:15px;
    margin:25px 0;
}

.pagination button{
    background:#b30000;
    color:white;
    border:none;
    padding:10px 22px;
    border-radius:10px;
    cursor:pointer;
    font-family:'Cairo',sans-serif;
    font-weight:bold;
}

.pagination span{
    font-weight:bold;
    color:#333;
}
.table-section tbody tr:hover td{
    background:#d8ffe5 !important;
}
.search-results-info{
    margin-top:12px;
    color:#666;
    font-weight:bold;
    font-size:15px;
}
.highlight-search{
    background:#fff3a3;
    color:#000;
    padding:2px 4px;
    border-radius:4px;
    font-weight:bold;
}
#logPopup .popup-content{
    max-height:80vh;
    display:flex;
    flex-direction:column;
}

#logList{
    max-height:55vh;
    overflow-y:auto;
    padding-left:0;
    padding-right:0;
}