/* Base Container Styling */
.contact-reveal-container {
    background: #2d2d2d;
    border-radius: 6px;
    padding: 20px;
    max-width: 480px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, "Noto Sans Hebrew", sans-serif;
    direction: rtl;
    position: relative;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}

/* Language-specific styling */
.contact-reveal-container[data-lang="en"] {
    direction: ltr;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

.contact-reveal-container[data-lang="he"] {
    direction: rtl;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, "Noto Sans Hebrew", sans-serif;
}

/* Category styling */
.contact-category {
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

.contact-category:last-child {
    margin-bottom: 0;
}

.contact-category:hover {
    transform: translateY(-1px);
}

.category-title {
    color: #ffffff !important;
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 10px 0;
    padding-bottom: 5px;
    text-align: right;
    direction: rtl;
    position: relative;
    background: linear-gradient(90deg, transparent 0%, #4da6ff 20%, #4da6ff 80%, transparent 100%);
    background-size: 100% 2px;
    background-repeat: no-repeat;
    background-position: bottom;
    border-bottom: none;
}

/* Language-specific category title alignment */
.contact-reveal-container[data-lang="en"] .category-title {
    text-align: left;
    direction: ltr;
}

/* Force white color for category titles */
.contact-reveal-container .category-title,
.contact-reveal-container h3.category-title,
.contact-category .category-title {
    color: #ffffff !important;
}

/* Category separator styling */
.contact-category + .contact-category {
    padding-top: 8px;
    border-top: 1px solid #444;
}

/* Contact Item Styling */
.contact-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #3a3a3a;
    transition: all 0.3s ease;
}

.contact-category .contact-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.contact-item:hover {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 4px;
    padding: 8px 8px;
    margin: 0 -8px;
}

/* Contact Info */
.contact-info {
    flex: 1;
}

.contact-name {
    color: #ffffff;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 2px;
    text-align: right;
    line-height: 1.3;
}

/* Language-specific name alignment */
.contact-reveal-container[data-lang="en"] .contact-name {
    text-align: left;
}

.contact-position {
    display: none; /* Hide position field */
}

/* Email Section */
.contact-email-section {
    flex-shrink: 0;
    min-width: 140px;
    text-align: left;
}

/* Language-specific email section alignment */
.contact-reveal-container[data-lang="en"] .contact-email-section {
    text-align: right;
}

/* Reveal Email Button */
.reveal-email-btn {
    background: #4da6ff;
    color: white;
    border: none;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 500;
    transition: all 0.3s ease;
    direction: rtl;
    white-space: nowrap;
}

/* Language-specific button direction */
.contact-reveal-container[data-lang="en"] .reveal-email-btn {
    direction: ltr;
}

.reveal-email-btn:hover {
    background: #3d96ef;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(77, 166, 255, 0.3);
}

.reveal-email-btn:active {
    transform: translateY(0);
}

.reveal-email-btn:disabled {
    background: #666;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Loading state */
.reveal-email-btn.loading {
    background: #666;
    cursor: wait;
}

.reveal-email-btn.loading::after {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
    margin-right: 5px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Email Display */
.email-display {
    display: flex;
    column-gap: 6px;
    align-items: center;
}

.email-link-container {
    background: #1a1a1a;
    border: 1px solid #4da6ff;
    border-radius: 4px;
    padding: 6px 10px;
    min-width: 160px;
    text-align: center;
    direction: ltr;
    transition: all 0.3s ease;
    cursor: pointer;
}

.email-link-container:hover {
    border-color: #3d96ef;
    box-shadow: 0 0 0 2px rgba(77, 166, 255, 0.2);
}

.email-link-container:hover .email-link {
    color: #3d96ef !important;
}

.email-link {
    color: #4da6ff !important;
    text-decoration: none;
    font-size: 12px;
    font-family: 'Courier New', monospace;
    transition: all 0.3s ease;
}

.email-link:hover {
    color: #3d96ef !important;
    text-decoration: underline;
}

.email-link:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(77, 166, 255, 0.3);
}

/* Email Input (backwards compatibility) */
.email-input {
    background: #1a1a1a;
    border: 1px solid #4da6ff;
    color: #4da6ff;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 13px;
    font-family: 'Courier New', monospace;
    min-width: 200px;
    text-align: center;
    direction: ltr;
}

.email-input:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(77, 166, 255, 0.3);
}

/* Copy Email Button */
.copy-email-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.copy-email-btn:hover {
    background: #218838;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
}

.copy-email-btn:active {
    transform: translateY(0);
}

/* Success states */
.copy-email-btn.copied {
    background: #17a2b8;
}

.copy-email-btn.copied::after {
    content: ' ✓';
}

/* Error states */
.contact-item.error .reveal-email-btn {
    background: #dc3545;
}

.contact-item.error .reveal-email-btn:hover {
    background: #c82333;
}

/* Success visual feedback */
.contact-item.success {
    background: rgba(40, 167, 69, 0.1);
    border-radius: 4px;
    padding: 8px 8px;
    margin: 0 -8px;
}

/* Dark theme enhancements */
.contact-reveal-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(77, 166, 255, 0.05) 0%, rgba(77, 166, 255, 0.02) 100%);
    border-radius: 8px;
    pointer-events: none;
}

/* Toast Notifications */
.contact-reveal-toast {
    position: fixed;
    top: 20px;
    background: #2d2d2d;
    color: white;
    padding: 12px 20px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 10000;
    font-size: 14px;
    max-width: 300px;
    direction: rtl;
}

.contact-reveal-toast-error {
    border-left: 4px solid #dc3545;
}

.contact-reveal-toast-success {
    border-left: 4px solid #28a745;
}

.contact-reveal-toast-info {
    border-left: 4px solid #4da6ff;
}

/* Toast positioning for English */
.contact-reveal-toast[style*="left: 20px"] {
    left: 20px !important;
    right: auto !important;
    direction: ltr;
}

/* Accessibility */
.reveal-email-btn:focus,
.copy-email-btn:focus,
.email-input:focus,
.email-link:focus {
    outline: 2px solid #4da6ff;
    outline-offset: 2px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .contact-reveal-container {
        padding: 15px;
        margin: 0 10px;
        max-width: 100%;
    }
    
    .contact-item {
        flex-direction: column;
        align-items: flex-start;
        row-gap: 8px;
    }
    
    .contact-email-section {
        width: 100%;
        text-align: right;
    }
    
    /* Language-specific mobile alignment */
    .contact-reveal-container[data-lang="en"] .contact-email-section {
        text-align: left;
    }
    
    .email-display {
        justify-content: flex-end;
    }
    
    /* Language-specific mobile email display */
    .contact-reveal-container[data-lang="en"] .email-display {
        justify-content: flex-start;
    }
    
    .email-input,
    .email-link-container {
        min-width: 140px;
        flex: 1;
    }
    
    .category-title {
        font-size: 14px;
        margin-bottom: 8px;
    }
    
    .contact-category {
        margin-bottom: 15px;
    }
}

/* Mobile responsive improvements for categories */
@media (max-width: 480px) {
    .contact-reveal-container {
        padding: 12px;
    }
    
    .category-title {
        font-size: 13px;
        margin-bottom: 6px;
        padding-bottom: 4px;
    }
    
    .contact-category {
        margin-bottom: 12px;
    }
    
    .contact-item {
        padding: 6px 0;
    }
    
    .email-link-container {
        min-width: 120px;
    }
    
    .contact-name {
        font-size: 13px;
    }
}

/* Language-specific responsive adjustments */
@media (max-width: 768px) {
    .contact-reveal-container.mobile-view {
        /* Additional mobile styles can be added here */
    }
    
    .contact-reveal-container[data-lang="en"].mobile-view .contact-email-section {
        text-align: left;
    }
    
    .contact-reveal-container[data-lang="he"].mobile-view .contact-email-section {
        text-align: right;
    }
}

/* High DPI / Retina Display Support */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .contact-reveal-container {
        box-shadow: 0 1px 6px rgba(0, 0, 0, 0.15);
    }
    
    .reveal-email-btn:hover,
    .copy-email-btn:hover {
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
    }
}

/* Print Styles */
@media print {
    .contact-reveal-container {
        background: white !important;
        color: black !important;
        box-shadow: none !important;
        border: 1px solid #ccc;
    }
    
    .category-title {
        color: black !important;
        border-bottom: 1px solid #ccc !important;
        background: none !important;
    }
    
    .contact-name {
        color: black !important;
    }
    
    .reveal-email-btn,
    .copy-email-btn {
        display: none !important;
    }
    
    .email-display {
        display: block !important;
    }
    
    .email-link {
        color: black !important;
        text-decoration: underline !important;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .contact-reveal-container,
    .contact-category,
    .contact-item,
    .reveal-email-btn,
    .copy-email-btn,
    .email-link-container {
        transition: none !important;
        animation: none !important;
        transform: none !important;
    }
    
    .reveal-email-btn.loading::after {
        animation: none !important;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .contact-reveal-container {
        border: 2px solid #ffffff;
        background: #000000;
    }
    
    .category-title {
        border-bottom: 2px solid #ffffff !important;
        background: none !important;
    }
    
    .contact-item {
        border-bottom: 1px solid #ffffff;
    }
    
    .reveal-email-btn {
        border: 2px solid #ffffff;
    }
    
    .email-link-container {
        border: 2px solid #ffffff;
    }
}

/* Dark Mode Preference Support */
@media (prefers-color-scheme: dark) {
    .contact-reveal-container {
        background: #1a1a1a;
        border: 1px solid #333;
    }
    
    .contact-item {
        border-bottom-color: #333;
    }
    
    .category-title {
        color: #ffffff !important;
    }
}

/* Focus Visible Support */
.reveal-email-btn:focus-visible,
.copy-email-btn:focus-visible,
.email-link:focus-visible {
    outline: 2px solid #4da6ff;
    outline-offset: 2px;
}

/* Selection Styling */
::selection {
    background: #4da6ff;
    color: white;
}

::-moz-selection {
    background: #4da6ff;
    color: white;
}

/* Scrollbar Styling for containers with overflow */
.contact-reveal-container::-webkit-scrollbar {
    width: 6px;
}

.contact-reveal-container::-webkit-scrollbar-track {
    background: #2d2d2d;
}

.contact-reveal-container::-webkit-scrollbar-thumb {
    background: #4da6ff;
    border-radius: 3px;
}

.contact-reveal-container::-webkit-scrollbar-thumb:hover {
    background: #3d96ef;
}

/* Advanced Language Support */
.contact-reveal-container[data-lang="en"] {
    text-align: left;
}

.contact-reveal-container[data-lang="he"] {
    text-align: right;
}

.contact-reveal-container[data-lang="ar"] {
    direction: rtl;
    text-align: right;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, "Noto Sans Arabic", sans-serif;
}

/* Performance Optimizations */
.contact-reveal-container * {
    box-sizing: border-box;
}

.contact-reveal-container {
    will-change: transform;
    contain: layout style;
}

/* Animation Performance */
.reveal-email-btn,
.copy-email-btn,
.contact-item {
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Custom Properties for Theme Customization */
.contact-reveal-container {
    --primary-color: #4da6ff;
    --primary-hover: #3d96ef;
    --success-color: #28a745;
    --success-hover: #218838;
    --error-color: #dc3545;
    --error-hover: #c82333;
    --background-color: #2d2d2d;
    --text-color: #ffffff;
    --border-color: #3a3a3a;
    --input-background: #1a1a1a;
}

/* Using custom properties */
.reveal-email-btn {
    background: var(--primary-color);
}

.reveal-email-btn:hover {
    background: var(--primary-hover);
}

.copy-email-btn {
    background: var(--success-color);
}

.copy-email-btn:hover {
    background: var(--success-hover);
}

.contact-item.error .reveal-email-btn {
    background: var(--error-color);
}

.contact-item.error .reveal-email-btn:hover {
    background: var(--error-hover);
}