/* German Date Picker Styles */

/* Wrapper for date picker */
.german-datepicker-wrapper {
    position: relative;
    width: 100%;
    display: inline-block;
}

/* Hide the original native date input by default */
.german-datepicker-wrapper input[type="date"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 1px;
    height: 1px;
    left: -9999px;
    top: -9999px;
    z-index: -1;
    /* Don't use visibility:hidden as it prevents showPicker() from working */
}

/* Text input for German date format */
.german-datepicker-text {
    width: 100%;
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    background-color: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 0.375rem;
    color: #111827;
    font-size: 1rem;
    transition: all 0.2s;
    cursor: pointer;
    box-sizing: border-box;
}

/* Focus state */
.german-datepicker-text:focus {
    outline: none;
    border-color: #3b82f6;
    background-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Hover state */
.german-datepicker-text:hover {
    border-color: #d1d5db;
    background-color: #ffffff;
}

/* Invalid state */
.german-datepicker-text.wpcf7-not-valid {
    border-color: #ef4444 !important;
    background-color: #fef2f2 !important;
}

/* Calendar icon button */
.german-datepicker-icon {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    transition: color 0.2s;
    z-index: 1;
}

.german-datepicker-icon:hover {
    color: #111827;
}

.german-datepicker-icon:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
    border-radius: 0.25rem;
}

.german-datepicker-icon svg {
    width: 20px;
    height: 20px;
}

/* Error message styling */
.german-datepicker-wrapper .wpcf7-not-valid-tip {
    color: #ef4444;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    display: block;
    font-weight: 500;
}

/* Modal form specific styles */
#modal .german-datepicker-text,
#paypal .german-datepicker-text {
    background-color: #f9fafb;
    border: 2px solid #e5e7eb;
}

#modal .german-datepicker-text:focus,
#paypal .german-datepicker-text:focus {
    background-color: #ffffff;
    border-color: #3b82f6;
}

/* Mobile optimizations */
@media (max-width: 640px) {
    .german-datepicker-text {
        padding: 0.875rem 2.5rem 0.875rem 1rem;
        font-size: 1rem; /* Prevent iOS zoom */
        min-height: 48px;
    }
    
    .german-datepicker-icon {
        right: 0.75rem;
        padding: 0.5rem;
        min-width: 44px;
        min-height: 44px;
    }
    
    .german-datepicker-icon svg {
        width: 24px;
        height: 24px;
    }
}

/* Very small screens */
@media (max-width: 374px) {
    .german-datepicker-text {
        font-size: 0.9375rem;
    }
    
    .german-datepicker-icon {
        min-width: 40px;
        min-height: 40px;
    }
    
    .german-datepicker-icon svg {
        width: 20px;
        height: 20px;
    }
}

/* Placeholder styling */
.german-datepicker-text::placeholder {
    color: #9ca3af;
    opacity: 1;
}

.german-datepicker-text::-webkit-input-placeholder {
    color: #9ca3af;
}

.german-datepicker-text::-moz-placeholder {
    color: #9ca3af;
}

.german-datepicker-text:-ms-input-placeholder {
    color: #9ca3af;
}

/* Disabled state */
.german-datepicker-text:disabled {
    background-color: #f3f4f6;
    color: #9ca3af;
    cursor: not-allowed;
}

.german-datepicker-text:disabled + .german-datepicker-icon {
    color: #9ca3af;
    cursor: not-allowed;
}

/* Loading state (optional) */
.german-datepicker-wrapper.loading .german-datepicker-icon {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: translateY(-50%) rotate(0deg);
    }
    to {
        transform: translateY(-50%) rotate(360deg);
    }
}

/* Print styles */
@media print {
    .german-datepicker-icon {
        display: none;
    }
    
    .german-datepicker-text {
        border: 1px solid #000;
        background: #fff;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .german-datepicker-text {
        border-width: 2px;
        border-color: currentColor;
    }
    
    .german-datepicker-text:focus {
        outline: 3px solid currentColor;
        outline-offset: 2px;
    }
}

/* Dark mode support (if theme supports it) */
@media (prefers-color-scheme: dark) {
    .german-datepicker-text {
        background-color: #374151;
        border-color: #4b5563;
        color: #f9fafb;
    }
    
    .german-datepicker-text:focus {
        background-color: #1f2937;
        border-color: #60a5fa;
    }
    
    .german-datepicker-text::placeholder {
        color: #6b7280;
    }
    
    .german-datepicker-icon {
        color: #9ca3af;
    }
    
    .german-datepicker-icon:hover {
        color: #f9fafb;
    }
}

/* Accessibility: Reduce motion */
@media (prefers-reduced-motion: reduce) {
    .german-datepicker-text,
    .german-datepicker-icon {
        transition: none;
    }
    
    .german-datepicker-wrapper.loading .german-datepicker-icon {
        animation: none;
    }
}

/* Focus visible for keyboard navigation */
.german-datepicker-text:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.german-datepicker-icon:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
    border-radius: 0.25rem;
}

/* Ensure proper stacking context */
.german-datepicker-wrapper {
    z-index: 1;
}

/* Control group integration */
.control-group .german-datepicker-wrapper,
.form-group .german-datepicker-wrapper {
    width: 100%;
}

/* Flex layout compatibility */
.control-group .controls .german-datepicker-wrapper,
.form-group .controls .german-datepicker-wrapper {
    flex: 1;
}

