/* Enhanced responsive design for all devices */
/* Reset and base styles */
*, *::before, *::after {
    box-sizing: border-box;
}

/* CSS Custom Properties for consistent theming */
:root {
    --primary-color: #007bff;
    --primary-hover: #0056b3;
    --accent-color: #00aaff;
    --accent-hover: #0077cc;
    --danger-color: #ff3333;
    --danger-hover: #ff0000;
    --background-color: #f4f4f9;
    --surface-color: #ffffff;
    --text-color: #333;
    --text-light: #666;
    --border-color: #ccc;
    --sidebar-bg: #111;
    --modal-bg: rgba(0, 0, 0, 0.5);
    --shadow-light: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-medium: 0 4px 8px rgba(0, 0, 0, 0.2);
    --shadow-heavy: 0 4px 12px rgba(0, 0, 0, 0.3);
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --border-radius: 10px;
    --border-radius-small: 5px;
}

/* General styling for the body */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--background-color);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

/* Google Sign-In Container Styling */
#signInContainer {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    background: linear-gradient(135deg, var(--background-color) 0%, var(--surface-color) 100%);
}

#signInContainer h2 {
    color: var(--text-color);
    margin-bottom: 30px;
    font-size: 1.8rem;
    text-align: center;
    font-weight: 300;
}

#googleSignIn {
    padding: 20px;
    background: var(--surface-color);
    border-radius: 12px;
    box-shadow: var(--shadow-heavy);
    min-width: 280px;
    text-align: center;
}

/* Responsive sign-in adjustments */
@media (max-width: 480px) {
    #signInContainer {
        padding: 15px;
    }
    
    #signInContainer h2 {
        font-size: 1.5rem;
        margin-bottom: 20px;
    }
    
    #googleSignIn {
        min-width: 260px;
        padding: 15px;
    }
}

/* Improve touch interactions */
button, a, input {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    text-decoration: none;
    color: white;
    font-size: 18px;
    transition: 0.3s;
    min-height: 44px; /* Ensure good touch target */
}

.sidebar-link:hover {
    color: #00aaff;
}

.sidebar-icon {
    width: 24px;
    height: 24px;
    margin-right: 10px;
    margin-left: 30px;
}

/* Profile picture in sidebar */
.profile-link {
    display: flex;
    align-items: center;
    gap: 10px;
}

.profile-picture {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--surface-color);
    margin-left: 15px;
    transition: all var(--transition-fast);
}

.profile-picture:hover {
    border-color: var(--accent-color);
    transform: scale(1.05);
}

/* Headline at the top of the screen */
h1 {
    margin: 10px 0;
    font-size: 1.5rem;
    color: var(--text-color);
    text-align: left;
    padding-left: 5%;
}

h2 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--surface-color);
    text-align: left;
    padding-left: 5%;
}

/* Enhanced counter container with performance optimizations */
.counter-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 140px));
    gap: 15px;
    padding: 20px;
    background-color: var(--surface-color);
    box-shadow: var(--shadow-medium);
    border-radius: var(--border-radius);
    max-width: 1200px;
    width: 100%;
    margin: 80px auto 20px auto;
    box-sizing: border-box;
    justify-content: center;
    will-change: transform; /* Performance optimization for animations */
}
/* Tooltip container to position the tooltip */
.tooltip-container {
    position: relative;
    display: inline-block;
}

.tooltip-container:hover .tooltip-content {
    visibility: visible;
    opacity: 1;
}

/* Enhanced tooltip content */
.tooltip-content {
    visibility: hidden;
    opacity: 0;
    width: 200px;
    background-color: var(--sidebar-bg);
    color: var(--surface-color);
    text-align: center;
    border-radius: var(--border-radius-small);
    padding: 5px;
    position: absolute;
    z-index: 1;
    bottom: 100%;
    left: 50%;
    margin-left: -100px;
    transition: opacity var(--transition-normal), visibility var(--transition-normal);
    transform: translateX(-50%);
    border: 1px solid var(--border-color);
}

/* Show tooltip when the title is clicked (using the .active class) */
.counter-title.active + .tooltip-container .tooltip-content {
    visibility: visible;
    opacity: 1;
}

/* Contact tooltip container (the contact name) */
.contact-tooltip {
    position: relative;
    display: inline-block;
    font-weight: bold;
    cursor: pointer;
    margin-right: 10px;
    color: var(--text-color);
}

/* RTL support for contact tooltip */
body[dir="rtl"] .contact-tooltip {
    margin-right: 0;
    margin-left: 10px;
}

body[dir="ltr"] .contact-tooltip {
    margin-right: 10px;
    margin-left: 0;
}

/* General tooltip text */
.contact-tooltip-text {
    visibility: hidden;
    width: 200px;
    background-color: var(--surface-color);
    color: var(--text-color);
    text-align: left;
    border-radius: var(--border-radius-small);
    padding: 10px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -100px;
    box-shadow: var(--shadow-medium);
    font-size: 14px;
    border: 1px solid var(--border-color);
}

/* Text inside tooltip */
.contact-tooltip-text p {
    margin: 5px 0;
    line-height: 1.5;
}

/* Hidden tooltip content */  
.contact-tooltip .contact-tooltip-text {
    visibility: hidden;
    width: 180px;
    background-color: #333;
    color: #fff;
    text-align: left;
    border-radius: 5px;
    padding: 5px;
    position: absolute;
    z-index: 1;
    bottom: 125%; /* Position the tooltip above the contact name */
    left: 50%;
    margin-left: -90px; /* Center the tooltip */
    opacity: 0;
    transition: opacity 0.3s, visibility 0.3s; /* Smooth appearance */
    box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.3); /* Optional shadow for better visibility */
}

/* Tooltip arrow */
.contact-tooltip .contact-tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%; /* At the bottom of the tooltip */
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #333 transparent transparent transparent; /* Triangle arrow effect */
}

/* Show tooltip on hover */
.contact-tooltip:hover .contact-tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Show tooltip when active class is added */
.contact-tooltip .contact-tooltip-text.active {
    visibility: visible;
    opacity: 1;
}
/* Waze icon styling */
.waze-icon {
    width: 24px;
    height: 24px;
    vertical-align: middle;
    margin-top: 5px;
    background-color: transparent;
}
/* Enhanced counter styling with performance optimizations */
.counter {
    border: 1px solid var(--border-color);
    margin: 0;
    text-align: center;
    background-color: var(--accent-color);
    padding: 15px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-medium);
    color: white;
    width: 140px;
    max-width: 140px;
    min-width: 140px;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
    justify-self: center;
    will-change: transform; /* Performance optimization */
}

.counter:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-heavy);
}

/* Counter number */
.counter > p {
    font-size: 2rem;
    margin: 5px 0;
    color: white;
}

.counter-title {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: white;
}

/* Headings for the counter points */
.counter h2 {
    font-size: 1rem;
    margin: 0;
    color: white;
}

/* Enhanced button styling with CSS custom properties */
button {
    background-color: var(--surface-color);
    color: var(--accent-color);
    padding: 4px 8px;
    border: 1.5px solid var(--accent-color);
    border-radius: var(--border-radius-small);
    font-size: 0.75rem;
    font-weight: bold;
    cursor: pointer;
    transition: all var(--transition-normal);
    margin-top: 5px;
    width: 100%;
}

/* Button hover effect */
button:hover {
    background-color: var(--accent-color);
    color: var(--surface-color);
}

button.pickup {
    background-color: var(--danger-color);
    color: white;
    padding: 4px 8px;
    border: 1.5px solid var(--danger-color);
    border-radius: var(--border-radius-small);
    font-size: 0.75rem;
    font-weight: bold;
    cursor: pointer;
    transition: all var(--transition-normal);
    margin-top: 5px;
}

button.pickup:hover {
    background-color: var(--danger-hover);
    color: white;
    transform: scale(1.05);
}


/* Enhanced responsive styling for all devices */

/* Tablet styles (768px - 1024px) - SIDEBAR MOVES TO RIGHT */
@media (min-width: 768px) and (max-width: 1024px) {
    .counter-container {
        grid-template-columns: repeat(auto-fit, minmax(160px, 160px)); /* Fixed size */
        gap: 20px;
        padding: 25px;
        margin-top: 70px;
    }
    
    .counter {
        padding: 18px;
        width: 160px; /* Fixed width */
        min-width: 160px;
        max-width: 160px;
    }
    
    .counter > p {
        font-size: 2.2rem;
    }
    
    .counter h2 {
        font-size: 1.1rem;
    }
    
    button {
        padding: 8px 12px;
        font-size: 0.85rem;
        min-height: 44px; /* Ensure good touch target */
    }
    
    #messageInput {
        min-width: 300px;
        max-width: calc(100vw - 150px - 50px); /* Account for sidebar and button */
        font-size: 18px;
        padding: 12px;
        flex: 1;
    }
    
    #sendButton {
        font-size: 18px;
        padding: 12px 20px;
        width: 100px;
        flex-shrink: 0;
    }
    
    /* Move sidebar to right on tablets */
    .sidebar {
        left: auto;
        right: 0;
        width: 50px;
    }
    
    #mainContentWrapper {
        margin-left: 0;
        margin-right: 50px;
    }
}

/* Mobile styles (up to 767px) - SIDEBAR MOVES TO RIGHT */
@media (max-width: 767px) {
    .counter-container {
        grid-template-columns: repeat(auto-fit, minmax(120px, 120px)); /* Fixed size */
        gap: 12px;
        padding: 15px;
        margin-top: 70px;
        margin-left: 10px;
        margin-right: 10px;
    }
    
    .counter {
        padding: 12px;
        width: 120px; /* Fixed width */
        min-width: 120px;
        max-width: 120px;
    }
    
    .counter > p {
        font-size: 1.8rem;
        margin: 8px 0;
    }
    
    .counter h2 {
        font-size: 0.9rem;
        margin-bottom: 8px;
    }
    
    button {
        padding: 8px 10px;
        font-size: 0.8rem;
        width: 100%;
        min-height: 44px; /* Ensure good touch target */
    }
    
    #messageHeader {
        padding: 8px 5px; /* Reduced horizontal padding */
        flex-direction: column;
        height: auto;
        min-height: 60px;
    }
    
    .message-controls {
        width: calc(100% - 10px); /* Account for padding */
        margin-top: 5px;
        padding: 0 5px;
        box-sizing: border-box;
        max-width: none; /* Remove max-width restriction on mobile */
    }
    
    #messageInput {
        min-width: 120px;
        max-width: calc(100vw - 90px - 35px); /* Account for sidebar and button width */
        font-size: 16px;
        padding: 8px;
        flex: 1;
    }
    
    #sendButton {
        width: 70px; /* Smaller button width */
        font-size: 14px;
        padding: 8px 6px;
        flex-shrink: 0;
    }
    
    #spacer {
        display: none;
    }
    
    h2 {
        font-size: 1.2rem;
        margin: 0;
        padding: 0;
    }
    
    /* Move sidebar to right on mobile */
    .sidebar {
        left: auto;
        right: 0;
        width: 35px;
    }
    
    .sidebar a {
        font-size: 16px;
        padding: 12px 10px;
    }
    
    #mainContentWrapper {
        margin-left: 0;
        margin-right: 35px;
        padding-top: 80px;
    }
    
    .logout-btn {
        margin: 20px auto;
        max-width: 200px;
    }
}

/* Small tablet landscape mode (480px - 767px) */
@media (min-width: 481px) and (max-width: 767px) {
    #messageHeader {
        padding: 10px 8px;
        flex-direction: row; /* Keep horizontal layout for landscape tablets */
    }
    
    .message-controls {
        margin-top: 0;
        padding: 0 8px;
    }
    
    #messageInput {
        min-width: 200px;
        max-width: calc(100vw - 120px - 35px);
        padding: 10px;
    }
    
    #sendButton {
        width: 80px;
        padding: 10px 8px;
    }
}

/* Very small mobile devices (up to 480px) */
@media (max-width: 480px) {
    .counter-container {
        grid-template-columns: repeat(auto-fit, minmax(100px, 100px)); /* Fixed size */
        gap: 8px;
        padding: 10px;
        margin: 70px 5px 20px 5px;
    }
    
    .counter {
        padding: 10px;
        width: 100px; /* Fixed width */
        min-width: 100px;
        max-width: 100px;
    }
    
    .counter > p {
        font-size: 1.5rem;
        margin: 5px 0;
    }
    
    .counter h2 {
        font-size: 0.8rem;
    }
    
    button {
        padding: 6px 8px;
        font-size: 0.75rem;
        min-height: 40px;
    }
    
    #messageInput {
        min-width: 100px;
        max-width: calc(100vw - 70px - 30px); /* Account for sidebar and smaller button */
        font-size: 16px;
        padding: 8px;
        flex: 1;
    }
    
    #sendButton {
        width: 50px; /* Even smaller for very small screens */
        font-size: 12px;
        padding: 8px 4px;
        flex-shrink: 0;
    }
    
    h1, h2 {
        font-size: 1rem;
    }
}

/* Default desktop styles (1025px - 1199px) - SIDEBAR STAYS LEFT */
@media (min-width: 1025px) and (max-width: 1199px) {
    .sidebar {
        width: 50px;
        left: 0;
        right: auto;
    }
    
    #mainContentWrapper {
        margin-left: 50px;
        margin-right: 0;
    }
}

/* Large desktop styles (1200px+) - SIDEBAR STAYS LEFT */
@media (min-width: 1200px) {
    .counter-container {
        grid-template-columns: repeat(auto-fit, minmax(180px, 180px)); /* Fixed size */
        gap: 25px;
        padding: 30px;
        max-width: 1400px;
    }
    
    .counter {
        padding: 20px;
        width: 180px; /* Fixed width */
        min-width: 180px;
        max-width: 180px;
    }
    
    .counter > p {
        font-size: 2.5rem;
    }
    
    .counter h2 {
        font-size: 1.2rem;
    }
    
    #messageInput {
        max-width: 600px;
        font-size: 18px;
    }
    
    .sidebar {
        width: 60px;
        left: 0; /* Ensure it stays on the left for desktop */
        right: auto;
    }
    
    #mainContentWrapper {
        margin-left: 60px;
        margin-right: 0;
    }
}

/* Hebrew language support - Move sidebar to right on all screen sizes */
body.hebrew-mode .sidebar,
body[dir="rtl"] .sidebar {
    left: auto !important;
    right: 0 !important;
}

body.hebrew-mode #mainContentWrapper,
body[dir="rtl"] #mainContentWrapper {
    margin-left: 0 !important;
    margin-right: 40px !important;
}

/* RTL text direction support for all content */
body[dir="rtl"] {
    direction: rtl;
    text-align: right;
}

body[dir="ltr"] {
    direction: ltr;
    text-align: left;
}

/* RTL specific text and UI elements */
body[dir="rtl"] h1,
body[dir="rtl"] h2,
body[dir="rtl"] p,
body[dir="rtl"] .counter-title,
body[dir="rtl"] .counter h2 {
    text-align: right;
    direction: rtl;
}

body[dir="ltr"] h1,
body[dir="ltr"] h2,
body[dir="ltr"] p,
body[dir="ltr"] .counter-title,
body[dir="ltr"] .counter h2 {
    text-align: left;
    direction: ltr;
}

/* RTL support for form elements */
body[dir="rtl"] input,
body[dir="rtl"] textarea,
body[dir="rtl"] .profile-container input {
    text-align: right;
    direction: rtl;
}

body[dir="ltr"] input,
body[dir="ltr"] textarea,
body[dir="ltr"] .profile-container input {
    text-align: left;
    direction: ltr;
}

/* RTL support for tooltips and modals */
body[dir="rtl"] .tooltip-content,
body[dir="rtl"] .contact-tooltip-text,
body[dir="rtl"] .modal-content {
    text-align: right;
    direction: rtl;
}

body[dir="ltr"] .tooltip-content,
body[dir="ltr"] .contact-tooltip-text,
body[dir="ltr"] .modal-content {
    text-align: left;
    direction: ltr;
}

/* RTL support for sidebar links */
body[dir="rtl"] .sidebar a {
    text-align: right;
    direction: rtl;
    padding-right: 15px;
    padding-left: 8px;
}

body[dir="ltr"] .sidebar a {
    text-align: left;
    direction: ltr;
    padding-left: 15px;
    padding-right: 8px;
}

/* RTL support for parcel history */
body[dir="rtl"] #parcelHistoryContainer,
body[dir="rtl"] .parcel-row,
body[dir="rtl"] .parcel-header,
body[dir="rtl"] .parcel-details {
    text-align: right;
    direction: rtl;
}

body[dir="ltr"] #parcelHistoryContainer,
body[dir="ltr"] .parcel-row,
body[dir="ltr"] .parcel-header,
body[dir="ltr"] .parcel-details {
    text-align: left;
    direction: ltr;
}

/* RTL spacing adjustments for parcel header spans */
body[dir="rtl"] .parcel-header span {
    margin-right: 0;
    margin-left: 15px;
}

body[dir="ltr"] .parcel-header span {
    margin-right: 15px;
    margin-left: 0;
}

/* RTL support for group items */
body[dir="rtl"] .group-item h2 {
    text-align: right;
    direction: rtl;
}

body[dir="ltr"] .group-item h2 {
    text-align: left;
    direction: ltr;
}

/* RTL support for sidebar icons */
body[dir="rtl"] .sidebar-icon {
    margin-right: 30px;
    margin-left: 10px;
}

body[dir="ltr"] .sidebar-icon {
    margin-right: 10px;
    margin-left: 30px;
}

/* RTL support for buttons and labels */
body[dir="rtl"] button,
body[dir="rtl"] label,
body[dir="rtl"] .group-item {
    text-align: center; /* Keep buttons centered */
    direction: rtl;
}

body[dir="ltr"] button,
body[dir="ltr"] label,
body[dir="ltr"] .group-item {
    text-align: center; /* Keep buttons centered */
    direction: ltr;
}

/* Hebrew mode responsive adjustments */
@media (min-width: 1025px) and (max-width: 1199px) {
    body.hebrew-mode #mainContentWrapper,
    body[dir="rtl"] #mainContentWrapper {
        margin-right: 50px !important;
    }
}

@media (min-width: 768px) and (max-width: 1024px) {
    body.hebrew-mode #mainContentWrapper,
    body[dir="rtl"] #mainContentWrapper {
        margin-right: 50px !important;
    }
}

@media (max-width: 767px) {
    body.hebrew-mode #mainContentWrapper,
    body[dir="rtl"] #mainContentWrapper {
        margin-right: 35px !important;
    }
}

@media (min-width: 1200px) {
    body.hebrew-mode #mainContentWrapper,
    body[dir="rtl"] #mainContentWrapper {
        margin-right: 60px !important;
    }
}

/* Enhanced sidebar with performance optimizations */
.sidebar {
    height: 100%;
    width: 40px;
    position: fixed;
    z-index: 200;
    top: 0;
    left: 0;
    background-color: var(--sidebar-bg);
    overflow-x: hidden;
    overflow-y: auto;
    transition: width var(--transition-normal), left var(--transition-normal), right var(--transition-normal);
    -webkit-overflow-scrolling: touch;
    will-change: transform; /* Performance optimization */
}

/* Sidebar on the right for mobile/tablet or Hebrew */
.sidebar.right-side {
    left: auto;
    right: 0;
}

/* Sidebar when fully open */
.sidebar.open {
    width: 250px;
}

/* Sidebar links with enhanced theming */
.sidebar a {
    padding: 15px 15px;
    text-decoration: none;
    font-size: 16px;
    color: var(--surface-color);
    display: block;
    transition: all var(--transition-normal);
    visibility: hidden;
    opacity: 0;
    white-space: nowrap;
    min-height: 44px;
    line-height: 1.2;
}

/* When sidebar is fully open */
.sidebar.open a {
    visibility: visible;
    opacity: 1;
}

/* Hover effect with theme support */
.sidebar a:hover {
    color: var(--accent-color);
    background-color: rgba(255, 255, 255, 0.1);
}

/* Enhanced menu button */
.menu-btn {
    font-size: 20px;
    margin: 0;
    background: none;
    border: none;
    color: var(--accent-color);
    cursor: pointer;
    height: 60px;
    width: 100%;
    transition: all var(--transition-normal);
    min-height: 60px;
    max-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid var(--border-color);
    box-sizing: border-box;
    padding: 0;
}

.menu-btn:hover {
    color: var(--accent-hover);
    background-color: rgba(255, 255, 255, 0.1);
}

/* Enhanced main content wrapper - RESPONSIVE TO SIDEBAR POSITION */
#mainContentWrapper {
    margin-left: 40px; /* Default left margin */
    margin-right: 0;
    transition: margin-left 0.3s ease, margin-right 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 80px;
    min-height: calc(100vh - 80px);
    width: calc(100% - 40px);
}

/* When sidebar is on the right */
#mainContentWrapper.sidebar-right {
    margin-left: 0;
    margin-right: 40px;
}

/* Enhanced logout button */
.logout-btn {
    background-color: var(--danger-color);
    color: white;
    border: 1px solid var(--danger-color);
    margin: 20px auto;
    padding: 12px 24px;
    font-size: 1rem;
    max-width: 200px;
    width: 100%;
    border-radius: var(--border-radius-small);
    transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

.logout-btn:hover {
    background-color: var(--danger-hover);
    border-color: var(--danger-hover);
    transform: none;
}

/* Enhanced group items */
.group-item {
    border: 1px solid var(--border-color);
    padding: 10px;
    margin: 10px;
    border-radius: var(--border-radius-small);
    background-color: var(--surface-color);
    color: var(--text-color);
}

.group-item h2 {
    font-size: 1.2rem;
    margin-bottom: 5px;
    color: var(--text-color);
}

/* Enhanced modal */
.modal {
    display: flex;
    justify-content: center;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--modal-bg);
    z-index: 1000;
    transition: visibility 0s, opacity var(--transition-normal);
    backdrop-filter: blur(4px);
}

.modal-content:not(.hidden) {
    visibility: visible;
    opacity: 1;
}

.modal-content {
    background: var(--surface-color);
    padding: 20px;
    border-radius: var(--border-radius);
    width: 80%;
    max-width: 500px;
    text-align: center;
    position: relative;
    box-shadow: var(--shadow-heavy);
    font-family: Arial, sans-serif;
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.close-button {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-color);
}

.close-button:hover {
    color: var(--accent-color);
}

.hidden {
    visibility: hidden;
    opacity: 0;
}

.modal-content h2 {
    margin-top: 0;
}



.close-button {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 1.5rem;
    cursor: pointer;
    color: #333;
}

/* Enhanced bot link */
.bot-link {
    display: inline-block;
    margin: 10px 0;
    padding: 10px 20px;
    background-color: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: var(--border-radius-small);
    transition: background-color var(--transition-normal);
}

.bot-link:hover {
    background-color: var(--primary-hover);
}

/* Enhanced OTP box */
.otp-box {
    font-size: 18px;
    font-weight: bold;
    color: var(--text-color);
    margin: 10px 0;
    padding: 10px;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-small);
    display: inline-block;
}

.message-icon {
    width: 24px;
    height: 24px;
    margin-left: 10px;
    cursor: pointer;
    vertical-align: middle;
}

#modalMessageContent a {
    color: var(--primary-color);
    text-decoration: none;
}

#modalMessageContent a:hover {
    text-decoration: underline;
    color: var(--primary-hover);
}

/* Profile Form Container - Enhanced for Hebrew text support */
.profile-container {
    max-width: 600px; /* Increased from 500px to accommodate Hebrew text */
    min-width: 400px; /* Increased minimum width */
    margin: 40px auto;
    padding: 30px; /* Increased padding */
    background: #fff;
    border-radius: 12px;
    box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.1);
    text-align: left;
    box-sizing: border-box;
}

/* Hebrew mode profile container - even wider */
body.hebrew-mode .profile-container,
body[dir="rtl"] .profile-container {
    max-width: 700px;
    min-width: 500px;
    padding: 35px;
    text-align: right;
    direction: rtl;
}

/* Hebrew mode labels and text formatting */
body.hebrew-mode .profile-container label,
body[dir="rtl"] .profile-container label {
    display: block; /* Force each label to its own line */
    margin-bottom: 5px;
    margin-top: 15px;
    line-height: 1.6;
    word-wrap: break-word;
    text-align: right;
    direction: rtl;
}

/* Hebrew mode form elements */
body.hebrew-mode .profile-container input,
body.hebrew-mode .profile-container .language-selection,
body.hebrew-mode .profile-container .reminder-container,
body.hebrew-mode .profile-container .notify-container,
body[dir="rtl"] .profile-container input,
body[dir="rtl"] .profile-container .language-selection,
body[dir="rtl"] .profile-container .reminder-container,
body[dir="rtl"] .profile-container .notify-container {
    width: 100%;
    margin: 8px 0 15px 0;
    clear: both;
    text-align: right;
    direction: rtl;
}

/* LTR mode profile container */
body[dir="ltr"] .profile-container {
    text-align: left;
    direction: ltr;
}

body[dir="ltr"] .profile-container label {
    text-align: left;
    direction: ltr;
}

body[dir="ltr"] .profile-container input,
body[dir="ltr"] .profile-container .language-selection,
body[dir="ltr"] .profile-container .reminder-container,
body[dir="ltr"] .profile-container .notify-container {
    text-align: left;
    direction: ltr;
}



/* Profile Form Headline */
.profile-container h1 {
    text-align: center;
    font-size: 1.8rem;
    color: #333;
    margin-bottom: 15px;
}

/* Profile Form Inputs */
.profile-container input[type="text"],
.profile-container input[type="radio"], 
.profile-container input[type="checkbox"],
.reminder-container,
.language-selection,
.notify-container {
    width: 94%;
    padding: 12px;
    margin: 10px 0;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    transition: all 0.3s ease-in-out;
}

.notify-container input[type="checkbox"] {
    width: unset;
    padding: 12px;
    margin: 10px 0;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    transition: all 0.3s ease-in-out;
}

/* Highlight inputs on focus */
.profile-container input:focus {
    border-color: #007bff;
    box-shadow: 0px 0px 6px rgba(0, 123, 255, 0.2);
    outline: none;
}

/* Radio Button Labels */
.profile-container label {
    font-size: 1rem;
    margin-right: 10px;
    color: #444;
}

/* Save Button */
.profile-container button {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
    font-weight: bold;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease-in-out;
}

/* Button Hover Effect */
.profile-container button:hover {
    background: #0056b3;
    transform: translateY(-2px);
}

/* Responsive Design for Profile Container */
@media (max-width: 800px) {
    .profile-container {
        width: 95%;
        max-width: 550px;
        padding: 25px;
        margin: 20px auto;
        min-width: 300px;
    }
    
    body.hebrew-mode .profile-container,
    body[dir="rtl"] .profile-container {
        max-width: 600px;
        min-width: 350px;
        padding: 30px;
    }
}

@media (max-width: 600px) {
    .profile-container {
        width: 95%;
        max-width: 500px;
        padding: 20px;
        margin: 20px auto;
        min-width: 280px;
    }
    
    body.hebrew-mode .profile-container,
    body[dir="rtl"] .profile-container {
        max-width: 550px;
        min-width: 320px;
        padding: 25px;
    }
}

@media (max-width: 500px) {
    .profile-container {
        width: 95%;
        max-width: 450px;
        padding: 15px;
        margin: 15px auto;
        min-width: 260px;
    }
    
    body.hebrew-mode .profile-container,
    body[dir="rtl"] .profile-container {
        max-width: 480px;
        min-width: 300px;
        padding: 20px;
    }
    
    .language-container {
        padding: 8px;
    }
    
    body.hebrew-mode .language-container,
    body[dir="rtl"] .language-container {
        padding: 12px;
        min-height: 80px;
    }
    
    .language-flag {
        width: 35px;
        height: 35px;
    }
}

.language-selection label {
    display: block;
    margin-bottom: 8px; /* Increased spacing */
    font-weight: bold;
    line-height: 1.4; /* Better line height for Hebrew text */
}

.language-flag {
    width: 40px;
    height: 40px;
    cursor: pointer;
    border: 3px solid transparent;
    border-radius: 50%;
    transition: border 0.3s ease;
    margin: 5px; /* Added margin for better spacing */
}

.language-flag.selected {
    border: 3px solid #007bff; /* Highlight color */
}

.language-container {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin-top: 10px;
    padding: 15px; /* Increased padding */
    border: 1px solid #ddd; /* Added border for clarity */
    border-radius: 6px;
    min-height: 80px; /* Ensure minimum height for Hebrew text */
}

/* Hebrew mode language container - better spacing */
body.hebrew-mode .language-container,
body[dir="rtl"] .language-container {
    padding: 20px;
    min-height: 100px;
    direction: rtl;
    text-align: right;
}

body.hebrew-mode .language-selection label,
body[dir="rtl"] .language-selection label {
    margin-bottom: 12px;
    font-size: 1.1rem;
    line-height: 1.6;
    text-align: right;
    direction: rtl;
}

/* LTR mode language container */
body[dir="ltr"] .language-container {
    direction: ltr;
    text-align: left;
}

body[dir="ltr"] .language-selection label {
    text-align: left;
    direction: ltr;
}

/* style.css */

/* Enhanced responsive header */
#messageHeader {
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    background: var(--primary-color); 
    padding: 10px 15px; 
    box-shadow: var(--shadow-medium); 
    z-index: 100; 
    transition: left var(--transition-normal), width var(--transition-normal);
    display: flex;
    align-items: center;
    min-height: 60px;
    box-sizing: border-box;
}

#messageInput {
    flex: 1;
    max-width: 600px;
    min-width: 200px;
    padding: 10px;
    font-size: 16px;
    border: 1px solid var(--border-color);
    border-right: none;
    border-radius: var(--border-radius-small) 0 0 var(--border-radius-small);
    box-sizing: border-box;
    background-color: var(--surface-color);
    color: var(--text-color);
}

/* RTL support for message input */
body[dir="rtl"] #messageInput {
    text-align: right;
    direction: rtl;
    border-right: 1px solid var(--border-color);
    border-left: none;
    border-radius: 0 var(--border-radius-small) var(--border-radius-small) 0;
}

body[dir="ltr"] #messageInput {
    text-align: left;
    direction: ltr;
    border-right: none;
    border-left: 1px solid var(--border-color);
    border-radius: var(--border-radius-small) 0 0 var(--border-radius-small);
}

#messageInput::placeholder {
    color: var(--text-light);
}

#sendButton {
    padding: 10px 20px;
    font-size: 16px;
    width: 100px;
    flex-shrink: 0;
    border: 1px solid var(--border-color);
    border-left: none;
    border-radius: 0 var(--border-radius-small) var(--border-radius-small) 0;
    background-color: var(--primary-color);
    color: white;
    margin-top: 0;
    box-sizing: border-box;
    min-height: 44px;
    transition: background-color var(--transition-normal);
}

/* RTL support for send button */
body[dir="rtl"] #sendButton {
    border-left: 1px solid var(--border-color);
    border-right: none;
    border-radius: var(--border-radius-small) 0 0 var(--border-radius-small);
}

body[dir="ltr"] #sendButton {
    border-left: none;
    border-right: 1px solid var(--border-color);
    border-radius: 0 var(--border-radius-small) var(--border-radius-small) 0;
}

#sendButton:hover {
    background-color: var(--primary-hover);
    color: white;
}

/* Container for the input and button */
.message-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1;
    max-width: 700px;
    padding: 0 10px;
    box-sizing: border-box;
    overflow: hidden; /* Prevent overflow */
}

/* RTL support for message controls */
body[dir="rtl"] .message-controls {
    flex-direction: row-reverse;
}

body[dir="ltr"] .message-controls {
    flex-direction: row;
}
  
#spacer {
    padding-left: 50px;
    flex-shrink: 0;
}

/* RTL support for spacer */
body[dir="rtl"] #spacer {
    padding-left: 0;
    padding-right: 50px;
}

body[dir="ltr"] #spacer {
    padding-left: 50px;
    padding-right: 0;
}

/* Search input styling */
#searchPointsInput {
    padding: 10px;
    font-size: 16px;
    width: 96%;
    max-width: 600px;
    min-width: 200px;
    border: 1px solid #ccc;
    border-radius: 5px;
    margin-bottom: 10px;
    box-sizing: border-box;
}

/* RTL support for search input */
body[dir="rtl"] #searchPointsInput {
    text-align: right;
    direction: rtl;
}

body[dir="ltr"] #searchPointsInput {
    text-align: left;
    direction: ltr;
}

/* Container for the parcel history view */
#parcelHistoryContainer {
    text-align: left; /* Align text to the left */
    padding: 20px;
    padding-right: 60px;
    width: 100%;
}

#parcelHistoryContainer ul {
    list-style: none;
    padding: 0;
}
#parcelHistoryContainer li {
    padding: 10px;
    border-bottom: 1px solid #ccc;
    font-size: 0.9rem;
}

/* Style for each parcel row */
.parcel-row {
    border: 1px solid #ccc;
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    font-size: 1.1rem; /* Increased font size */
}

/* Hover effect for rows */
.parcel-row:hover {
    background-color: #f9f9f9;
}

/* Header within each row for brief details */
.parcel-header span {
    display: inline-block;
    margin-right: 15px;
}

/* Details section (hidden by default) */
.parcel-details {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #ddd;
    font-size: 0.95rem;
}

/* Style for taken parcels */
.taken-parcel {
    background-color: #e0e0e0; /* Light grey background */
    color: #777;
}

/* Optionally strike-through text for taken parcels */
.taken-parcel .parcel-header span {
    text-decoration: line-through;
}

/* Enhanced loading spinner with modern design */
#loadingSpinner {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--modal-bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(4px);
}

.spinner {
    border: 6px solid var(--border-color);
    border-top: 6px solid var(--primary-color);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 0.8s linear infinite;
    margin-bottom: 20px;
}

/* Skeleton loader for counter containers */
.skeleton-counter {
    background: linear-gradient(90deg, var(--border-color) 25%, rgba(255,255,255,0.1) 50%, var(--border-color) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--border-radius);
    width: 140px;
    height: 120px;
    margin: 0 auto;
}

.skeleton-counter-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 140px));
    gap: 15px;
    padding: 20px;
    background-color: var(--surface-color);
    box-shadow: var(--shadow-medium);
    border-radius: var(--border-radius);
    max-width: 1200px;
    width: 100%;
    margin: 80px auto 20px auto;
    box-sizing: border-box;
    justify-content: center;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* Pulse animation for loading states */
.pulse {
    animation: pulse 1.5s ease-in-out infinite alternate;
}

@keyframes pulse {
    0% {
        opacity: 0.6;
    }
    100% {
        opacity: 1;
    }
}

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

/* Additional responsive and touch enhancements */

/* Focus styles for accessibility */
button:focus,
a:focus,
input:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Touch device specific styles - improved minimum sizes */
.touch-device button,
.touch-device a,
.menu-btn {
    min-height: 48px; /* Increased from 44px for better accessibility */
    min-width: 48px;
}

/* Prevent text selection on touch devices for UI elements */
.touch-device .counter,
.touch-device .sidebar a,
.touch-device button {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Improve scrolling on mobile */
body {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .counter {
        border: 2px solid #000;
    }
    
    button {
        border: 2px solid #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Print styles */
@media print {
    .sidebar,
    #messageHeader,
    button,
    .menu-btn {
        display: none;
    }
    
    #mainContentWrapper {
        margin-left: 0;
        padding-top: 0;
    }
    
    .counter-container {
        margin-top: 0;
    }
}
