@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700;900&display=swap');

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

body {
    font-family: 'Tajawal', sans-serif;
    direction: rtl;
    background: linear-gradient(135deg, #1e3c28 0%, #2d5a3d 100%);
    min-height: 100vh;
    color: #333;
}

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

/* Header Styles */
.header {
    background: linear-gradient(135deg, #1a3320 0%, #2d5a3d 100%);
    color: white;
    padding: 30px 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    margin-bottom: 40px;
}

.header h1 {
    text-align: center;
    font-size: 2.5em;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

/* Card Styles */
.card {
    background: white;
    border-radius: 15px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    padding: 40px;
    margin-bottom: 30px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

.card h2 {
    color: #1a3320;
    font-size: 1.8em;
    margin-bottom: 25px;
    font-weight: 700;
    border-bottom: 3px solid #2d5a3d;
    padding-bottom: 10px;
}

/* Form Styles */
.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #1a3320;
    font-weight: 600;
    font-size: 1.1em;
}

.form-control {
    width: 100%;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1em;
    font-family: 'Tajawal', sans-serif;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: #2d5a3d;
    box-shadow: 0 0 0 3px rgba(45, 90, 61, 0.1);
}

/* Button Styles */
.btn {
    padding: 15px 35px;
    border: none;
    border-radius: 10px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Tajawal', sans-serif;
    display: inline-block;
    text-decoration: none;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, #2d5a3d 0%, #1a3320 100%);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #1a3320 0%, #0f1f14 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(45, 90, 61, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, #c62828 0%, #8e0000 100%);
    color: white;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #8e0000 0%, #5f0000 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(198, 40, 40, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, #388e3c 0%, #1b5e20 100%);
    color: white;
    padding: 8px 18px;          /* 🔹 تصغير الأزرار */
    font-size: 0.9em;           /* 🔹 تقليل حجم الخط */
}

.btn-success:hover {
    background: linear-gradient(135deg, #1b5e20 0%, #0d3311 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(56, 142, 60, 0.4);
    padding: 8px 18px;          /* 🔹 تصغير الأزرار */
    font-size: 0.9em;           /* 🔹 تقليل حجم الخط */
}

.btn-secondary {
    background: linear-gradient(135deg, #757575 0%, #424242 100%);
    color: white;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #424242 0%, #212121 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(117, 117, 117, 0.4);
}

/* Table Styles */
.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.table thead {
    background: linear-gradient(135deg, #2d5a3d 0%, #1a3320 100%);
    color: white;
}

.table th,
.table td {
    padding: 15px;
    text-align: right;
    border-bottom: 1px solid #e0e0e0;
}

.table th {
    font-weight: 700;
    font-size: 1.1em;
}

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

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

/* Alert Styles */
.alert {
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 25px;
    font-weight: 500;
    font-size: 1.1em;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 2px solid #c3e6cb;
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 2px solid #f5c6cb;
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 2px solid #bee5eb;
}

/* File Upload Styles */
.file-upload {
    border: 3px dashed #2d5a3d;
    border-radius: 15px;
    padding: 40px;
    text-align: center;
    transition: all 0.3s ease;
    background-color: #f9f9f9;
}

.file-upload:hover {
    background-color: #f0f8f4;
    border-color: #1a3320;
}

.file-upload input[type="file"] {
    display: none;
}

.file-upload label {
    cursor: pointer;
    color: #2d5a3d;
    font-size: 1.2em;
    font-weight: 600;
}

/* === التعديل يبدأ من هنا === */

/* Event List Styles */
.event-list {
    list-style: none;
    padding: 0;
    display: grid; /* 1. استخدام Grid Layout */
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); /* 2. إنشاء أعمدة متجاوبة */
    gap: 25px; /* 3. إضافة مسافة بين البطاقات */
}

.event-item {
    background: linear-gradient(135deg, #ffffff 0%, #f5f5f5 100%);
    border: 2px solid #e0e0e0;
    border-radius: 12px;
        padding: 10px 15px 15px 15px !important; /* تقليل المسافة العلوية فعلاً */

    transition: all 0.3s ease;
    cursor: pointer;
    display: flex; /* 4. استخدام Flexbox لتنسيق المحتوى الداخلي */
    flex-direction: column; /* 5. ترتيب العناصر بشكل عمودي */
    justify-content: space-between; /* 6. دفع زر الطباعة إلى الأسفل دائماً */
}

/* === التعديل ينتهي هنا === */

.event-item:hover {
    border-color: #2d5a3d;
    box-shadow: 0 6px 20px rgba(45, 90, 61, 0.15);
    transform: translateY(-5px); /* تم تعديل التأثير ليتناسب مع Grid */
}

.event-item h3 {
    color: #1a3320;
    font-size: 1.5em;
    margin-bottom: 10px;
    font-weight: 700;
}

.event-item p {
    color: #666;
    margin: 8px 0;
    font-size: 1.05em;
}

/* Certificate Preview */
.certificate-preview {
    position: relative;
    margin-top: 30px;
    border: 5px solid #2d5a3d;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.certificate-preview img {
    width: 100%;
    display: block;
}

/* Loading Spinner */
.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #2d5a3d;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .header h1 {
        font-size: 1.8em;
    }
    
    .card {
        padding: 25px;
    }
    
    .card h2 {
        font-size: 1.4em;
    }
    
    .table {
        font-size: 0.9em;
    }
    
    .table th,
    .table td {
        padding: 10px;
    }
    
    .btn {
        padding: 12px 25px;
        font-size: 1em;
    }

    /* تعديل الأعمدة للشاشات الصغيرة */
    .event-list {
        grid-template-columns: 1fr; /* عمود واحد في الشاشات الصغيرة جداً */
    }
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.action-buttons .btn {
    padding: 10px 20px;
    font-size: 0.95em;
}

/* Navigation */
.nav {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 30px;
    text-align: center;
}

.nav a {
    color: white;
    text-decoration: none;
    padding: 10px 20px;
    margin: 0 10px;
    border-radius: 8px;
    transition: all 0.3s ease;
    font-weight: 600;
}

.nav a:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 40px;
    border-radius: 15px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.3);
}

.close {
    color: #aaa;
    float: left;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close:hover {
    color: #000;
}

.event-details {
    display: flex;
    flex-wrap: wrap;
    gap: 40px; /* 🔹 المسافة الأفقية بين العناصر */
    align-items: center;
    margin-top: 10px;
}

.event-details .event-info {
    font-size: 1.1em;
    color: #1a3320;
    white-space: nowrap; /* يمنع الكسر للسطر الثاني */
}


