body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
    color: #212529;
    margin: 0;
    padding: 0;
    direction: rtl; /* Set the text direction to RTL */
}

.container {
    width: 85%;
    margin: auto;
    padding: 30px;
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    background: linear-gradient(135deg, #ffffff, #f1f1f1);
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e9ecef;
    direction: rtl; /* Ensure header elements are aligned RTL */
}

header h1 {
    margin: 0;
    font-size: 30px;
    color: #495057;
}

#articleForm,
#editArticleForm {
    margin-bottom: 30px;
    padding: 25px;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    background-color: #f8f9fa;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

#articleForm h2,
#editArticleForm h2 {
    margin-top: 0;
    font-size: 24px;
    color: #495057;
}

form label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #495057;
}

form input[type="text"],
form textarea,
form input[type="file"],
form select {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 16px;
    transition: border-color 0.3s, box-shadow 0.3s;
    direction: rtl; /* Ensure form elements align text RTL */
}

form input[type="text"]:focus,
form textarea:focus,
form input[type="file"]:focus,
form select:focus {
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(38, 143, 255, 0.25);
}

form button {
    padding: 12px 25px;
    border: none;
    border-radius: 6px;
    background-color: #28a745;
    color: #ffffff;
    font-size: 18px;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
}

form button:hover {
    background-color: #218838;
    transform: translateY(-2px);
}

.hidden {
    display: none;
}

#articlesContainer {
    display: flex;
    flex-wrap: wrap;
    gap: 20px; /* Adjusted gap for a better fit */
    justify-content: center;
}

.article-tile {
    border: 1px solid #e9ecef;
    padding: 15px; /* Reduced padding for smaller height */
    width: 250px;
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
    position: relative;
    transition: transform 0.3s, box-shadow 0.3s;
    height: auto; /* Allow height to adjust based on content */
    display: flex;
    flex-direction: column; /* Ensure description is shown */
    justify-content: space-between; /* Distribute space for title and description */
    direction: rtl; /* Align text RTL inside the article tile */
}

.article-tile:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.article-tile img {
    width: 100%;
    height: auto;
    border-radius: 8px;
}

.article-tile h3 {
    margin: 10px 0; /* Reduced margin for a more compact look */
    font-size: 18px;
    color: #343a40;
}

.article-tile p {
    font-size: 14px; /* Adjusted font size for a more compact description */
    color: #6c757d;
    margin: 0;
    flex-grow: 1; /* Allow description to grow and fill space */
}

.article-tile .edit,
.article-tile .delete {
    position: absolute;
    top: 10px;
    cursor: pointer;
    font-size: 18px; /* Adjusted font size */
    transition: color 0.3s, transform 0.2s;
}

.article-tile .edit {
    left: 15px; /* Adjusted for RTL layout */
    color: #007bff;
}

.article-tile .edit:hover {
    color: #0056b3;
    transform: scale(1.1);
}

.article-tile .delete {
    left: 50px; /* Adjusted for RTL layout */
    color: #dc3545;
}

.article-tile .delete:hover {
    color: #c82333;
    transform: scale(1.1);
}

.pagination {
    margin-top: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 18px;
}

.pagination button {
    padding: 12px 25px;
    border: none;
    border-radius: 6px;
    background-color: #007bff;
    color: #ffffff;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
}

.pagination button:hover {
    background-color: #0056b3;
    transform: translateY(-2px);
}

.pagination span {
    margin: 0 20px;
    font-size: 18px;
    color: #495057;
}

#createArticleButton {
    padding: 12px 25px;
    border: none;
    border-radius: 6px;
    background-color: #28a745;
    color: #ffffff; /* White text color */
    font-size: 18px; /* Font size */
    cursor: pointer; /* Pointer cursor on hover */
    transition: background-color 0.3s, transform 0.2s; /* Smooth transitions */
    direction: rtl; /* Ensure text alignment is RTL */
}

#createArticleButton:hover {
    background-color: #28a745;
    transform: translateY(-2px); /* Slight lift effect */
}

.toast-container {
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 9999;
}

.toast {
    background-color: #333;
    color: #fff;
    padding: 10px;
    margin-top: 5px;
    border-radius: 5px;
    position: relative;
    opacity: 0;
    transition: opacity 0.5s ease-out;
}

.toast.show {
    opacity: 1;
}

.toast.hide {
    opacity: 0;
}