/**
 * Fuchsia Background Colors
 * Provides background color utility classes for fuchsia shades.
 * 
 * @access public
 */
 .bg-fuchsia-300 { 
    --tw-bg-opacity: 1; 
    background-color: rgba(240, 171, 252, var(--tw-bg-opacity)); 
}

.bg-fuchsia-400 { 
    --tw-bg-opacity: 1; 
    background-color: rgba(232, 121, 249, var(--tw-bg-opacity)); 
}

.bg-fuchsia-500 { 
    --tw-bg-opacity: 1; 
    background-color: rgba(217, 70, 239, var(--tw-bg-opacity)); 
}

.bg-fuchsia-600 { 
    --tw-bg-opacity: 1; 
    background-color: rgba(192, 38, 211, var(--tw-bg-opacity)); 
}

.bg-fuchsia-800 { 
    --tw-bg-opacity: 1; 
    background-color: rgba(134, 25, 143, var(--tw-bg-opacity)); 
}

/**
 * #validation-list
 * Removes default styling for lists and ensures proper spacing.
 * 
 * @access public
 */
 #validation-list {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

/**
 * Invalid Select Styles
 * Styles select elements in an invalid state, excluding custom select wrappers.
 * 
 * @access public
 * @selector select:invalid:not([class*="custom-select-wrapper"])
 */
select:invalid:not([class*="custom-select-wrapper"]) {
    color: gray;
    font-size: 0.675rem !important;
    padding-top: 0.75rem !important;
    padding-bottom: 0.75rem !important;
    height: 2.5rem;
}

/**
 * Sector Select Styles
 * Applies specific styles for select elements whose IDs start with "sector" in an invalid state.
 * 
 * @access public
 * @selector select[id^="sector"]:invalid
 */
select[id^="sector"]:invalid {
    color: gray;
    font-size: 0.675rem !important;
    padding-top: 0.75rem !important;
    padding-bottom: 0.75rem !important;
    height: 2.5rem;
}

/**
 * Select Option Styles
 * Ensures consistent font styling for options in select elements.
 * 
 * @access public
 */
select option {
    color: black;
    font-size: 1rem;
}

/**
 * Placeholder Styles for Inputs
 * Sets font size for placeholders across multiple browsers.
 * For some reason, each placeholder has to be explicitly declared.
 * 
 * @access public
 */
 input::-webkit-input-placeholder {
    font-size: 12px !important;
}

input::-moz-placeholder {
    font-size: 12px !important;
}

input:-ms-input-placeholder {
    font-size: 12px !important;
}

input::placeholder {
    font-size: 12px !important;
}

/**
 * Custom Select Wrapper
 * Styles for a custom select wrapper to handle custom dropdown appearance.
 * 
 * @access public
 */
.custom-select-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
}

/**
 * Select Element Inside Custom Select
 * Overrides default appearance and applies custom styling for select elements within the custom wrapper.
 * 
 * @access public
 */
.custom-select-wrapper select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 100%;
    padding: 8px 12px;
    padding-right: 36px;
    font-size: 1rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #fff;
    cursor: pointer;
}

/**
 * Custom Select Dropdown Arrow
 * Adds a dropdown arrow to custom select wrappers.
 * 
 * @access public
 */
.custom-select-wrapper::after {
    content: '▼';
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    pointer-events: none;
    font-size: 0.8rem;
    color: gray;
}

/**
 * Date Input Styling
 * Adds a consistent appearance for date inputs.
 * 
 * @access public
 */
input[type="date"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-color: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding-left: 6px;
    font-size: 1rem;
    color: #333;
    cursor: pointer;
    height: 2.5rem;
}

/**
 * Custom Background for Date Inputs on Touch Devices
 * Adds a calendar icon for date inputs on supported devices.
 * 
 * @access public
 */
@supports (-webkit-touch-callout: none) {
    input[type="date"] {
        background: url('/images/calendar.svg') no-repeat;
        background-repeat: no-repeat;
        background-position: right 12px center;
        background-size: 16px;
        padding-right: 50px;
    }
}

/**
 * Generic Select Styles
 * Applies base styling for select elements.
 * 
 * @access public
 */
select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-color: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 1rem;
    cursor: pointer;
}

/**
 * Validation Feedback Styles
 * Positions and styles validation feedback messages.
 * 
 * @access public
 */
.validation-feedback {
    position: absolute;
    bottom: -1.5rem;
    left: 0;
    font-size: 0.875rem;
    line-height: 1.25rem;
}

/**
 * Error and Valid Styles for Inputs and Selects
 * Differentiates between error and valid states for inputs and selects.
 * 
 * @access public
 */
input.error, select.error {
    border-color: #EF4444;
}

input.valid, select.valid {
    border-color: #10B981;
}

/**
 * Currency Table Cell Padding Override
 * Reduces padding from 0.25rem to 0.1rem to fix phantom padding issue in currency table
 * 
 * @access public
 */
.currency-table td,
.currency-table th {
    padding: 0.20rem !important;
}

/**
 * Checkbox Styling
 * Custom styling for checkboxes to match the footer purple color (fuchsia-800)
 * 
 * @access public
 */
input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 2rem;
    height: 2rem;
    border: 2px solid #d1d5db;
    border-radius: 0.25rem;
    background-color: #ffffff;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease-in-out;
}

input[type="checkbox"]:hover {
    border-color: #9ca3af;
}

input[type="checkbox"]:checked {
    background-color: rgba(134, 25, 143, 1);
    border-color: rgba(134, 25, 143, 1);
}

input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 1rem;
    font-weight: bold;
}

/**
 * Utility Classes
 * Reusable utility classes for hidden elements, fixed positioning, flexbox layout, etc.
 * 
 * @access public
 */
.hidden {
    display: none;
}

.fixed {
    position: fixed;
}

.inset-0 {
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
}

.bg-opacity-50 {
    background-color: rgba(0, 0, 0, 0.5);
}

.flex {
    display: flex;
}

.justify-center {
    justify-content: center;
}

.items-center {
    align-items: center;
}

.max-w-sm {
    max-width: 24rem;
}

.rounded-lg {
    border-radius: 0.5rem;
}

/**
 * Green Background Colors
 * Provides background color utility classes for green shades.
 * 
 * @access public
 */
.bg-green-600 { 
    --tw-bg-opacity: 1; 
    background-color: rgba(34, 197, 94, var(--tw-bg-opacity)); 
}

.bg-green-700 { 
    --tw-bg-opacity: 1; 
    background-color: rgba(21, 128, 61, var(--tw-bg-opacity)); 
}

.hover\:bg-green-700:hover { 
    --tw-bg-opacity: 1; 
    background-color: rgba(21, 128, 61, var(--tw-bg-opacity)); 
}

/**
 * QR Code Display Modal Styles
 * Optimized for large QR code display on iPad
 * 
 * @access public
 */
#qr-share-modal {
    z-index: 9999;
}

#qr-share-modal .bg-white {
    max-width: 95vw;
    max-height: 95vh;
    overflow-y: auto;
    padding: 1rem;
}

#qr-code-image {
    max-width: 85vw !important;
    max-height: 75vh !important;
    width: auto;
    height: auto;
    object-fit: contain;
}

/* iPad specific optimizations */
@media screen and (min-width: 768px) and (max-width: 1024px) {
    #qr-share-modal .bg-white {
        max-width: 98vw;
        max-height: 98vh;
        padding: 0.5rem;
    }
    
    #qr-code-image {
        max-width: 90vw !important;
        max-height: 80vh !important;
    }
}

/* Large iPad Pro optimizations */
@media screen and (min-width: 1024px) {
    #qr-share-modal .bg-white {
        max-width: 90vw;
        max-height: 90vh;
    }
    
    #qr-code-image {
        max-width: 80vw !important;
        max-height: 70vh !important;
    }
}

/**
 * QR Scanner Modal Styles
 * Responsive styles for QR code scanning modal, optimized for iPad
 * 
 * @access public
 */
#qr-scanning-modal {
    z-index: 9999;
}

#qr-scanning-modal .bg-white {
    max-width: 95vw !important;
    max-height: 95vh !important;
    overflow-y: auto;
    margin: 1rem;
    width: auto !important;
}

#scanner-container {
    position: relative !important;
    width: 100% !important;
    max-width: 500px !important;
    height: 400px !important;
    margin: 0 auto !important;
    border: 2px solid #d1d5db;
    border-radius: 8px;
    overflow: hidden;
    background-color: #000;
    aspect-ratio: 1 !important;
}

#qr-scanner-video {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center;
}

#scanner-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

#scanner-overlay > div {
    position: relative;
    border: 2px solid rgba(255, 255, 255, 0.8);
    border-radius: 8px;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
}

#scanner-overlay > div > div {
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border: 2px solid #3b82f6;
    border-radius: 8px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

#scanner-status {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    color: white;
    text-align: center;
    padding: 8px;
    font-size: 14px;
}

/* iPad specific adjustments */
@media screen and (max-width: 1024px) and (orientation: portrait) {
    #qr-scanning-modal .bg-white {
        max-width: 98vw !important;
        margin: 0.5rem !important;
    }
    
    #scanner-container {
        max-width: 70vw !important;
        width: 70vw !important;
        height: 70vw !important;
        min-width: 60vw !important;
        min-height: 60vw !important;
    }
}

@media screen and (max-width: 1024px) and (orientation: landscape) {
    #qr-scanning-modal .bg-white {
        max-width: 95vw !important;
        margin: 0.5rem !important;
    }
    
    #scanner-container {
        max-width: 60vh !important;
        width: 60vh !important;
        height: 60vh !important;
        min-width: 50vh !important;
        min-height: 50vh !important;
    }
}

/* Mobile adjustments */
@media screen and (max-width: 768px) {
    #qr-scanning-modal .bg-white {
        max-width: 98vw !important;
        margin: 0.25rem !important;
        padding: 0.5rem !important;
    }
    
    #scanner-container {
        max-width: 80vw !important;
        width: 80vw !important;
        height: 80vw !important;
        min-width: 70vw !important;
        min-height: 70vw !important;
    }
}

/* Ensure video maintains aspect ratio on all devices */
#qr-scanner-video {
    transform: scale(1);
    transform-origin: center;
}

/* Fix for Safari/iOS video rendering issues */
@supports (-webkit-touch-callout: none) {
    #qr-scanner-video {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
    }
}
