/**
 * LIGHTCAT Invoice UI Improvements CSS
 * Clean, professional, and mobile-optimized styles
 */

/* Invoice Input Styles */
#rgbInvoice {
    width: 100%;
    padding: 14px;
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 215, 0, 0.3);
    border-radius: 8px;
    color: white;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

#rgbInvoice:focus {
    outline: none;
    border-color: var(--yellow);
    box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.15);
    background: rgba(0, 0, 0, 0.7);
}

#rgbInvoice:valid {
    border-color: rgba(76, 175, 80, 0.5);
}

#rgbInvoice::placeholder {
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.9rem;
}

/* Validation Feedback */
#invoiceValidationFeedback {
    margin-top: 8px;
    font-size: 0.85rem;
    min-height: 20px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

#invoiceValidationFeedback span {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Clipboard Helper Buttons */
.invoice-clipboard-buttons {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

.invoice-clipboard-buttons button {
    padding: 10px 16px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 1px solid;
    min-height: 44px;
}

.invoice-clipboard-buttons button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.invoice-clipboard-buttons button:active {
    transform: translateY(0);
}

.invoice-clipboard-buttons button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Format Helper Box */
.invoice-format-helper {
    margin-top: 16px;
    padding: 14px;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.05), rgba(255, 215, 0, 0.02));
    border: 1px solid rgba(255, 215, 0, 0.2);
    border-radius: 8px;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.85);
}

.invoice-format-helper code {
    display: inline-block;
    margin: 8px 0;
    padding: 6px 12px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 215, 0, 0.2);
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    color: var(--yellow);
    word-break: break-all;
}

/* Progress Indicator */
#invoiceProgressIndicator {
    margin-top: 20px;
    padding: 16px;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.1), rgba(255, 215, 0, 0.05));
    border: 1px solid var(--yellow);
    border-radius: 8px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Spinner Animation */
.spinner,
.button-spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Toast Notifications */
#invoiceToast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 14px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    font-size: 0.9rem;
    font-weight: 500;
    max-width: 90%;
    text-align: center;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translate(-50%, 100%);
        opacity: 0;
    }
    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

/* Invoice Creation Steps */
.invoice-steps {
    display: flex;
    justify-content: space-between;
    margin: 20px 0;
    padding: 0;
    list-style: none;
}

.invoice-step {
    flex: 1;
    text-align: center;
    position: relative;
    padding: 10px;
}

.invoice-step::after {
    content: '';
    position: absolute;
    top: 20px;
    right: -50%;
    width: 100%;
    height: 2px;
    background: rgba(255, 215, 0, 0.2);
}

.invoice-step:last-child::after {
    display: none;
}

.invoice-step.active {
    color: var(--yellow);
}

.invoice-step.active::after {
    background: var(--yellow);
}

.invoice-step.completed {
    color: #4caf50;
}

.invoice-step.completed::after {
    background: #4caf50;
}

.invoice-step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(255, 215, 0, 0.1);
    border: 2px solid rgba(255, 215, 0, 0.3);
    margin-bottom: 8px;
    font-weight: bold;
}

.invoice-step.active .invoice-step-number {
    background: var(--yellow);
    color: black;
    border-color: var(--yellow);
}

.invoice-step.completed .invoice-step-number {
    background: #4caf50;
    color: white;
    border-color: #4caf50;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    #rgbInvoice {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 16px;
        min-height: 52px;
    }
    
    .invoice-clipboard-buttons {
        flex-direction: column;
    }
    
    .invoice-clipboard-buttons button {
        width: 100%;
        min-height: 48px;
        font-size: 0.95rem;
    }
    
    .invoice-format-helper {
        padding: 12px;
        font-size: 0.8rem;
    }
    
    .invoice-format-helper code {
        font-size: 0.75rem;
        padding: 8px;
    }
    
    #invoiceProgressIndicator {
        padding: 14px;
    }
    
    .invoice-steps {
        flex-direction: column;
        gap: 10px;
    }
    
    .invoice-step::after {
        display: none;
    }
    
    #invoiceToast {
        bottom: 60px; /* Account for mobile browser bars */
        max-width: 85%;
        font-size: 0.85rem;
    }
}

/* Tablet Optimizations */
@media (min-width: 769px) and (max-width: 1024px) {
    #rgbInvoice {
        font-size: 15px;
        padding: 14px;
    }
    
    .invoice-clipboard-buttons button {
        min-height: 46px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    #rgbInvoice {
        background: rgba(0, 0, 0, 0.7);
        color: white;
    }
    
    .invoice-format-helper {
        background: rgba(255, 215, 0, 0.03);
    }
}

/* Accessibility Improvements */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    #rgbInvoice {
        border-width: 3px;
    }
    
    #invoiceValidationFeedback {
        font-weight: bold;
    }
    
    .invoice-clipboard-buttons button {
        border-width: 2px;
    }
}

/* Focus Visible for Keyboard Navigation */
#rgbInvoice:focus-visible,
.invoice-clipboard-buttons button:focus-visible {
    outline: 3px solid var(--yellow);
    outline-offset: 2px;
}

/* Loading State for Buttons */
button.loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

button.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Success/Error States */
.invoice-success {
    border-color: #4caf50 !important;
    background: rgba(76, 175, 80, 0.05) !important;
}

.invoice-error {
    border-color: #ff6b6b !important;
    background: rgba(255, 107, 107, 0.05) !important;
}

/* Smooth Transitions */
* {
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}