/* General Styling */
:root {
    --primary-color: #5d0240; /* Deep Purple from Tay Law Logo */
    --secondary-color: #8c0364; /* Lighter Purple */
    --accent-color: #c0c0c0; /* Light Grey for accents */
    --text-color: #333;
    --light-bg: #f9f9f9;
    --dark-bg: #e9e9e9;
    --white: #fff;
    --whatsapp-green: #25D366;
    --whatsapp-dark-green: #1DA851;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Cairo', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    direction: rtl; /* Set text direction to Right-to-Left */
    text-align: right; /* Align text to the right for RTL */
    background-color: var(--white);
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 0;
}

h1, h2, h3 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-weight: 700;
}

h1 { font-size: 2.5em; } /* Larger for main title */
h2 { font-size: 2em; }
h3 { font-size: 1.5em; }


p {
    margin-bottom: 15px;
}

a {
    color: var(--secondary-color);
    text-decoration: none;
    transition: color 0.3s ease, text-decoration 0.3s ease;
}

a:hover {
    text-decoration: underline;
    color: var(--primary-color);
}

/* Accessible Focus States */
a:focus, .btn:focus, button:focus {
    outline: 3px solid var(--secondary-color);
    outline-offset: 2px;
}


.btn {
    display: inline-block;
    background: var(--primary-color);
    color: var(--white);
    padding: 12px 25px; /* Slightly larger padding */
    border-radius: 8px; /* More rounded corners */
    margin-top: 20px;
    transition: background 0.3s ease, transform 0.2s ease;
    font-size: 1.1em;
    font-weight: 700;
    text-align: center;
}

.btn:hover {
    background: var(--secondary-color);
    text-decoration: none;
    transform: translateY(-2px); /* Slight lift effect */
}

.whatsapp-btn {
    background: var(--whatsapp-green);
}

.whatsapp-btn:hover {
    background: var(--whatsapp-dark-green);
}

.whatsapp-btn i {
    margin-left: 8px; /* Space between icon and text */
}

/* Header Styling */
header {
    background: var(--white);
    color: var(--text-color);
    padding: 10px 0;
    border-bottom: 1px solid var(--accent-color);
    box-shadow: 0 2px 10px rgba(0,0,0,0.05); /* Stronger shadow */
    position: sticky; /* Make header sticky */
    top: 0;
    z-index: 1000; /* Ensure it stays on top */
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.logo-name {
    display: flex;
    align-items: center;
    flex-grow: 1; /* Allow it to grow */
}

.logo {
    height: 70px; /* Slightly larger logo */
    margin-left: 15px;
}

header h1 {
    margin: 0;
    font-size: 28px; /* Slightly larger heading */
    color: var(--primary-color);
}

header nav ul {
    list-style: none;
    display: flex;
    margin: 0; /* Remove default margin */
}

header nav ul li {
    margin-right: 25px; /* More spacing */
}

header nav ul li a {
    color: var(--primary-color);
    font-weight: 700;
    padding: 5px 0; /* Add padding for better click area */
    display: block; /* Make link fill padding */
    position: relative; /* For underline effect */
}

header nav ul li a::after {
    content: '';
    position: absolute;
    bottom: -3px;
    right: 0;
    width: 0;
    height: 3px;
    background-color: var(--secondary-color);
    transition: width 0.3s ease;
}

header nav ul li a:hover::after,
header nav ul li a:focus::after {
    width: 100%;
    left: 0; /* Ensure full width on hover/focus */
}


/* Hero Section */
#hero {
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.8)), url('Logo.jpeg') no-repeat center center/cover;
    background-blend-mode: lighten; /* Blend the background for subtlety */
    text-align: center;
    padding: 120px 0; /* More padding */
    color: var(--primary-color);
    position: relative;
    overflow: hidden; /* Hide overflow from any subtle animations */
}

#hero h2 {
    font-size: 3.5em; /* Larger, more impactful heading */
    margin-bottom: 20px;
    color: var(--primary-color);
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

#hero p {
    font-size: 1.3em; /* Larger paragraph */
    color: var(--text-color);
    max-width: 800px;
    margin: 0 auto 30px auto;
}

/* Sections Styling */
section {
    padding: 80px 0; /* More vertical padding for sections */
    scroll-margin-top: 80px; /* هامش عند التنقل للسكشن عبر الروابط */
}

section.alt-bg {
    background: var(--light-bg);
}

/* About Section */
#about .description {
    font-size: 1.15em; /* Slightly larger */
    line-height: 1.8;
}

#about .details {
    background: var(--dark-bg);
    padding: 30px; /* More padding */
    border-radius: 12px; /* More rounded */
    margin-top: 40px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08); /* More prominent shadow */
}

#about .details p {
    margin-bottom: 12px;
    font-size: 1.05em;
    display: flex;
    align-items: center;
}

#about .details p i {
    margin-left: 10px;
    color: var(--secondary-color);
    font-size: 1.2em;
}

/* Services Section */
.service-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); /* Slightly smaller min-width for flexibility */
    gap: 35px; /* More gap */
}

.service-item {
    background: var(--white);
    padding: 35px; /* More padding */
    border-radius: 12px; /* More rounded */
    box-shadow: 0 5px 20px rgba(0,0,0,0.08); /* Stronger shadow */
    text-align: right;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid var(--accent-color); /* Subtle border */
}

.service-item:hover {
    transform: translateY(-8px); /* More pronounced lift */
    box-shadow: 0 8px 25px rgba(0,0,0,0.15); /* Stronger shadow on hover */
}

.service-item h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 1.6em;
}

.service-item p {
    font-size: 1.05em;
}

.service-icon {
    font-size: 3.5em; /* Larger icon */
    color: var(--secondary-color);
    margin-bottom: 20px;
    display: block;
}

/* Contact Section */
.contact-info p {
    font-size: 1.1em;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
}

.contact-info p i {
    margin-left: 10px;
    color: var(--secondary-color);
    font-size: 1.2em;
}

/* Hours Table */
.table-responsive {
    overflow-x: auto; /* Makes table scrollable on small screens */
}

.hours-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 30px;
    background: var(--white);
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    border-radius: 12px;
    overflow: hidden;
    font-size: 1.05em;
}

.hours-table th,
.hours-table td {
    border: 1px solid var(--accent-color);
    padding: 15px 20px; /* More padding */
    text-align: center;
}

.hours-table th {
    background-color: var(--primary-color);
    color: var(--white);
    font-weight: 700;
    white-space: nowrap; /* Prevent wrapping in headers */
}

.hours-table tr:nth-child(even) {
    background-color: var(--dark-bg);
}

.hours-table td:first-child {
    font-weight: 700;
    color: var(--primary-color);
}

/* Google Map Section */
#location {
    padding: 80px 0;
    text-align: center;
}

#map {
    height: 450px; /* Fixed height for the map */
    width: 100%;
    border-radius: 12px;
    margin: 40px auto;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    border: 1px solid var(--accent-color);
}

.map-directions-btn {
    background: #4285F4; /* Google Blue */
}

.map-directions-btn:hover {
    background: #3367D6;
}

.map-directions-btn i {
    margin-left: 8px;
}


/* Footer Styling */
footer {
    background: var(--primary-color);
    color: var(--white);
    padding: 40px 0; /* More padding */
    text-align: center;
}

footer .container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

footer p {
    margin: 0;
    font-size: 0.95em;
}

.designed-by {
    margin-top: 25px;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 0.9em;
}

.designed-by p {
    margin: 0 0 10px 0;
    font-size: 1em;
}

.sbay-logo {
    height: 45px; /* Slightly larger */
    filter: brightness(0) invert(1); /* Make the logo white for dark background */
    transition: transform 0.3s ease;
}

.sbay-logo:hover {
    transform: scale(1.05); /* Slight zoom on hover */
}


/* Articles Specific Styling */
.section-header {
    text-align: center;
    margin-bottom: 50px;
}

.section-header p {
    font-size: 1.1em;
    color: var(--text-color);
    max-width: 700px;
    margin: 0 auto;
}

.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 30px;
}

.article-card {
    background: var(--white);
    border: 1px solid var(--accent-color);
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    text-align: right; /* For RTL */
    position: relative; /* For the "Read More" link placement */
}

.article-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.article-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

.article-content {
    padding: 25px;
    flex-grow: 1; /* Allow content to grow and push footer down */
    display: flex;
    flex-direction: column;
}

.article-content h3 {
    font-size: 1.5em;
    color: var(--primary-color);
    margin-bottom: 10px;
    line-height: 1.4;
}

.article-content p {
    font-size: 0.95em;
    color: #666;
    margin-bottom: 15px;
    flex-grow: 1; /* Allow paragraph to grow */
}

.article-meta {
    font-size: 0.85em;
    color: #999;
    border-top: 1px solid var(--dark-bg);
    padding-top: 15px;
    margin-top: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.article-meta span {
    display: flex;
    align-items: center;
}

.article-meta i {
    margin-left: 5px; /* Space for RTL */
    color: var(--secondary-color);
}

.read-more-btn {
    display: inline-block;
    background: var(--secondary-color);
    color: var(--white);
    padding: 8px 15px;
    border-radius: 5px;
    font-size: 0.9em;
    margin-top: 15px;
    align-self: flex-start; /* Align to right in RTL */
}

.read-more-btn:hover {
    background: var(--primary-color);
    text-decoration: none;
}

/* For individual article page (article-detail.html) */
.article-detail-header {
    background: var(--primary-color);
    color: var(--white);
    padding: 60px 0 40px;
    text-align: center;
    margin-bottom: 40px;
}

.article-detail-header h1 {
    color: var(--white);
    font-size: 3em;
    margin-bottom: 15px;
}

.article-detail-meta {
    font-size: 1.1em;
    color: rgba(255, 255, 255, 0.8);
}

.article-detail-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px 80px;
    font-size: 1.1em;
    line-height: 1.8;
}

.article-detail-content h2, .article-detail-content h3 {
    color: var(--primary-color);
    margin-top: 30px;
    margin-bottom: 15px;
}

.article-detail-content p {
    margin-bottom: 20px;
}

.article-detail-content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 20px auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.loading-message {
    text-align: center;
    font-size: 1.2em;
    color: var(--secondary-color);
    padding: 50px 0;
    grid-column: 1 / -1; /* Center across all columns in grid */
}

/* Active class styling for navigation links */
header nav ul li a.active {
    color: var(--secondary-color); /* Highlight active link */
    position: relative;
}

header nav ul li a.active::after {
    content: '';
    position: absolute;
    bottom: -3px;
    right: 0;
    width: 100%; /* Make it full width for active link */
    height: 3px;
    background-color: var(--secondary-color);
}

/* Editor specific styles */
#editor-page-content { /* Changed ID here */
    padding: 50px 0;
    background: var(--light-bg);
}
.editor-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 30px;
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}
.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
}
.editor-header h2 {
    margin-bottom: 0;
}
.editor-controls {
    display: flex;
    gap: 15px;
    margin-top: 10px;
}
.editor-controls .btn {
    margin-top: 0;
    padding: 10px 20px;
    font-size: 1em;
}
.editor-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 700;
    color: var(--primary-color);
}
.editor-form input[type="text"],
.editor-form input[type="url"],
.editor-form textarea {
    width: 100%;
    padding: 12px;
    margin-bottom: 20px;
    border: 1px solid var(--accent-color);
    border-radius: 8px;
    font-family: 'Cairo', sans-serif;
    font-size: 1em;
    direction: rtl;
    text-align: right;
}
.editor-form textarea {
    min-height: 150px;
    resize: vertical;
}
.editor-form button {
    background: var(--primary-color);
    color: var(--white);
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    font-size: 1.1em;
    cursor: pointer;
    transition: background 0.3s ease;
    margin-left: 15px; /* Space for buttons */
}
.editor-form button:hover {
    background: var(--secondary-color);
}
.editor-form button.cancel-btn {
    background: #ccc;
    color: var(--text-color);
}
.editor-form button.cancel-btn:hover {
    background: #bbb;
}
.article-list {
    margin-top: 40px;
    border-top: 1px solid var(--accent-color);
    padding-top: 30px;
}
.article-item {
    background: var(--dark-bg);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    flex-wrap: wrap; /* Allow wrapping on small screens */
}
.article-item-details {
    flex-grow: 1;
    margin-left: 20px; /* Space for buttons */
}
.article-item-details h3 {
    margin-top: 0;
    margin-bottom: 5px;
    font-size: 1.3em;
}
.article-item-details p {
    margin-bottom: 5px;
    font-size: 0.9em;
    color: #555;
}
.article-item-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px; /* For mobile layout */
}
.article-item-actions .btn {
    margin-top: 0;
    padding: 8px 15px;
    font-size: 0.9em;
    border-radius: 5px;
}
.article-item-actions .edit-btn { background: #007bff; }
.article-item-actions .edit-btn:hover { background: #0056b3; }
.article-item-actions .delete-btn { background: #dc3545; }
.article-item-actions .delete-btn:hover { background: #c82333; }

.auth-message {
    text-align: center;
    font-size: 1.2em;
    margin-bottom: 20px;
    color: var(--primary-color);
}
.auth-message.error {
    color: #dc3545;
}
.auth-message.success {
    color: #28a745;
}
#logged-out-view, #logged-in-view { /* Added these for control */
    min-height: 200px; /* To prevent layout shift */
    display: flex; /* Flexbox for centering content */
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.user-info {
    text-align: center;
    margin-bottom: 20px;
    font-size: 1.1em;
    color: var(--primary-color);
}

/* Accessibility improvements for forms */
input[type="text"]:focus,
input[type="url"]:focus,
textarea:focus {
    outline: 2px solid var(--secondary-color);
    outline-offset: 2px;
}


/* Responsive Design */
@media (max-width: 992px) {
    section {
        scroll-margin-top: 240px;
    }
    header .container {
        flex-direction: column;
        text-align: center;
    }

    .logo-name {
        flex-direction: column;
        margin-bottom: 15px;
    }

    .logo {
        margin: 0 auto 10px auto;
    }

    header h1 {
        font-size: 24px;
    }

    header nav ul {
        margin-top: 15px;
        flex-wrap: wrap;
        justify-content: center;
        width: 100%;
    }

    header nav ul li {
        margin: 0 15px 10px 15px; /* Adjust spacing for wrap */
    }

    #hero h2 {
        font-size: 2.8em;
    }

    section {
        padding: 60px 0;
    }
}

@media (max-width: 768px) {
    section {
        scroll-margin-top: 240px;
    }
    #hero h2 {
        font-size: 2.2em;
    }

    #hero p {
        font-size: 1.1em;
    }

    .btn {
        padding: 10px 20px;
        font-size: 1em;
    }

    .service-grid, .features-grid { /* Removed .features-grid as section is removed */
        grid-template-columns: 1fr;
    }

    .service-item, .feature-item { /* Removed .feature-item */
        padding: 25px;
    }

    .hours-table th, .hours-table td {
        font-size: 0.9em;
        padding: 10px 12px;
    }

    #map {
        height: 350px;
    }

    /* Articles Specific */
    .articles-grid {
        grid-template-columns: 1fr;
    }
    .article-card {
        padding-bottom: 80px; /* Make space for position absolute read more */
    }
    .read-more-btn {
        position: absolute;
        bottom: 20px;
        right: 25px;
    }
    .article-item {
        flex-direction: column;
        align-items: flex-end;
    }
    .article-item-details {
        margin-left: 0;
        width: 100%;
        margin-bottom: 10px;
    }
    .article-item-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

@media (max-width: 480px) {
    section {
        scroll-margin-top: 240px;
    }
    header h1 {
        font-size: 20px;
    }

    .logo {
        height: 50px;
    }

    #hero h2 {
        font-size: 1.8em;
    }

    #hero p {
        font-size: 1em;
    }

    section {
        padding: 40px 0;
    }

    h1 { font-size: 2em; }
    h2 { font-size: 1.8em; }
    h3 { font-size: 1.3em; }

    .hours-table th, .hours-table td {
        font-size: 0.8em;
        padding: 8px 10px;
    }

    .sbay-logo {
        height: 35px;
    }

    .contact-info p, #about .details p {
        font-size: 0.95em;
        flex-direction: column; /* Stack icon and text */
        align-items: flex-end;
        text-align: right;
    }
    .contact-info p i, #about .details p i {
        margin-bottom: 5px;
        margin-left: 0;
    }
}
/* ===== Service Request Form ===== */
.form-section {
    direction: rtl;
}

    .form-section .container {
        max-width: 900px;
    }

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-field {
    display: flex;
    flex-direction: column;
}

.form-field--full {
    grid-column: 1 / -1;
}

.form-field label {
    font-weight: 600;
    margin-bottom: 6px;
}

.form-field input,
.form-field select,
.form-field textarea {
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 10px;
    font-size: 1rem;
}

.form-field .hint {
    color: #777;
    font-size: 0.85rem;
    margin-top: 4px;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.form-status {
    margin: 0;
    font-weight: 600;
}

.btn.btn-primary {
    cursor: pointer;
    border: none;
    border-radius: 999px;
    padding: 10px 18px;
    font-size: 1rem;
    /* ملاحظة: إن كان لديك ألوان هوية في الملف فستتطبق تلقائيًا عبر الفئات العامة */
}

@media (max-width: 640px) {
    section {
        scroll-margin-top: 240px;
    }
    .form-grid {
        grid-template-columns: 1fr;
    }
}
