/**
 * MuscatHeights Booking System - Internationalization Styles
 *
 * Comprehensive styling for multi-language support including
 * RTL layout, Arabic typography, and language-specific adaptations.
 *
 * @package MuscatHeights_Booking_System
 * @since 1.0.0
 */

/* ==========================================================================
   Base Internationalization Styles
   ========================================================================== */

/* Language-specific font families */
.lang-en {
    font-family: 'Roboto', 'Helvetica Neue', Arial, sans-serif;
}

.lang-ar {
    font-family: 'Cairo', 'Tajawal', 'Amiri', 'Noto Sans Arabic', Arial, sans-serif;
    line-height: 1.8;
    letter-spacing: 0.02em;
}

/* Text direction utilities */
.ltr {
    direction: ltr;
    text-align: left;
}

.rtl {
    direction: rtl;
    text-align: right;
}

/* Force text direction */
.force-ltr {
    direction: ltr !important;
    text-align: left !important;
}

.force-rtl {
    direction: rtl !important;
    text-align: right !important;
}

/* ==========================================================================
   Language Switcher
   ========================================================================== */

.muscatheights-language-switcher {
    position: relative;
    display: inline-block;
    z-index: 1000;
}

/* Dropdown Style */
.muscatheights-language-switcher.dropdown {
    min-width: 150px;
}

.language-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #ffffff;
    border: 2px solid #e1e5e9;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    color: #495057;
    font-weight: 500;
}

.language-toggle:hover {
    border-color: #007bff;
    background: #f8f9fa;
    text-decoration: none;
    color: #007bff;
}

.language-toggle .flag {
    font-size: 1.2em;
}

.language-toggle .name {
    flex: 1;
    text-align: left;
}

.rtl .language-toggle .name {
    text-align: right;
}

.language-toggle .arrow {
    font-size: 0.8em;
    transition: transform 0.2s ease;
}

.muscatheights-language-switcher.open .language-toggle .arrow {
    transform: rotate(180deg);
}

.language-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #ffffff;
    border: 2px solid #e1e5e9;
    border-top: none;
    border-radius: 0 0 6px 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    list-style: none;
    margin: 0;
    padding: 0;
}

.language-options.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.rtl .language-options {
    left: auto;
    right: 0;
}

.language-option {
    border-bottom: 1px solid #f0f0f0;
}

.language-option:last-child {
    border-bottom: none;
}

.language-option a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    color: #495057;
    text-decoration: none;
    transition: all 0.2s ease;
}

.language-option a:hover {
    background: #f8f9fa;
    color: #007bff;
    text-decoration: none;
}

.language-option.active a {
    background: #007bff;
    color: #ffffff;
}

.language-option .flag {
    font-size: 1.1em;
}

.language-option .name {
    flex: 1;
    font-weight: 500;
}

/* Button Style */
.muscatheights-language-switcher.buttons {
    display: flex;
    gap: 5px;
    background: #f8f9fa;
    padding: 4px;
    border-radius: 8px;
    border: 1px solid #e1e5e9;
}

.language-button {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    background: transparent;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #6c757d;
    font-size: 0.9em;
    font-weight: 500;
}

.language-button:hover {
    background: #e9ecef;
    color: #495057;
}

.language-button.active {
    background: #007bff;
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.3);
}

.language-button .flag {
    font-size: 1em;
}

.language-button .code {
    font-size: 0.85em;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* ==========================================================================
   RTL Layout Adaptations
   ========================================================================== */

/* Base RTL adjustments */
.rtl {
    text-align: right;
}

.rtl * {
    text-align: inherit;
}

/* Form elements RTL */
.rtl input[type="text"],
.rtl input[type="email"],
.rtl input[type="password"],
.rtl input[type="tel"],
.rtl input[type="url"],
.rtl input[type="search"],
.rtl textarea,
.rtl select {
    text-align: right;
    direction: rtl;
}

.rtl input[type="number"],
.rtl input[type="date"],
.rtl input[type="time"],
.rtl input[type="datetime-local"] {
    text-align: left;
    direction: ltr;
}

/* Button and link alignment */
.rtl .btn-group {
    direction: ltr;
}

.rtl .btn-group .btn:first-child {
    border-radius: 0.375rem 0 0 0.375rem;
}

.rtl .btn-group .btn:last-child {
    border-radius: 0 0.375rem 0.375rem 0;
}

/* Navigation RTL */
.rtl .navbar-nav {
    flex-direction: row-reverse;
}

.rtl .nav-tabs {
    border-bottom: 1px solid #dee2e6;
}

.rtl .nav-tabs .nav-link {
    border: 1px solid transparent;
    border-radius: 0.375rem 0.375rem 0 0;
    margin-left: 0;
    margin-right: -1px;
}

.rtl .nav-tabs .nav-link:hover {
    border-color: #e9ecef #e9ecef #dee2e6;
}

.rtl .nav-tabs .nav-link.active {
    border-color: #dee2e6 #dee2e6 #fff;
}

/* Breadcrumb RTL */
.rtl .breadcrumb {
    flex-direction: row-reverse;
}

.rtl .breadcrumb-item + .breadcrumb-item::before {
    content: "\\\\" !important;
    padding-right: 0.5rem;
    padding-left: 0;
}

/* Card and panel RTL */
.rtl .card-header {
    text-align: right;
}

.rtl .card-body {
    text-align: right;
}

/* List group RTL */
.rtl .list-group-item {
    text-align: right;
}

.rtl .list-group-item-action {
    text-align: right;
}

/* Table RTL */
.rtl table {
    direction: rtl;
}

.rtl th,
.rtl td {
    text-align: right;
}

.rtl th:first-child,
.rtl td:first-child {
    border-right: 0;
}

.rtl th:last-child,
.rtl td:last-child {
    border-left: 0;
}

/* Modal RTL */
.rtl .modal-header {
    text-align: right;
}

.rtl .modal-body {
    text-align: right;
}

.rtl .modal-footer {
    justify-content: flex-start;
}

.rtl .modal-footer .btn + .btn {
    margin-left: 0;
    margin-right: 0.25rem;
}

/* Dropdown RTL */
.rtl .dropdown-menu {
    right: 0;
    left: auto;
    text-align: right;
}

.rtl .dropdown-item {
    text-align: right;
}

/* Pagination RTL */
.rtl .pagination {
    flex-direction: row-reverse;
}

.rtl .page-link {
    margin-right: -1px;
    margin-left: 0;
}

.rtl .page-item:first-child .page-link {
    border-radius: 0 0.375rem 0.375rem 0;
}

.rtl .page-item:last-child .page-link {
    border-radius: 0.375rem 0 0 0.375rem;
}

/* Alert RTL */
.rtl .alert {
    text-align: right;
}

.rtl .alert-dismissible .btn-close {
    right: auto;
    left: 0;
}

/* ==========================================================================
   Arabic Typography Enhancements
   ========================================================================== */

.lang-ar {
    font-size: 1.05em;
    line-height: 1.8;
}

.lang-ar h1,
.lang-ar h2,
.lang-ar h3,
.lang-ar h4,
.lang-ar h5,
.lang-ar h6 {
    font-weight: 600;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.lang-ar h1 { font-size: 2.2rem; }
.lang-ar h2 { font-size: 1.9rem; }
.lang-ar h3 { font-size: 1.6rem; }
.lang-ar h4 { font-size: 1.4rem; }
.lang-ar h5 { font-size: 1.2rem; }
.lang-ar h6 { font-size: 1.1rem; }

.lang-ar p {
    margin-bottom: 1.2rem;
    line-height: 1.8;
}

.lang-ar .lead {
    font-size: 1.15rem;
    font-weight: 400;
    line-height: 1.7;
}

/* Arabic number styling */
.lang-ar .arabic-numerals {
    font-family: 'Amiri', 'Traditional Arabic', serif;
    font-size: 1.1em;
}

/* Arabic quotes */
.lang-ar blockquote {
    border-right: 4px solid #007bff;
    border-left: none;
    padding-right: 1rem;
    padding-left: 0;
    margin-right: 0;
    margin-left: 1rem;
}

.lang-ar blockquote::before {
    content: "«";
    font-size: 2em;
    color: #007bff;
    float: right;
    margin-left: 0.5rem;
}

.lang-ar blockquote::after {
    content: "»";
    font-size: 2em;
    color: #007bff;
    float: left;
    margin-right: 0.5rem;
}

/* ==========================================================================
   Form Adaptations for Arabic
   ========================================================================== */

.lang-ar .form-label {
    font-weight: 600;
    margin-bottom: 0.7rem;
}

.lang-ar .form-control {
    font-size: 1rem;
    padding: 0.6rem 1rem;
    line-height: 1.6;
}

.lang-ar .form-control::placeholder {
    color: #6c757d;
    opacity: 0.8;
}

.lang-ar .form-select {
    padding: 0.6rem 1rem;
    background-position: left 0.75rem center;
}

.rtl .form-select {
    background-position: right 0.75rem center;
    padding-left: 2.25rem;
    padding-right: 0.75rem;
}

.lang-ar .input-group-text {
    font-weight: 500;
}

.rtl .input-group-text {
    border-right: 1px solid #ced4da;
    border-left: 0;
}

.rtl .input-group:not(.has-validation) > :not(:last-child):not(.dropdown-toggle):not(.dropdown-menu) {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    border-top-right-radius: 0.375rem;
    border-bottom-right-radius: 0.375rem;
}

.rtl .input-group > :not(:first-child):not(.dropdown-menu):not(.valid-tooltip):not(.valid-feedback):not(.invalid-tooltip):not(.invalid-feedback) {
    margin-right: -1px;
    margin-left: 0;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-top-left-radius: 0.375rem;
    border-bottom-left-radius: 0.375rem;
}

/* ==========================================================================
   Date Picker RTL Support
   ========================================================================== */

.rtl .datepicker {
    direction: rtl;
}

.rtl .datepicker table {
    direction: rtl;
}

.rtl .datepicker-dropdown {
    right: 0;
    left: auto;
}

.rtl .datepicker-dropdown.datepicker-orient-left:before {
    right: 6px;
    left: auto;
}

.rtl .datepicker-dropdown.datepicker-orient-left:after {
    right: 7px;
    left: auto;
}

.rtl .datepicker-dropdown.datepicker-orient-right:before {
    right: auto;
    left: 6px;
}

.rtl .datepicker-dropdown.datepicker-orient-right:after {
    right: auto;
    left: 7px;
}

/* ==========================================================================
   Data Tables RTL Support
   ========================================================================== */

.rtl .dataTables_wrapper {
    direction: rtl;
}

.rtl .dataTables_filter {
    text-align: left;
}

.rtl .dataTables_filter input {
    margin-right: 0.5em;
    margin-left: 0;
}

.rtl .dataTables_length {
    text-align: right;
}

.rtl .dataTables_length select {
    margin-right: 0.5em;
    margin-left: 0;
}

.rtl .dataTables_info {
    text-align: right;
}

.rtl .dataTables_paginate {
    text-align: left;
}

.rtl .dataTables_paginate .paginate_button {
    margin-right: 2px;
    margin-left: 0;
}

/* ==========================================================================
   Carousel RTL Support
   ========================================================================== */

.rtl .carousel-control-prev {
    right: 0;
    left: auto;
}

.rtl .carousel-control-next {
    right: auto;
    left: 0;
}

.rtl .carousel-control-prev-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23fff'%3e%3cpath d='m11.354 1.646a.5.5 0 0 1 0 .708L5.707 8l5.647 5.646a.5.5 0 0 1-.708.708l-6-6a.5.5 0 0 1 0-.708l6-6a.5.5 0 0 1 .708 0z'/%3e%3c/svg%3e");
}

.rtl .carousel-control-next-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23fff'%3e%3cpath d='m4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e");
}

/* ==========================================================================
   Loading and Notification Styles
   ========================================================================== */

.i18n-loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.i18n-loading .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.i18n-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 6px;
    color: #ffffff;
    font-weight: 500;
    z-index: 9999;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    max-width: 300px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.rtl .i18n-notification {
    right: auto;
    left: 20px;
    transform: translateX(-100%);
}

.i18n-notification.show {
    transform: translateX(0);
}

.i18n-notification.success {
    background: #28a745;
}

.i18n-notification.error {
    background: #dc3545;
}

.i18n-notification.warning {
    background: #ffc107;
    color: #212529;
}

.i18n-notification.info {
    background: #17a2b8;
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */

@media (max-width: 768px) {
    .muscatheights-language-switcher {
        width: 100%;
    }
    
    .language-toggle {
        justify-content: center;
    }
    
    .language-options {
        left: 0;
        right: 0;
    }
    
    .lang-ar {
        font-size: 1rem;
        line-height: 1.7;
    }
    
    .lang-ar h1 { font-size: 1.8rem; }
    .lang-ar h2 { font-size: 1.6rem; }
    .lang-ar h3 { font-size: 1.4rem; }
    .lang-ar h4 { font-size: 1.2rem; }
    .lang-ar h5 { font-size: 1.1rem; }
    .lang-ar h6 { font-size: 1rem; }
}

@media (max-width: 480px) {
    .muscatheights-language-switcher.buttons {
        flex-direction: column;
        gap: 2px;
    }
    
    .language-button {
        justify-content: center;
        padding: 8px 12px;
    }
    
    .i18n-notification {
        left: 10px;
        right: 10px;
        max-width: none;
        transform: translateY(-100%);
    }
    
    .i18n-notification.show {
        transform: translateY(0);
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .muscatheights-language-switcher,
    .i18n-loading,
    .i18n-notification {
        display: none !important;
    }
    
    .rtl {
        direction: rtl;
    }
    
    .lang-ar {
        font-family: 'Traditional Arabic', serif;
        font-size: 12pt;
        line-height: 1.6;
    }
}

/* ==========================================================================
   Accessibility Enhancements
   ========================================================================== */

.language-toggle:focus,
.language-button:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

.language-option a:focus {
    background: #e7f3ff;
    outline: 2px solid #007bff;
    outline-offset: -2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .language-toggle {
        border-width: 3px;
    }
    
    .language-options {
        border-width: 3px;
    }
    
    .language-option {
        border-bottom-width: 2px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .language-toggle .arrow,
    .language-options,
    .i18n-loading .spinner,
    .i18n-notification {
        transition: none !important;
        animation: none !important;
    }
}

/* ==========================================================================
   Animation Keyframes
   ========================================================================== */

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}