/* QR Code Generator - Custom Styles */

/* Leaflet map container fix */
.leaflet-container {
    height: 100%;
    width: 100%;
}

/* Improved button hover states for better UX */
.type-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

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

/* Enhanced color picker styling */
input[type="color"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background: transparent;
    cursor: pointer;
}

input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 6px;
}

input[type="color"]::-moz-color-swatch {
    border: none;
    border-radius: 6px;
}

/* Color preset button animations */
.color-preset {
    transition: all 0.2s ease;
}

.color-preset:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.color-preset:active {
    transform: scale(1.05);
}

/* Ensure hidden class works properly */
.hidden {
    display: none !important;
}

/* Form input focus states */
input:focus,
textarea:focus,
select:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgb(59 130 246);
    border-color: rgb(59 130 246);
}

/* Loading spinner animation */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* Mobile optimizations */
@media (max-width: 640px) {
    /* Ensure touch targets are at least 44px */
    .touch-manipulation {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Better spacing on mobile */
    .type-button {
        padding: 12px;
    }
    
    /* Improved color picker sizing */
    .color-preset {
        width: 32px;
        height: 32px;
    }
    
    /* Better button padding */
    button {
        padding: 12px 16px;
    }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    .type-button,
    .color-preset,
    * {
        transition: none !important;
        animation: none !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .type-button {
        border-width: 3px;
    }
    
    .color-preset {
        border-width: 3px;
    }
}

/* Dark mode support (for future enhancement) */
@media (prefers-color-scheme: dark) {
    /* Reserved for future dark mode implementation */
}

/* Print styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
}

/* Language selector styling */
#language-select {
    min-width: 140px;
}

#language-select option {
    padding: 8px;
}

/* Map container responsive sizing */
#location-map {
    min-height: 200px;
    max-height: 400px;
}

@media (max-width: 640px) {
    #location-map {
        height: 200px;
    }
}

/* Better focus indicators for accessibility */
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 2px solid rgb(59 130 246);
    outline-offset: 2px;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Better text selection */
::selection {
    background-color: rgb(59 130 246);
    color: white;
}

/* Custom scrollbar for webkit browsers */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* Improved form layout spacing */
.form-section {
    margin-bottom: 1.5rem;
}

.form-section:last-child {
    margin-bottom: 0;
}

/* Better visual hierarchy */
.section-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: rgb(55 65 81);
}

/* Enhanced button states */
.btn-primary {
    background-color: rgb(37 99 235);
    transition: all 0.2s ease;
}

.btn-primary:hover {
    background-color: rgb(29 78 216);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}

/* Error and success states */
.error-message {
    color: rgb(220 38 38);
    background-color: rgb(254 242 242);
    border: 1px solid rgb(252 165 165);
    padding: 12px;
    border-radius: 8px;
    margin-top: 8px;
}

.success-message {
    color: rgb(22 163 74);
    background-color: rgb(240 253 244);
    border: 1px solid rgb(134 239 172);
    padding: 12px;
    border-radius: 8px;
    margin-top: 8px;
}

/* RTL (Right-to-Left) Language Support */
[dir="rtl"] {
    text-align: right;
}

[dir="rtl"] .flex {
    flex-direction: row-reverse;
}

[dir="rtl"] .justify-between {
    flex-direction: row-reverse;
}

[dir="rtl"] .space-x-3 > * + * {
    margin-left: 0;
    margin-right: 0.75rem;
}

[dir="rtl"] .space-x-4 > * + * {
    margin-left: 0;
    margin-right: 1rem;
}

[dir="rtl"] .grid {
    direction: rtl;
}

[dir="rtl"] .grid > * {
    text-align: right;
}

[dir="rtl"] input, [dir="rtl"] textarea, [dir="rtl"] select {
    text-align: right;
    direction: rtl;
}

[dir="rtl"] .text-left {
    text-align: right;
}

[dir="rtl"] .text-right {
    text-align: left;
}

[dir="rtl"] .ml-2 {
    margin-left: 0;
    margin-right: 0.5rem;
}

[dir="rtl"] .ml-4 {
    margin-left: 0;
    margin-right: 1rem;
}

[dir="rtl"] .mr-2 {
    margin-right: 0;
    margin-left: 0.5rem;
}

[dir="rtl"] .mr-3 {
    margin-right: 0;
    margin-left: 0.75rem;
}

[dir="rtl"] .mr-4 {
    margin-right: 0;
    margin-left: 1rem;
}

/* Language selector positioning for RTL */
[dir="rtl"] .relative {
    direction: ltr; /* Keep language selector LTR */
}

[dir="rtl"] #language-select {
    direction: ltr;
    text-align: left;
}

/* Button and form alignment for RTL */
[dir="rtl"] .type-button {
    text-align: center; /* Keep centered for icons and text */
}

[dir="rtl"] .inline-flex {
    flex-direction: row-reverse;
}

[dir="rtl"] .items-center {
    align-items: center;
}

/* Error box and validation for RTL */
[dir="rtl"] #validation-errors {
    direction: rtl;
    text-align: right;
}

[dir="rtl"] #validation-errors .flex {
    flex-direction: row-reverse;
}

[dir="rtl"] #validation-errors .items-start {
    align-items: flex-start;
}

/* Map and location features for RTL */
[dir="rtl"] #location-map {
    direction: ltr; /* Keep map LTR for consistency */
}

[dir="rtl"] .leaflet-container {
    direction: ltr;
}

/* Color picker layout for RTL */
[dir="rtl"] .color-preset {
    direction: ltr; /* Keep color swatches in normal order */
}

/* Preserve normal direction for technical elements */
[dir="rtl"] input[type="color"],
[dir="rtl"] input[type="number"],
[dir="rtl"] input[type="range"],
[dir="rtl"] input[type="url"],
[dir="rtl"] input[type="email"],
[dir="rtl"] input[type="tel"] {
    direction: ltr;
    text-align: left;
}

/* Improved QR result display */
#result img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease;
}

#result img:hover {
    transform: scale(1.02);
}

/* Download link styling */
#result a {
    display: inline-block;
    margin-top: 16px;
    padding: 12px 24px;
    background-color: rgb(34 197 94);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease;
}

#result a:hover {
    background-color: rgb(22 163 74);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}
