/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Cairo', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
    direction: rtl;
    transition: all 0.3s ease;
}

/* LTR Support for English */
body.ltr {
    direction: ltr;
    font-family: 'Inter', 'Segoe UI', 'Roboto', sans-serif;
}

body.ltr .container {
    text-align: left;
}

body.ltr .nav-wrapper {
    flex-direction: row-reverse;
}

body.ltr .header-controls {
    flex-direction: row-reverse;
}

body.ltr .nav {
    right: auto;
    left: 0;
}

body.ltr .alert-content {
    flex-direction: row-reverse;
}

body.ltr .alert-close {
    right: 20px;
    left: auto;
}

body.ltr .footer-content {
    text-align: left;
}

body.ltr .social-links {
    justify-content: flex-start;
}

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

/* Header Styles */
.header {
    background: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
    position: relative;
}

.logo h1 {
    font-size: 1.5rem;
    color: #007bff;
    font-weight: 700;
    margin: 0;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    padding: 15px;
    min-width: 250px;
    max-height: 70vh;
    overflow-y: auto;
    z-index: 9999;
}

.nav.show {
    display: block;
}

.nav-section h3 {
    color: #495057;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nav-section ul {
    list-style: none;
}

.nav-section li {
    margin-bottom: 0.2rem;
}

.nav-section a {
    text-decoration: none;
    color: #6c757d;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-size: 0.85rem;
}

.nav-section a:hover {
    background: #007bff;
    color: white;
}

.nav-section i {
    font-size: 0.75rem;
    width: 14px;
}

.lang-btn, .menu-btn {
    background: #007bff;
    border: none;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.85rem;
    font-family: inherit;
}

.lang-btn:hover, .menu-btn:hover {
    background: #0056b3;
    transform: translateY(-1px);
}

.menu-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* Alert Banner */
.alert-banner {
    background: #007bff;
    color: white;
    padding: 0.8rem 0;
    position: relative;
    font-size: 0.9rem;
}

.alert-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.alert-close {
    position: absolute;
    left: 20px;
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.8rem;
}

.alert-close:hover {
    background: rgba(255,255,255,0.3);
}

/* Main Content */
.main {
    padding: 2rem 0;
}

/* Tools Section */
.tools-section {
    background: white;
    border-radius: 8px;
    margin-bottom: 2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    overflow: hidden;
}

.section-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e9ecef;
}

.section-header h2 {
    font-size: 1.5rem;
    color: #212529;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.section-header p {
    color: #6c757d;
    font-size: 0.95rem;
    margin: 0;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0;
    padding: 1.5rem;
}

.tool-card {
    background: transparent;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 1.2rem;
    text-align: center;
    text-decoration: none;
    color: #495057;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 120px;
    margin: 0.3rem;
    position: relative;
}

.tool-card:hover {
    border-color: #007bff;
    color: #007bff;
    transform: translateY(-3px);
    box-shadow: 0 4px 15px rgba(0,123,255,0.2);
    background: rgba(0,123,255,0.02);
}

.tool-card.coming-soon {
    opacity: 0.6;
    cursor: not-allowed;
}

.tool-card.coming-soon:hover {
    transform: none;
    box-shadow: none;
    border-color: #e9ecef;
    color: #495057;
    background: transparent;
}

.tool-card i {
    font-size: 2rem;
    margin-bottom: 0.8rem;
}

.tool-card span {
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.4;
    text-align: center;
}

.coming-soon-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #ffc107;
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 10px;
    font-size: 0.6rem;
    font-weight: 600;
}

/* LTR adjustments for coming-soon badge */
body.ltr .coming-soon-badge {
    right: auto;
    left: 8px;
}

/* Footer */
.footer {
    background: #343a40;
    color: white;
    padding: 2rem 0 1rem;
    margin-top: 3rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    margin-bottom: 1.5rem;
}

.footer-section h3 {
    margin-bottom: 1rem;
    color: white;
    font-size: 1rem;
    font-weight: 600;
}

.footer-section p {
    color: #adb5bd;
    font-size: 0.9rem;
    line-height: 1.6;
}

.social-links {
    display: flex;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.social-links a {
    display: inline-block;
    width: 36px;
    height: 36px;
    background: #495057;
    border-radius: 6px;
    text-align: center;
    line-height: 36px;
    color: white;
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.social-links a:hover {
    background: #007bff;
    transform: translateY(-2px);
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 0.4rem;
}

.footer-section ul a {
    color: #adb5bd;
    text-decoration: none;
    font-size: 0.85rem;
    transition: color 0.2s ease;
}

.footer-section ul a:hover {
    color: white;
}

.cta-link {
    color: #007bff;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
}

.cta-link:hover {
    color: #0056b3;
    text-decoration: underline;
}

.footer-bottom {
    text-align: center;
    padding-top: 1.5rem;
    border-top: 1px solid #495057;
    color: #adb5bd;
    font-size: 0.85rem;
}

/* Language Transition Effects */
.lang-transition {
    transition: all 0.3s ease;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 10px;
    }

    .nav-wrapper {
        flex-wrap: wrap;
    }

    .header-controls {
        gap: 0.5rem;
    }

    .tools-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 0;
        padding: 1rem;
    }

    .tool-card {
        min-height: 100px;
        padding: 1rem;
        margin: 0.2rem;
    }

    .tool-card i {
        font-size: 1.5rem;
        margin-bottom: 0.5rem;
    }

    .tool-card span {
        font-size: 0.8rem;
    }

    .section-header {
        padding: 1rem;
    }

    .section-header h2 {
        font-size: 1.3rem;
    }

    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 1.5rem;
    }

    body.ltr .footer-content {
        text-align: center;
    }

    .social-links {
        justify-content: center;
    }

    body.ltr .social-links {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .logo h1 {
        font-size: 1.2rem;
    }

    .tools-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        padding: 0.8rem;
    }

    .tool-card {
        min-height: 90px;
        padding: 0.8rem;
        margin: 0.15rem;
    }

    .tool-card i {
        font-size: 1.3rem;
        margin-bottom: 0.4rem;
    }

    .tool-card span {
        font-size: 0.75rem;
        line-height: 1.2;
    }

    .section-header {
        padding: 0.8rem;
    }

    .section-header h2 {
        font-size: 1.1rem;
    }

    .section-header p {
        font-size: 0.85rem;
    }

    .alert-content {
        font-size: 0.8rem;
        padding: 0 2rem;
        text-align: center;
    }

    .alert-content span {
        display: block;
        margin-top: 0.2rem;
    }
}

/* Additional Utility Classes */
.text-center { text-align: center; }
.d-none { display: none; }
.d-block { display: block; }

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Notification Styles - Enhanced for Translation */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    padding: 1rem 1.5rem;
    border-radius: 6px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    z-index: 10001;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: slideInRight 0.3s ease;
    border: 1px solid #dee2e6;
    font-size: 0.85rem;
    min-width: 250px;
    max-width: 400px;
    font-family: inherit;
    transition: all 0.3s ease;
}

/* LTR notification positioning */
body.ltr .notification {
    right: auto;
    left: 20px;
    animation: slideInLeft 0.3s ease;
}

.notification.error {
    border-left: 4px solid #dc3545;
    color: #dc3545;
}

.notification.success {
    border-left: 4px solid #28a745;
    color: #28a745;
}

.notification.warning {
    border-left: 4px solid #ffc107;
    color: #856404;
}

.notification.info {
    border-left: 4px solid #007bff;
    color: #007bff;
}

/* LTR notification border */
body.ltr .notification.error {
    border-left: none;
    border-right: 4px solid #dc3545;
}

body.ltr .notification.success {
    border-left: none;
    border-right: 4px solid #28a745;
}

body.ltr .notification.warning {
    border-left: none;
    border-right: 4px solid #ffc107;
}

body.ltr .notification.info {
    border-left: none;
    border-right: 4px solid #007bff;
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOutRight {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

@keyframes slideInLeft {
    from { transform: translateX(-100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOutLeft {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(-100%); opacity: 0; }
}

/* Language Toggle Animation */
.lang-toggle {
    position: relative;
    overflow: hidden;
}

.lang-btn {
    position: relative;
    overflow: hidden;
}

.lang-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;
}

.lang-btn:hover::before {
    left: 100%;
}

/* Smooth transitions for all translatable elements */
[data-translate] {
    transition: opacity 0.2s ease;
}

/* Print styles */
@media print {
    .header, .alert-banner, .footer {
        display: none;
    }

    .main {
        padding: 0;
    }

    .tools-section {
        break-inside: avoid;
        margin-bottom: 1rem;
    }

    .tool-card {
        break-inside: avoid;
    }
}