:root {
    --primary-color: #0d47a1; /* Dark Blue */
    --secondary-color: #d32f2f; /* Red */
    --text-color: #333;
    --background-color: #f4f6f9;
    --card-bg-color: #ffffff;
    --header-footer-bg: #ffffff;
    --header-footer-color: #333;
}

body {
    margin: 0;
    font-family: 'Heebo', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    font-size: 16px;
    line-height: 1.6;
    text-align: right; /* Default for RTL */
}

/* General App Layout (for main.php) */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

header, footer {
    background-color: var(--header-footer-bg);
    color: var(--header-footer-color);
    padding: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

header {
    display: flex;
    align-items: center;
    gap: 15px;
    position: relative; /* For admin header layout */
}

main {
    padding: 1.5rem;
    flex-grow: 1;
    width: 100%;
    max-width: 100vw; /* Prevent horizontal overflow from padding */
    box-sizing: border-box;
}

.card {
    background: var(--card-bg-color);
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    padding: 1.5rem 2rem;
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

h1, h2 {
    margin-top: 0;
    color: var(--primary-color);
}

header h1 {
    margin-top: 0;
    margin-bottom: 0;
    font-size: 1.5rem;
}

button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 500;
    font-family: 'Heebo', sans-serif;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

button:hover {
    opacity: 0.9;
}

.install-button {
    background-color: var(--secondary-color); /* Red */
    font-size: 1.1rem;
    font-weight: 700;
    width: 100%;
    margin-top: 1rem;
}

/* Installation Screen Styles - Matching Login Card Design */
.install-body {
    background: white;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    min-height: 100dvh; /* Use dynamic viewport height on supported browsers */
    font-family: 'Heebo', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Dynamic Direction Classes for Install Page */
.install-body.dir-rtl {
    direction: rtl;
}

.install-body.dir-ltr {
    direction: ltr;
}

/* Enhanced Install Container */
.install-container {
    max-width: 500px;
    width: 90%;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    position: relative;
    border: 1px solid #e0e0e0;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    animation: fadeInUp 0.6s ease-out;
}

.install-container:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
}

/* Enhanced Install Header */
.install-header {
    padding: 2rem;
    background: white;
    color: #333;
    text-align: center;
    border-bottom: 1px solid #e0e0e0;
}

/* Logo Section - From Reference */
.logo-section {
    text-align: center;
    margin-bottom: 0;
}

.logo-image {
    margin-bottom: 0px;
    display: inline-block;
}

.brand-logo {
    max-width: 200px;
    height: auto;
    max-height: 80px;
    object-fit: contain;
    transition: transform 0.3s ease, filter 0.3s ease;
    filter: drop-shadow(0 4px 15px rgba(65, 116, 218, 0.2));
}

.brand-logo:hover {
    transform: scale(1.05);
    filter: drop-shadow(0 6px 20px rgba(65, 116, 218, 0.3));
}

.install-header h1 {
    color: var(--primary-color);
    margin: 0;
    font-size: 1.8rem;
    font-weight: 700;
}

.brand-subtitle {
    color: #666;
    font-size: 14px;
    font-weight: 400;
    margin-top: 0px;
    margin-bottom: 20px;
}

/* Enhanced Main Content */
.install-container main {
    padding: 2.5rem;
}

/* Enhanced Instructions Cards */
.instructions-card {
    text-align: center;
    padding: 20px 0;
}

.instructions-card h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 1.5rem;
    font-weight: 600;
}

.instructions-card p {
    color: #555;
    margin-bottom: 25px;
    line-height: 1.7;
    font-size: 16px;
}

/* Install Steps (for iOS instructions) */
.instructions-card ol {
    text-align: right;
    padding-right: 20px;
    list-style-position: outside;
    margin: 20px 0;
    color: #555;
}

.dir-ltr .instructions-card ol {
    text-align: left;
    padding-right: 0;
    padding-left: 20px;
}

.instructions-card li {
    margin-bottom: 15px;
    line-height: 1.7;
}

/* Install Button - Using Login Button Style */
.install-button {
    width: 100%;
    padding: 14px;
    background-color: #4174da;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 25px 0;
    text-decoration: none;
    font-family: 'Heebo', sans-serif;
}

.install-button:hover {
    background-color: #2c5cb8;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(65, 116, 218, 0.3);
}

.install-button:active {
    transform: translateY(0);
}

.install-button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.install-button i {
    font-size: 16px;
}

/* Enhanced Small Text */
.small-text {
    font-size: 14px;
    color: #666;
    margin-top: 20px;
    line-height: 1.5;
    background-color: rgba(13, 71, 161, 0.05);
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
    margin-bottom: 0;
}

.dir-rtl .small-text {
    border-left: none;
    border-right: 4px solid var(--primary-color);
}

.dir-ltr .small-text {
    text-align: left;
}

/* Inline Icons for Instructions */
.inline-icon {
    vertical-align: middle;
    margin: 0 4px;
    height: 20px;
    width: 20px;
    border-radius: 3px;
}

/* Language Selector Styles for Installation Page */
.install-language-selector {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

/* RTL - Position on top left inside container */
.dir-rtl .install-language-selector {
    left: 20px;
    right: auto;
}

/* LTR - Position on top right inside container */
.dir-ltr .install-language-selector {
    right: 20px;
    left: auto;
}

.install-language-dropdown {
    position: relative;
    display: inline-block;
}

.install-language-flag-btn {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    width: 40px;
    height: 40px;
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.install-language-flag-btn:hover {
    background: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.install-language-flag-btn:focus {
    outline: none;
    background: white;
    border-color: var(--primary-color);
}

.install-current-flag {
    width: 24px;
    height: 18px;
    border-radius: 3px;
    object-fit: cover;
}

.install-language-menu {
    position: absolute;
    top: calc(100% + 8px);
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    min-width: 180px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1001;
    overflow: hidden;
    border: 1px solid #e0e0e0;
}

/* RTL Menu Position */
.dir-rtl .install-language-menu {
    left: 0;
    right: auto;
}

/* LTR Menu Position */
.dir-ltr .install-language-menu {
    right: 0;
    left: auto;
}

.install-language-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.install-language-option {
    padding: 12px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: background-color 0.2s ease;
    font-size: 14px;
    color: #333;
}

.install-language-option:hover {
    background-color: #f8f9fa;
}

.install-language-option.active {
    background-color: #e3f2fd;
    color: var(--primary-color);
}

.install-flag-image {
    width: 20px;
    height: 15px;
    border-radius: 2px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    object-fit: cover;
    flex-shrink: 0;
}

.install-lang-name {
    flex: 1;
    font-weight: 500;
}

.install-language-option .fa-check {
    color: var(--primary-color);
    font-size: 12px;
}

/* Responsive Design */
@media (max-width: 768px) {
    html, body {
        overflow-x: hidden;
    }

    .install-body {
        align-items: center;
        padding: 0.5rem;
        box-sizing: border-box;
        min-height: 100vh;
        min-height: 100dvh;
        overflow: hidden;
        justify-content: center;
    }

    .install-container {
        width: 100%;
        max-width: 95%;
        margin: 0;
        box-sizing: border-box;
        max-height: calc(100vh - 1rem);
        max-height: calc(100dvh - 1rem);
        overflow-y: auto;
    }

    .install-header {
        padding: 1rem;
    }

    .install-header h1 {
        font-size: 1.5rem;
    }

    .brand-logo {
        max-width: 150px;
        max-height: 60px;
    }

    .install-container main {
        padding: 1rem;
    }

    .instructions-card h2 {
        font-size: 1.3rem;
    }

    .install-button {
        font-size: 16px;
        padding: 14px;
    }

    .install-language-selector {
        top: 15px;
    }

    .dir-rtl .install-language-selector {
        left: 15px;
    }

    .dir-ltr .install-language-selector {
        right: 15px;
    }

    .install-language-flag-btn {
        width: 36px;
        height: 36px;
    }

    .install-current-flag {
        width: 20px;
        height: 15px;
    }

    .install-language-menu {
        min-width: 160px;
    }
}

/* PWA Installation Loading and Success Animations */
.installation-loader {
    display: flex;
    justify-content: center;
    margin: 2rem 0;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

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

.success-icon {
    display: flex;
    justify-content: center;
    margin: 2rem 0;
    color: #28a745;
}

.success-icon i {
    font-size: 4rem;
    animation: bounceIn 0.6s ease-out;
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

#installation-loading h2,
#installation-success h2 {
    color: var(--primary-color);
    margin: 1rem 0;
}

#installation-loading p,
#installation-success p,
#use-app-message p {
    opacity: 0.8;
    line-height: 1.6;
}

.app-icon {
    display: flex;
    justify-content: center;
    margin: 2rem 0;
    color: var(--primary-color);
}

.app-icon i {
    font-size: 4rem;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.7;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

#use-app-message h2,
#pwa-open-instructions h2 {
    color: var(--primary-color);
    margin: 1rem 0;
}

.instruction-list {
    text-align: left;
    margin: 1.5rem 0;
    padding-left: 1.5rem;
    line-height: 1.6;
}

[dir="rtl"] .instruction-list {
    text-align: right;
    padding-right: 1.5rem;
    padding-left: 0;
}

.instruction-list li {
    margin: 0.8rem 0;
}

.instruction-note {
    margin-top: 1.5rem;
    font-size: 0.9em;
    color: #666;
    opacity: 0.8;
}

.mobile-instruction-steps {
    margin: 2rem 0;
}

.instruction-step {
    display: flex;
    align-items: center;
    margin: 1rem 0;
    padding: 1rem;
    background: rgba(13, 71, 161, 0.05);
    border-radius: 8px;
    border-left: 3px solid var(--primary-color);
}

[dir="rtl"] .instruction-step {
    border-left: none;
    border-right: 3px solid var(--primary-color);
}

.instruction-step i {
    color: var(--primary-color);
    font-size: 1.2rem;
    margin-right: 1rem;
    width: 20px;
    text-align: center;
}

[dir="rtl"] .instruction-step i {
    margin-right: 0;
    margin-left: 1rem;
}

.instruction-step span {
    flex: 1;
    line-height: 1.4;
}

/* Update Notification Bar */
.snackbar {
    visibility: hidden;
    min-width: 250px;
    background-color: #2c3e50;
    color: #ecf0f1;
    border-radius: 8px;
    padding: 12px 24px;
    position: fixed;
    z-index: 10;
    left: 50%;
    transform: translateX(-50%);
    bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.snackbar.show {
    visibility: visible;
    animation: fadein 0.5s;
}

.snackbar .update-button {
    margin-right: 20px; /* For RTL */
    background-color: #4e9af1;
    color: white;
    padding: 8px 16px;
    border-radius: 5px;
    font-weight: 500;
    font-size: 0.9rem;
    border: none;
    cursor: pointer;
}

@keyframes fadein {
    from {bottom: 0; opacity: 0;}
    to {bottom: 30px; opacity: 1;}
}

/* --- Login Page Specific Styles --- */

.login-page-body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh; /* Ensure it takes full viewport height */
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

.login-page-body .app-container {
    min-height: auto;
    width: 100%;
    max-width: 420px;
    background-color: var(--card-bg-color);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    overflow: hidden;
    margin: 1rem; /* Add some margin for smaller screens */
}

.login-page-body header {
    background-color: transparent;
    box-shadow: none;
    justify-content: center;
    padding: 2.5rem 1rem 1rem 1rem;
}

.login-page-body .logo {
    height: 60px;
}

.login-card {
    box-shadow: none;
    padding: 1rem 2.5rem 2.5rem 2.5rem;
    max-width: 100%;
    margin: 0;
}

.login-card h2 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 2rem;
    color: var(--text-color);
}

.login-form .form-group {
    margin-bottom: 1.5rem;
    text-align: right;
}

.login-form label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.9rem;
    color: #555;
}

.login-form input[type="email"],
.login-form input[type="password"] {
    width: 100%;
    padding: 14px;
    font-size: 1rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-sizing: border-box;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    font-family: 'Heebo', sans-serif;
}

.login-form input[type="email"]::placeholder,
.login-form input[type="password"]::placeholder {
    color: #aaa;
}

.login-form input[type="email"]:focus,
.login-form input[type="password"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(13, 71, 161, 0.1);
}

.login-form .button-primary {
    width: 100%;
    padding: 15px;
    font-size: 1.1rem;
    font-weight: 700;
    margin-top: 1rem;
}

.login-page-body footer {
    display: none; /* Hide footer on this focused view */
}

.error-text {
    background-color: #fff2f2;
    color: var(--secondary-color);
    border: 1px solid #ffc2c2;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 1.5rem;
    text-align: center;
    font-size: 0.95rem;
}

.success-text {
    background-color: #f0fff4;
    color: #2f855a;
    border: 1px solid #9ae6b4;
    border-radius: 6px;
    padding: 12px;
    text-align: center;
    font-size: 0.95rem;
}

/* --- Admin/Logged-in Header Styles --- */

.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #4174da 0%, #2c5cb8 100%);
    color: white;
    padding: 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.header-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-info span {
    font-weight: 500;
    color: white;
}

/* Header Logo */
.header-logo {
    height: 40px;
    width: auto;
    max-width: 150px;
    object-fit: contain;
    filter: brightness(0) invert(1); /* Makes logo white */
}

/* Menu Toggle Button */
.menu-toggle-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

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

.menu-toggle-btn svg {
    width: 24px;
    height: 24px;
}

/* Profile Menu */
.profile-menu {
    position: relative;
}

.profile-menu-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

/* Profile Dropdown */
.profile-dropdown {
    position: absolute;
    top: 100%;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    min-width: 150px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
}

/* RTL (Hebrew) - dropdown opens to the left */
[dir="rtl"] .profile-dropdown {
    left: 0;
}

/* LTR (English) - dropdown opens to the right */
[dir="ltr"] .profile-dropdown {
    right: 0;
}

.profile-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.profile-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    text-decoration: none;
    color: #333;
    transition: background-color 0.2s ease;
    font-size: 0.9rem;
}

.profile-dropdown-item:hover {
    background-color: #f8f9fa;
}

.profile-dropdown-item:first-child {
    border-radius: 8px 8px 0 0;
}

.profile-dropdown-item:last-child {
    border-radius: 0 0 8px 8px;
}

.profile-dropdown-item.logout-item {
    color: #dc3545;
    border-top: 1px solid #eee;
}

.profile-dropdown-item.logout-item:hover {
    background-color: #fff5f5;
}

/* Header Language Selector */
.header-language-selector {
    position: relative;
    margin-left: 5px;
    margin-right: 5px;
}

/* Debug styles */
.header-language-menu * {
    visibility: visible !important;
    opacity: 1 !important;
    display: block !important;
}

.header-language-flag-btn {
    background: white;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header-language-flag-btn:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    transform: translateY(-1px);
}

.header-current-flag {
    width: 20px;
    height: 15px;
    border-radius: 2px;
}

.header-language-menu {
    position: absolute;
    top: 100%;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    min-width: 180px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    margin-top: 4px;
}

/* RTL (Hebrew) - language dropdown opens to the left */
[dir="rtl"] .header-language-menu {
    left: 0;
}

/* LTR (English) - language dropdown opens to the right */
[dir="ltr"] .header-language-menu {
    right: 0;
}

.header-language-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.header-language-option {
    display: flex !important;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    color: #333 !important;
    font-size: 0.9rem;
    text-decoration: none;
    white-space: nowrap;
    min-height: 40px;
}

.header-language-option:hover {
    background-color: #f8f9fa;
}

.header-language-option:first-child {
    border-radius: 8px 8px 0 0;
}

.header-language-option:last-child {
    border-radius: 0 0 8px 8px;
}

.header-language-option.active {
    background-color: #e3f2fd;
    color: var(--primary-color);
}

.header-flag-image {
    width: 20px;
    height: 15px;
    border-radius: 2px;
}

.header-lang-name {
    flex-grow: 1;
    color: #333 !important;
    font-weight: 500;
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
    font-size: 0.9rem !important;
    line-height: 1.4;
}

/* Language option alignment based on page direction */
[dir="rtl"] .header-language-option {
    text-align: right;
    direction: rtl;
}

[dir="ltr"] .header-language-option {
    text-align: left;
    direction: ltr;
}

[dir="rtl"] .header-lang-name {
    text-align: right;
}

[dir="ltr"] .header-lang-name {
    text-align: left;
}

.header-language-option .fas {
    color: var(--primary-color);
    font-size: 0.8rem;
}

/* Removed fallback checkmark since Font Awesome is loaded */

.logout-button {
    background-color: #f0f4f8;
    color: var(--primary-color);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 20px; /* Pill shape */
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s ease-in-out;
}

.logout-button:hover {
    background-color: #e3eaf2;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.07);
}

/* --- Admin Page Enhancements --- */

/* 1. Make the main card wider */
.card.card-wide {
    width: 95%;
    max-width: 1200px; /* Limit max width on very large screens */
    margin: 0 auto;
    text-align: right; /* Override center alignment for the table */
}

/* 2. Modern table styles */
.clients-table {
    border-collapse: collapse;
    width: 100%;
    margin-top: 1.5rem;
    font-size: 0.95rem;
}
.clients-table th, .clients-table td {
    text-align: right;
    padding: 12px 15px;
    /* The border is now applied to the <tr> element for consistency */
}
.clients-table thead tr {
    border-bottom: 2px solid #d0d0d0; /* Thicker border for header */
}
.clients-table tbody tr {
    border-bottom: 1px solid #e0e0e0;
}
.clients-table th {
    background-color: #f7f7f7;
    font-weight: 500;
    color: #333;
}
.clients-table tbody tr:hover {
    background-color: #f0f5ff;
}
.clients-table tbody tr.row-updated {
    background-color: #e6fffa; /* A light teal */
    transition: background-color 0.5s ease-in-out;
}
.clients-table .actions-column {
    width: 120px; /* A more appropriate fixed width for the actions column */
    text-align: right; /* Align header text to the right */
    white-space: nowrap; /* Prevent wrapping */
}
.clients-table .actions-cell {
    display: flex;
    gap: 15px; /* Space between icons */
    align-items: center;
    /* In RTL, flex-end aligns items to the left */
    justify-content: flex-end;
}
.clients-table .action-icon {
    cursor: pointer;
    border: none;
    background: none;
    padding: 5px;
    display: inline-flex;
}
.clients-table .action-icon svg {
    width: 20px;
    height: 20px;
    fill: #555;
    transition: fill 0.2s ease-in-out, transform 0.2s ease-in-out;
}
.clients-table .action-icon:hover svg {
    fill: var(--primary-color);
    transform: scale(1.1);
}
.clients-table .action-icon.delete-item-btn:hover svg {
    fill: var(--secondary-color); /* Red for delete */
}


/* Card Header for buttons */
.card-header {
    /* The header now only contains the title */
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #e9ecef;
}
.card-header h2 {
    margin: 0;
}
.controls-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

/* Search/Filter Box Styles */
.search-container {
    /* margin-bottom is no longer needed here as it's part of the header */
    position: relative;
    width: 350px; /* Give it a more controlled width inside the flex container */
}

.search-container .search-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);    
    width: 20px;
    height: 20px;
    fill: #aaa;
    flex-shrink: 0; /* Prevent icon from growing/shrinking in flex layout */
}

.search-container input {
    width: 100%;
    padding: 10px 45px 10px 15px; /* Padding for icon */
    font-size: 1rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-container input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(13, 71, 161, 0.1);
}

/* 3. Modal (Popup) Styles */
.modal {
    display: none; position: fixed; z-index: 1000; left: 0; top: 0;
    width: 100%; height: 100%; overflow: auto; background-color: rgba(0,0,0,0.5);
    animation: fadeIn 0.3s;
}
.modal-content {
    background-color: #fefefe; margin: 10% auto; padding: 25px 30px;
    border: 1px solid #888; width: 80%; max-width: 600px;
    border-radius: 8px; position: relative; box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    animation: slideIn 0.3s;
}
.close-button {
    color: #aaa; position: absolute; left: 15px; top: 10px;
    font-size: 28px; font-weight: bold; transition: color 0.2s;
}
.modal-content.modal-sm {
    max-width: 400px; /* Smaller modal for confirmations */
    text-align: center;
}

.modal-actions {
    margin-top: 1.5rem;
    display: flex;
    justify-content: center;
    gap: 1rem;
}

/* Button variations */
.button-danger {
    background-color: var(--secondary-color);
}

.button-secondary {
    background-color: #f0f4f8;
    color: var(--text-color);
    border: 1px solid #e0e6ed;
}

.button-secondary:hover {
    background-color: #e3eaf2;
}
.close-button:hover, .close-button:focus {
    color: black; text-decoration: none; cursor: pointer;
}
@keyframes fadeIn { from {opacity: 0;} to {opacity: 1;} }
@keyframes slideIn { from {transform: translateY(-50px);} to {transform: translateY(0);} }

/* Form styles for modals */
.modal-content form {
    margin-top: 1.5rem;
}

.modal-content .form-group {
    margin-bottom: 1rem;
    text-align: right;
}

.modal-content .form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.modal-content .form-group input,
.modal-content .form-group select {
    width: 100%;
    padding: 10px;
    font-size: 1rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}

.modal-content .form-group input:focus,
.modal-content .form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(13, 71, 161, 0.1);
}

.modal-content form button {
    width: 100%;
    margin-top: 1rem;
}

.form-message {
    margin-top: 1rem;
    padding: 12px;
    border-radius: 6px;
    text-align: center;
}

.form-group-checkbox {
    margin-top: 1.5rem;
}

.form-group-checkbox label {
    display: flex;
    align-items: center;
    gap: 10px; /* Space between checkbox and text */
    cursor: pointer;
    font-weight: normal; /* Use normal font weight for this type of label */
    margin-bottom: 0;
}

.form-group-checkbox input[type="checkbox"] {
    width: auto; /* Override the default 100% width for inputs */
    margin: 0;
}

/* Fix for telephone input field alignment in RTL modals */
.modal-content form input[type="tel"] {
    text-align: right;
}

.required-asterisk {
    color: var(--secondary-color);
    font-weight: bold;
    margin-right: 3px;
}

.readonly-input {
    background-color: #f0f4f8; /* A light grey-blue */
    cursor: not-allowed;
}
.no-results-message {
    text-align: center;
    padding: 2rem;
    color: #666;
    font-style: italic;
    background-color: #f9f9f9 !important;
}

/* --- Main Navigation Menu --- */
.menu-toggle-btn {
    background: transparent !important; /* Force override of default button styles */
    border: none;
    color: var(--text-color); /* Changed from white to be visible on the header */
    cursor: pointer;
    padding: 0;
    margin-left: 15px; /* Spacing between button and logo */
    width: 24px;
    height: 24px;
    display: inline-flex; /* Helps with SVG alignment */
    align-items: center;
    justify-content: center;
}

.menu-toggle-btn svg {
    width: 100%;
    height: 100%;
}

.main-nav {
    position: fixed;
    top: 0;
    width: 280px;
    height: 100%;
    background-color: #fff;
    z-index: 1001; /* Above overlay */
    visibility: hidden; /* Start fully hidden for accessibility and to prevent interaction */
    padding-top: 60px;
}

/* RTL (Hebrew) - menu slides from right */
[dir="rtl"] .main-nav {
    right: -280px; /* Start off-screen for the slide effect */
    box-shadow: -2px 0 5px rgba(0,0,0,0.2);
    transition: right 0.3s ease-in-out, visibility 0s 0.3s;
    direction: rtl;
    text-align: right;
}

[dir="rtl"] .main-nav.open {
    right: 0; /* Slide in */
    visibility: visible;
    transition: right 0.3s ease-in-out;
}

/* LTR (English) - menu slides from left */
[dir="ltr"] .main-nav {
    left: -280px; /* Start off-screen for the slide effect */
    box-shadow: 2px 0 5px rgba(0,0,0,0.2);
    transition: left 0.3s ease-in-out, visibility 0s 0.3s;
    direction: ltr;
    text-align: left;
}

[dir="ltr"] .main-nav.open {
    left: 0; /* Slide in */
    visibility: visible;
    transition: left 0.3s ease-in-out;
}

.menu-close-btn {
    position: absolute;
    top: 15px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 5px;
    width: 30px;
    height: 30px;
    z-index: 1002; /* Above nav content */
}

/* RTL (Hebrew) - close button on the left */
[dir="rtl"] .menu-close-btn {
    left: 15px;
}

/* LTR (English) - close button on the right */
[dir="ltr"] .menu-close-btn {
    right: 15px;
}
.menu-close-btn svg {
    width: 100%;
    height: 100%;
    fill: #555;
    transition: transform 0.2s ease-in-out, fill 0.2s ease-in-out;
}
.menu-close-btn:hover svg {
    transform: scale(1.1);
    fill: var(--secondary-color);
}

.main-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.main-nav ul li a {
    display: block;
    padding: 15px 20px;
    color: #333;
    text-decoration: none;
    font-size: 1.1rem;
    border-bottom: 1px solid #eee;
    transition: background-color 0.2s;
}

/* RTL (Hebrew) - menu items align right */
[dir="rtl"] .main-nav ul li a {
    text-align: right;
    direction: rtl;
}

/* LTR (English) - menu items align left */
[dir="ltr"] .main-nav ul li a {
    text-align: left;
    direction: ltr;
}

.main-nav ul li a:hover {
    background-color: #f5f5f5;
}

.main-nav ul li a.active {
    background-color: #e3eaf2; /* A light grey-blue, similar to hover states */
    font-weight: 700; /* Make it bold */
    color: var(--primary-color);
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    font-size: 0.9rem;
}

.history-table th,
.history-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #e9ecef;
    text-align: right;
}

.history-table th {
    background-color: #f8f9fa;
    font-weight: 500;
}

.main-nav ul li a.logout-link {
    color: var(--secondary-color); /* Use theme variable */
}

.nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
}

.nav-overlay.open {
    opacity: 1;
    visibility: visible;
}

/* --- Responsive Adjustments for Admin & Management Pages --- */
@media (max-width: 768px) {
    /* Reduce body font size slightly for better fit */
    body {
        font-size: 15px;
    }

    /* Reduce main padding on smaller screens */
    main {
        padding: 1rem;
    }

    /* Make the main card take up more space and reduce padding */
    .card.card-wide { padding: 1rem; }

    /* Adjust header controls for small screens */
    .controls-bar {
        flex-direction: column; /* Stack controls vertically */
        align-items: stretch;   /* Make them full-width */
        gap: 1rem;
    }

    .search-container {
        width: 100%; /* Search takes full width */
    }

    .controls-bar .button-primary {
        width: 100%;
        text-align: center;
    }

    /*
     * IMPORTANT: For tables to be responsive on mobile,
     * wrap them in a div with this class: <div class="table-responsive">...</div>
    */
    /* Make table scrollable on small screens */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
        border: 1px solid #e9ecef;
        border-radius: 6px;
    }
    .table-responsive .clients-table {
        width: 100%;
        min-width: 600px; /* Force scrollbar if table content is wide */
    }

    /* Override for narrow tables that don't need horizontal scroll */
    .table-responsive .clients-table.table-narrow {
        min-width: 100%;
    }


    /* Adjust header for smaller screens to prevent crowding */
    .main-header h1 {
        font-size: 1.2rem;
    }
    .user-info span {
        display: none; /* Hide the "Hello, Name" text to save space */
    }
    
    /* Ensure menu toggle button is styled correctly and not a blue square */
    .menu-toggle-btn {
        background-color: transparent !important;
        padding: 0;
    }

    /* Improve modal appearance on mobile */
    .modal-content {
        width: 90%;
        margin: 5% auto; /* Reduce top margin */
        padding: 20px;
    }
    .modal-content.modal-sm { max-width: 90%; }

}

@media (max-width: 480px) {
    /* Further adjustments for very small screens */
    /* Further reduce padding and font sizes for very small screens */
    main {
        padding: 0.75rem;
    }
    .card.card-wide {
        padding: 0.75rem;
    }
    .card-header h2, .login-card h2 { font-size: 1.5rem; }
}

/* --- Dashboard Page (dashboard.php) --- */
.client-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    padding: 1.5rem 0;
    text-align: right;
    font-size: 1.1rem;
}

.client-details-grid div {
    background-color: #f9f9f9;
    padding: 1rem;
    border-radius: 6px;
    border-right: 4px solid var(--primary-color); /* For RTL */
}

.client-details-grid .washes-left {
    grid-column: 1 / -1; /* Span full width */
    background-color: #e3eaf2;
    font-weight: 700;
    font-size: 1.3rem;
    text-align: center;
}

.client-actions-bar {
    margin: 1.5rem 0; /* Add vertical margin */
    text-align: center;
}

.waiting-message {
    font-size: 1.2rem;
    color: #555;
    padding: 3rem 1rem;
    text-align: center;
    font-style: italic;
}

/* Login Links Styles */
.login-links {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #e0e0e0;
}

.forgot-password-link {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s ease;
}

.forgot-password-link:hover {
    color: var(--secondary-color);
    text-decoration: underline;
}

/* Success and Error Message Styles */
.success-message, .error-message {
    text-align: center;
    padding: 2rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.success-message {
    background-color: #f0f9f0;
    border: 1px solid #4caf50;
    color: #2e7d32;
}

.error-message {
    background-color: #fff2f2;
    border: 1px solid #f44336;
    color: #c62828;
}

.success-message i, .error-message i {
    font-size: 2rem;
    margin-bottom: 1rem;
    display: block;
}

.success-message p, .error-message p {
    margin: 0.5rem 0;
    font-size: 1rem;
}

.form-description {
    text-align: center;
    color: #666;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
    line-height: 1.4;
}

.form-help {
    font-size: 0.85rem;
    color: #666;
    margin-top: 0.5rem;
    text-align: center;
}