/* css/global.css */
/* الأنماط العامة - الطراز المصري الفرعوني الكلاسيكي */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;600;700;800&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Amiri:wght@400;700&display=swap');

/* ===============================
   المتغيرات - الألوان المصرية الفرعونية
   =============================== */
:root {
    /* الألوان الأساسية من لوحة الألوان المصرية */
    --pharaoh-cream: #FAF3E0;
    /* #1 - كريمي فاتح */
    --pharaoh-beige: #EDD5B3;
    /* #2 - بيج وردي */
    --pharaoh-tan: #D4B896;
    /* #3 - بني فاتح */
    --pharaoh-sand: #E8D7C1;
    /* #4 - رملي */
    --pharaoh-gold: #F5E6D3;
    /* #5 - ذهبي فاتح */
    --pharaoh-brown: #D9C7A8;
    /* #6 - بني متوسط */
    --pharaoh-ivory: #FFF9F0;
    /* #7 - عاجي */
    --pharaoh-amber: #EBD5B3;
    /* #8 - عنبري */
    --pharaoh-bronze: #C9B899;
    /* #9 - برونزي */

    /* ألوان إضافية للتمييز */
    --pharaoh-dark: #8B7355;
    /* بني داكن للنصوص */
    --pharaoh-accent: #D4AF37;
    /* ذهبي مصري أصيل */
    --pharaoh-shadow: rgba(139, 115, 85, 0.15);

    /* الخطوط */
    --font-primary: 'Cairo', sans-serif;
    --font-decorative: 'Amiri', serif;
}

/* ===============================
   إعادة تعيين عامة
   =============================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-primary);
    background: var(--pharaoh-cream);
    background-image:
        repeating-linear-gradient(0deg,
            transparent,
            transparent 2px,
            var(--pharaoh-beige) 2px,
            var(--pharaoh-beige) 4px);
    direction: rtl;
    text-align: right;
    color: var(--pharaoh-dark);
    line-height: 1.8;
}

/* ===============================
   الأزرار - طراز فرعوني
   =============================== */
.btn {
    padding: 12px 28px;
    border: 3px solid var(--pharaoh-bronze);
    border-radius: 2px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: var(--font-primary);
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow:
        inset 0 2px 0 rgba(255, 255, 255, 0.3),
        0 4px 8px var(--pharaoh-shadow);
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
            transparent,
            rgba(255, 255, 255, 0.3),
            transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow:
        inset 0 2px 0 rgba(255, 255, 255, 0.4),
        0 8px 16px var(--pharaoh-shadow);
}

.btn:active {
    transform: translateY(-1px);
}

.btn-primary {
    background: linear-gradient(135deg, var(--pharaoh-gold) 0%, var(--pharaoh-amber) 100%);
    color: var(--pharaoh-dark);
    border-color: var(--pharaoh-bronze);
}

.btn-success {
    background: linear-gradient(135deg, #98D8C8 0%, #6FA387 100%);
    color: white;
    border-color: #5A8A74;
}

.btn-danger {
    background: linear-gradient(135deg, #E57373 0%, #C94C4C 100%);
    color: white;
    border-color: #A84040;
}

.btn-warning {
    background: linear-gradient(135deg, #FFB74D 0%, #F57C00 100%);
    color: white;
    border-color: #E65100;
}

.btn-info {
    background: linear-gradient(135deg, #64B5F6 0%, #1976D2 100%);
    color: white;
    border-color: #0D47A1;
}

.btn-export {
    background: linear-gradient(135deg, var(--pharaoh-accent) 0%, var(--pharaoh-bronze) 100%);
    color: var(--pharaoh-dark);
    border-color: var(--pharaoh-bronze);
}

/* ===============================
   البطاقات - تصميم فرعوني
   =============================== */
.card {
    background: var(--pharaoh-ivory);
    border: 3px solid var(--pharaoh-tan);
    border-radius: 0;
    box-shadow:
        inset 0 0 0 1px var(--pharaoh-beige),
        0 4px 12px var(--pharaoh-shadow);
    padding: 25px;
    transition: all 0.3s ease;
    position: relative;
}

.card::before,
.card::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid var(--pharaoh-accent);
}

.card::before {
    top: -2px;
    right: -2px;
    border-bottom: none;
    border-left: none;
}

.card::after {
    bottom: -2px;
    left: -2px;
    border-top: none;
    border-right: none;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow:
        inset 0 0 0 1px var(--pharaoh-beige),
        0 8px 20px var(--pharaoh-shadow);
    border-color: var(--pharaoh-accent);
}

/* ===============================
   الجداول - نمط هيروغليفي
   =============================== */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--pharaoh-ivory);
    border: 3px solid var(--pharaoh-tan);
    overflow: hidden;
}

table th,
table td {
    padding: 15px;
    text-align: right;
    border-bottom: 2px solid var(--pharaoh-beige);
    border-right: 1px solid var(--pharaoh-sand);
}

table th {
    background: linear-gradient(180deg, var(--pharaoh-gold) 0%, var(--pharaoh-amber) 100%);
    font-weight: 700;
    color: var(--pharaoh-dark);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 14px;
    border-bottom: 3px solid var(--pharaoh-bronze);
    position: relative;
}

table th::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 100%;
    height: 2px;
    background: repeating-linear-gradient(90deg,
            var(--pharaoh-accent),
            var(--pharaoh-accent) 5px,
            transparent 5px,
            transparent 10px);
}

table tr:nth-child(even) {
    background: var(--pharaoh-cream);
}

table tr:hover {
    background: var(--pharaoh-sand);
    transform: scale(1.01);
    transition: all 0.2s ease;
}

/* ===============================
   النماذج - أسلوب البردي
   =============================== */
.form-group {
    margin-bottom: 25px;
    position: relative;
}

.form-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 700;
    color: var(--pharaoh-dark);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 14px 18px;
    border: 3px solid var(--pharaoh-tan);
    border-radius: 0;
    font-size: 16px;
    font-family: var(--font-primary);
    background: var(--pharaoh-ivory);
    color: var(--pharaoh-dark);
    transition: all 0.3s ease;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--pharaoh-accent);
    background: white;
    box-shadow:
        inset 0 2px 4px rgba(0, 0, 0, 0.05),
        0 0 0 3px rgba(212, 175, 55, 0.2);
}

/* ===============================
   الإشعارات - بردي فرعوني
   =============================== */
.notification {
    position: fixed;
    top: 20px;
    left: 20px;
    padding: 18px 30px;
    border-radius: 0;
    color: white;
    font-weight: 700;
    z-index: 10000;
    animation: slideIn 0.5s ease;
    border: 3px solid;
    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.3),
        inset 0 2px 0 rgba(255, 255, 255, 0.3);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.notification.success {
    background: linear-gradient(135deg, #81C784 0%, #66BB6A 100%);
    border-color: #4CAF50;
}

.notification.error {
    background: linear-gradient(135deg, #E57373 0%, #EF5350 100%);
    border-color: #F44336;
}

.notification.warning {
    background: linear-gradient(135deg, #FFB74D 0%, #FFA726 100%);
    border-color: #FF9800;
}

.notification.info {
    background: linear-gradient(135deg, #64B5F6 0%, #42A5F5 100%);
    border-color: #2196F3;
}

@keyframes slideIn {
    from {
        transform: translateX(-100%) rotate(-5deg);
        opacity: 0;
    }

    to {
        transform: translateX(0) rotate(0deg);
        opacity: 1;
    }
}

/* ===============================
   الشارات (Badges) - أختام فرعونية
   =============================== */
.badge {
    padding: 6px 14px;
    border-radius: 0;
    font-size: 11px;
    font-weight: 700;
    display: inline-block;
    border: 2px solid;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.badge-success {
    background: #C8E6C9;
    color: #2E7D32;
    border-color: #4CAF50;
}

.badge-danger {
    background: #FFCDD2;
    color: #C62828;
    border-color: #F44336;
}

.badge-warning {
    background: #FFE0B2;
    color: #E65100;
    border-color: #FF9800;
}

.badge-info {
    background: #BBDEFB;
    color: #1565C0;
    border-color: #2196F3;
}

.badge-active {
    background: #C8E6C9;
    color: #2E7D32;
    border-color: #4CAF50;
}

.badge-inactive {
    background: #FFCDD2;
    color: #C62828;
    border-color: #F44336;
}

/* ===============================
   المودال - معبد فرعوني
   =============================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(139, 115, 85, 0.85);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
}

.modal.active {
    display: flex;
    animation: fadeIn 0.4s ease;
}

.modal-content {
    background: var(--pharaoh-ivory);
    padding: 35px;
    border: 4px solid var(--pharaoh-bronze);
    border-radius: 0;
    width: 90%;
    max-width: 650px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.5),
        inset 0 0 0 2px var(--pharaoh-tan);
    animation: modalSlideIn 0.5s ease;
    position: relative;
}

.modal-content::before {
    content: '';
    position: absolute;
    top: 10px;
    right: 10px;
    bottom: 10px;
    left: 10px;
    border: 1px solid var(--pharaoh-accent);
    pointer-events: none;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-100px) scale(0.9);
        opacity: 0;
    }

    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 3px solid var(--pharaoh-tan);
    position: relative;
}

.modal-header::after {
    content: '';
    position: absolute;
    bottom: -3px;
    right: 0;
    width: 100%;
    height: 2px;
    background: repeating-linear-gradient(90deg,
            var(--pharaoh-accent),
            var(--pharaoh-accent) 8px,
            transparent 8px,
            transparent 16px);
}

.modal-header h2 {
    color: var(--pharaoh-dark);
    font-size: 26px;
    font-weight: 800;
    font-family: var(--font-decorative);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.close-modal {
    font-size: 36px;
    cursor: pointer;
    color: var(--pharaoh-bronze);
    transition: all 0.3s ease;
    line-height: 1;
    font-weight: bold;
}

.close-modal:hover {
    color: var(--pharaoh-accent);
    transform: rotate(90deg);
}

/* ===============================
   Loading Spinner - عين حورس
   =============================== */
.loader {
    border: 5px solid var(--pharaoh-sand);
    border-top: 5px solid var(--pharaoh-accent);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 25px auto;
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.5);
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* ===============================
   المؤشر المباشر - جعران حي
   =============================== */
.live-indicator {
    width: 14px;
    height: 14px;
    background: var(--pharaoh-accent);
    border-radius: 50%;
    display: inline-block;
    margin-left: 10px;
    animation: pharaohPulse 2s infinite;
    box-shadow: 0 0 10px var(--pharaoh-accent);
    border: 2px solid var(--pharaoh-bronze);
}

@keyframes pharaohPulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
        box-shadow: 0 0 10px var(--pharaoh-accent);
    }

    50% {
        opacity: 0.6;
        transform: scale(1.3);
        box-shadow: 0 0 20px var(--pharaoh-accent);
    }
}

/* ===============================
   الشبكة
   =============================== */
.grid {
    display: grid;
    gap: 25px;
}

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.grid-4 {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* ===============================
   Loading Overlay - بوابة المعبد
   =============================== */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(139, 115, 85, 0.92);
    z-index: 999999;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(10px);
    animation: fadeIn 0.3s ease;
}

.loading-overlay.active {
    display: flex;
}

.loading-content {
    background: var(--pharaoh-ivory);
    padding: 60px 70px;
    border: 5px solid var(--pharaoh-bronze);
    border-radius: 0;
    text-align: center;
    box-shadow:
        0 30px 80px rgba(0, 0, 0, 0.6),
        inset 0 0 0 2px var(--pharaoh-accent);
    animation: scaleIn 0.5s ease;
    position: relative;
}

.loading-content::before {
    content: '';
    position: absolute;
    top: 15px;
    right: 15px;
    bottom: 15px;
    left: 15px;
    border: 1px solid var(--pharaoh-tan);
    pointer-events: none;
}

.loading-spinner {
    width: 70px;
    height: 70px;
    border: 7px solid var(--pharaoh-sand);
    border-top: 7px solid var(--pharaoh-accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 30px;
    box-shadow: 0 0 30px rgba(212, 175, 55, 0.6);
}

.loading-text {
    font-size: 22px;
    font-weight: 800;
    color: var(--pharaoh-dark);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-family: var(--font-decorative);
}

.loading-subtext {
    font-size: 15px;
    color: var(--pharaoh-bronze);
    margin-top: 12px;
    font-weight: 600;
}

@keyframes scaleIn {
    from {
        transform: scale(0.7) rotate(-5deg);
        opacity: 0;
    }

    to {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed !important;
    pointer-events: none;
    filter: grayscale(0.5);
}

/* ===============================
   Scrollbar - لفافة البردي
   =============================== */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: var(--pharaoh-cream);
    border: 1px solid var(--pharaoh-tan);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--pharaoh-gold) 0%, var(--pharaoh-bronze) 100%);
    border: 2px solid var(--pharaoh-tan);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, var(--pharaoh-accent) 0%, var(--pharaoh-bronze) 100%);
}

/* ===============================
   Responsive - التكيف مع التابلت
   =============================== */
@media (max-width: 1024px) {
    .grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    body {
        font-size: 14px;
    }

    .modal-content {
        width: 95%;
        padding: 25px;
    }

    table {
        font-size: 13px;
    }

    table th,
    table td {
        padding: 10px;
    }

    .btn {
        padding: 10px 20px;
        font-size: 14px;
    }

    .loading-content {
        padding: 40px 50px;
    }

    .card {
        padding: 20px;
    }
}

@media (max-width: 480px) {

    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 14px;
        padding: 12px 15px;
    }

    .notification {
        left: 10px;
        right: 10px;
        width: calc(100% - 20px);
    }
}
