/* Builder: spinner (when Tailwind animate-spin is unavailable) */
@keyframes ei-spin {
    to {
        transform: rotate(360deg);
    }
}
.ei-btn-spinner {
    animation: ei-spin 0.9s linear infinite;
}

/* Utility classes */
.hidden {
    display: none !important;
}

/* Template Card Styles */
.template-card:hover {
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.3);
}

/* Hide the radio buttons (visually only) */
input[type="radio"].template-radio {
    position: absolute;
    opacity: 0;
    visibility: hidden;
}

/* Template Gallery Styles */
.gallery-template-card > div:hover {
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.3);
}



/* Template Preview Styles */
#preview-live.template-standard {
    /* Standard template styles */
    background-color: #ffffff;
    color: #374151;
}

#preview-live.template-professional {
    /* Professional template styles */
    background-color: #f9fafb;
    border-left: 4px solid #4f46e5;
    box-shadow: inset 0 0 0 1px rgba(229, 231, 235, 0.5);
}

#preview-live.template-professional h1 {
    color: #4f46e5;
    font-size: 1.75rem;
    letter-spacing: -0.025em;
}

#preview-live.template-professional table thead {
    background-color: #eef2ff;
}

#preview-live.template-minimal {
    /* Minimal template styles */
    background-color: #ffffff;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

#preview-live.template-minimal h1,
#preview-live.template-minimal h2 {
    font-weight: 300;
    letter-spacing: 0.05em;
}

#preview-live.template-minimal table {
    border-collapse: collapse;
}

#preview-live.template-minimal table thead {
    border-bottom: 1px solid #e5e7eb;
    background-color: transparent;
}

#preview-live.template-minimal table thead th {
    text-transform: none;
    font-weight: 500;
    color: #6b7280;
}

#preview-live.template-minimal tbody tr {
    border-bottom: 1px solid #f3f4f6;
}

/* Template Selection Preview Thumbnails */
.template-preview.standard {
    background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYwIiBoZWlnaHQ9IjY0IiB2aWV3Qm94PSIwIDAgMTYwIDY0IiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxyZWN0IHdpZHRoPSIxNjAiIGhlaWdodD0iNjQiIGZpbGw9IiNGM0Y0RjYiLz48cmVjdCB4PSIxMiIgeT0iOCIgd2lkdGg9IjgwIiBoZWlnaHQ9IjgiIGZpbGw9IiNEMUQ1REIiLz48cmVjdCB4PSIxMiIgeT0iMjAiIHdpZHRoPSIxMzYiIGhlaWdodD0iNCIgZmlsbD0iI0UyRTVFOCIvPjxyZWN0IHg9IjEyIiB5PSIyOCIgd2lkdGg9IjEzNiIgaGVpZ2h0PSI0IiBmaWxsPSIjRTJFNUU4Ii8+PHJlY3QgeD0iMTIiIHk9IjQ0IiB3aWR0aD0iNDgiIGhlaWdodD0iMTIiIGZpbGw9IiM5Q0EzQUYiLz48L3N2Zz4=');
    background-size: cover;
}

.template-preview.professional {
    background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYwIiBoZWlnaHQ9IjY0IiB2aWV3Qm94PSIwIDAgMTYwIDY0IiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxyZWN0IHdpZHRoPSIxNjAiIGhlaWdodD0iNjQiIGZpbGw9IiNGOUZBRkIiLz48cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iNCIgaGVpZ2h0PSI2NCIgZmlsbD0iIzRGNDZFNSIvPjxyZWN0IHg9IjEyIiB5PSI4IiB3aWR0aD0iODAiIGhlaWdodD0iOCIgZmlsbD0iIzRGNDZFNSIvPjxyZWN0IHg9IjEyIiB5PSIyMCIgd2lkdGg9IjEzNiIgaGVpZ2h0PSI0IiBmaWxsPSIjRTJFNUU4Ii8+PHJlY3QgeD0iMTIiIHk9IjI4IiB3aWR0aD0iMTM2IiBoZWlnaHQ9IjQiIGZpbGw9IiNFMkU1RTgiLz48cmVjdCB4PSIxMiIgeT0iNDQiIHdpZHRoPSI0OCIgaGVpZ2h0PSIxMiIgZmlsbD0iIzRGNDZFNSIvPjwvc3ZnPg==');
    background-size: cover;
}

.template-preview.minimal {
    background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYwIiBoZWlnaHQ9IjY0IiB2aWV3Qm94PSIwIDAgMTYwIDY0IiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxyZWN0IHdpZHRoPSIxNjAiIGhlaWdodD0iNjQiIGZpbGw9IiNGRkZGRkYiLz48cmVjdCB4PSIxMiIgeT0iOCIgd2lkdGg9IjQwIiBoZWlnaHQ9IjQiIGZpbGw9IiM0QjU1NjMiLz48cmVjdCB4PSIxMjAiIHk9IjgiIHdpZHRoPSIyOCIgaGVpZ2h0PSI0IiBmaWxsPSIjOUNBM0FGIi8+PHJlY3QgeD0iMTIiIHk9IjI4IiB3aWR0aD0iMTM2IiBoZWlnaHQ9IjEiIGZpbGw9IiNFNUU3RUIiLz48cmVjdCB4PSIxMiIgeT0iMzYiIHdpZHRoPSIxMzYiIGhlaWdodD0iMSIgZmlsbD0iI0U1RTdFQiIvPjxyZWN0IHg9IjEyIiB5PSI0NCIgd2lkdGg9IjEzNiIgaGVpZ2h0PSIxIiBmaWxsPSIjRTVFN0VCIi8+PHJlY3QgeD0iMTI4IiB5PSI1MiIgd2lkdGg9IjIwIiBoZWlnaHQ9IjQiIGZpbGw9IiM5Q0EzQUYiLz48L3N2Zz4=');
    background-size: cover;
}

.template-preview.modern {
    background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYwIiBoZWlnaHQ9IjY0IiB2aWV3Qm94PSIwIDAgMTYwIDY0IiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxyZWN0IHdpZHRoPSIxNjAiIGhlaWdodD0iNjQiIGZpbGw9IiNGOUZBRkIiLz48cmVjdCB4PSIxMiIgeT0iOCIgd2lkdGg9IjgwIiBoZWlnaHQ9IjgiIGZpbGw9IiM0QjU1NjMiLz48cmVjdCB4PSIxMiIgeT0iMjAiIHdpZHRoPSIxMzYiIGhlaWdodD0iNCIgZmlsbD0iI0UyRTVFOCIvPjxyZWN0IHg9IjEyIiB5PSIyOCIgd2lkdGg9IjEzNiIgaGVpZ2h0PSI0IiBmaWxsPSIjRTJFNUU4Ii8+PHJlY3QgeD0iMTIiIHk9IjQ0IiB3aWR0aD0iNDgiIGhlaWdodD0iMTIiIGZpbGw9IiM0QjU1NjMiLz48L3N2Zz4=');
    background-size: cover;
}

.template-preview.corporate {
    background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYwIiBoZWlnaHQ9IjY0IiB2aWV3Qm94PSIwIDAgMTYwIDY0IiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxyZWN0IHdpZHRoPSIxNjAiIGhlaWdodD0iNjQiIGZpbGw9IiNGM0Y0RjYiLz48cmVjdCB4PSIxMiIgeT0iOCIgd2lkdGg9IjgwIiBoZWlnaHQ9IjgiIGZpbGw9IiM2QjcyODAiLz48cmVjdCB4PSIxMiIgeT0iMjAiIHdpZHRoPSIxMzYiIGhlaWdodD0iNCIgZmlsbD0iI0UyRTVFOCIvPjxyZWN0IHg9IjEyIiB5PSIyOCIgd2lkdGg9IjEzNiIgaGVpZ2h0PSI0IiBmaWxsPSIjRTJFNUU4Ii8+PHJlY3QgeD0iMTIiIHk9IjQ0IiB3aWR0aD0iNDgiIGhlaWdodD0iMTIiIGZpbGw9IiM2QjcyODAiLz48L3N2Zz4=');
    background-size: cover;
}

.template-preview.creative {
    background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYwIiBoZWlnaHQ9IjY0IiB2aWV3Qm94PSIwIDAgMTYwIDY0IiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxyZWN0IHdpZHRoPSIxNjAiIGhlaWdodD0iNjQiIGZpbGw9IiNGM0Y0RjYiLz48cmVjdCB4PSIxMiIgeT0iOCIgd2lkdGg9IjgwIiBoZWlnaHQ9IjgiIGZpbGw9IiNFQjQ0N0MiLz48cmVjdCB4PSIxMiIgeT0iMjAiIHdpZHRoPSIxMzYiIGhlaWdodD0iNCIgZmlsbD0iI0UyRTVFOCIvPjxyZWN0IHg9IjEyIiB5PSIyOCIgd2lkdGg9IjEzNiIgaGVpZ2h0PSI0IiBmaWxsPSIjRTJFNUU4Ii8+PHJlY3QgeD0iMTIiIHk9IjQ0IiB3aWR0aD0iNDgiIGhlaWdodD0iMTIiIGZpbGw9IiNFQjQ0N0MiLz48L3N2Zz4=');
    background-size: cover;
}

.template-preview.minimalist {
    background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYwIiBoZWlnaHQ9IjY0IiB2aWV3Qm94PSIwIDAgMTYwIDY0IiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxyZWN0IHdpZHRoPSIxNjAiIGhlaWdodD0iNjQiIGZpbGw9IiNGRkZGRkYiLz48cmVjdCB4PSIxMiIgeT0iOCIgd2lkdGg9IjQwIiBoZWlnaHQ9IjQiIGZpbGw9IiM0QjU1NjMiLz48cmVjdCB4PSIxMiIgeT0iMjAiIHdpZHRoPSIxMzYiIGhlaWdodD0iMSIgZmlsbD0iI0U1RTdFQiIvPjxyZWN0IHg9IjEyIiB5PSIyOCIgd2lkdGg9IjEzNiIgaGVpZ2h0PSIxIiBmaWxsPSIjRTVFN0VCIi8+PHJlY3QgeD0iMTIiIHk9IjQ0IiB3aWR0aD0iMTM2IiBoZWlnaHQ9IjEiIGZpbGw9IiNFNUU3RUIiLz48L3N2Zz4=');
    background-size: cover;
}

.template-preview.elegant {
    background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYwIiBoZWlnaHQ9IjY0IiB2aWV3Qm94PSIwIDAgMTYwIDY0IiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxyZWN0IHdpZHRoPSIxNjAiIGhlaWdodD0iNjQiIGZpbGw9IiNGOUZBRkIiLz48cmVjdCB4PSIxMiIgeT0iOCIgd2lkdGg9IjgwIiBoZWlnaHQ9IjgiIGZpbGw9IiM5Q0EzQUYiLz48cmVjdCB4PSIxMiIgeT0iMjAiIHdpZHRoPSIxMzYiIGhlaWdodD0iNCIgZmlsbD0iI0UyRTVFOCIvPjxyZWN0IHg9IjEyIiB5PSIyOCIgd2lkdGg9IjEzNiIgaGVpZ2h0PSI0IiBmaWxsPSIjRTJFNUU4Ii8+PHJlY3QgeD0iMTIiIHk9IjQ0IiB3aWR0aD0iNDgiIGhlaWdodD0iMTIiIGZpbGw9IiM5Q0EzQUYiLz48L3N2Zz4=');
    background-size: cover;
}

.template-preview.classic {
    background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYwIiBoZWlnaHQ9IjY0IiB2aWV3Qm94PSIwIDAgMTYwIDY0IiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxyZWN0IHdpZHRoPSIxNjAiIGhlaWdodD0iNjQiIGZpbGw9IiNGM0Y0RjYiLz48cmVjdCB4PSIxMiIgeT0iOCIgd2lkdGg9IjgwIiBoZWlnaHQ9IjgiIGZpbGw9IiM2QjcyODAiLz48cmVjdCB4PSIxMiIgeT0iMjAiIHdpZHRoPSIxMzYiIGhlaWdodD0iNCIgZmlsbD0iI0UyRTVFOCIvPjxyZWN0IHg9IjEyIiB5PSIyOCIgd2lkdGg9IjEzNiIgaGVpZ2h0PSI0IiBmaWxsPSIjRTJFNUU4Ii8+PHJlY3QgeD0iMTIiIHk9IjQ0IiB3aWR0aD0iNDgiIGhlaWdodD0iMTIiIGZpbGw9IiM2QjcyODAiLz48L3N2Zz4=');
    background-size: cover;
}

/* Template Selection Styles */
.template-card {
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    border: 2px solid transparent;
    height: 100%;
}

.template-card > div {
    display: flex;
    flex-direction: column;
}

.template-card:hover {
    box-shadow: 0 0 12px rgba(0, 0, 0, 0.1);
}

.template-card.selected {
    border-color: #4f46e5;
}

/* Fixed height for all template cards */
.template-card p,
.gallery-template-card p {
    flex: 1 0 auto;
    min-height: 40px;
}

/* Hide radio buttons visually but keep them accessible */
.template-radio {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

/* Favorite star styling */


/* Enhanced textarea styles */
textarea{
    padding: 0.75rem 1rem;
    min-height: 50px;
    resize: vertical;
    line-height: 1.5;
    font-family: inherit;
}

textarea:focus {
    border-color: #6366f1;
    outline: none;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Specific styles for different textarea sizes */
textarea.form-input[rows="2"] {
    min-height: 80px;
}

textarea.form-input[rows="3"] {
    min-height: 120px;
}

textarea.form-input[rows="4"] {
    min-height: 160px;
}

textarea.form-input[rows="5"] {
    min-height: 200px;
}

/* Placeholder styling for textareas */
textarea.form-input::placeholder {
    color: #9ca3af;
    font-style: italic;
}

/* Gallery template card styles */
.gallery-template-card {
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    border: 2px solid transparent;
    height: 100%;
}

.gallery-template-card > div {
    display: flex;
    flex-direction: column;
}

/* Gallery modal styles */
#template-gallery-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    overflow-y: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-modal-content {
    background-color: white;
    padding: 20px;
    width: 90%;
    max-width: 1000px;
    border-radius: 8px;
    position: relative;
    margin: 0 auto;
    max-height: 80vh;
    overflow-y: auto;
}

.gallery-template-card:hover {
    box-shadow: 0 0 12px rgba(0, 0, 0, 0.1);
}

.gallery-template-card.selected {
    border-color: #4f46e5;
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.5);
}

.close-gallery-modal {
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 24px;
    cursor: pointer;
}

/* Templates for preview */
.template-standard {
    background-color: white;
    border: 1px solid #e5e7eb;
}

.template-professional {
    background-color: #f8fafc;
    border: 1px solid #cbd5e1;
}

.template-minimal {
    background-color: white;
    border: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Invoice Form Styles */
.invoice-form {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.form-section {
    background: white;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.section-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #e5e7eb;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 20px;
}

@media (min-width: 640px) {
    .form-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Error state styling */
.form-input.error,
.form-select.error,
.form-textarea.error {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.form-input.error:focus,
.form-select.error:focus,
.form-textarea.error:focus {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}

/* Required field indicator */
.required-indicator {
    color: #ef4444;
    margin-left: 2px;
}

/* Form actions */
.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
    margin-top: 20px;
}

.btn {
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 500;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
}

.btn-primary {
    background-color: #3b82f6;
    color: white;
}

.btn-primary:hover {
    background-color: #2563eb;
}

.btn-secondary {
    background-color: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background-color: #4b5563;
}

.btn-danger {
    background-color: #ef4444;
    color: white;
}

.btn-danger:hover {
    background-color: #dc2626;
}

/* Loading state */
.btn.loading {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn.loading::after {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 8px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Notification styles */
.notification {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.notification.success {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.notification.error {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.notification.warning {
    background-color: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.notification.info {
    background-color: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .invoice-form {
        padding: 16px;
    }
    
    .form-section {
        padding: 16px;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
} 

/* Read-only and disabled fields (scoped to builders) */
#easy-invoice-content .form-input[readonly],
#easy-invoice-content .form-textarea[readonly],
#easy-invoice-content input[readonly],
#easy-invoice-content textarea[readonly] {
    background-color: #f3f4f6;
    color: #374151;
    border-color: #d1d5db;
    cursor: default;
}

#easy-invoice-content .form-input[readonly]:focus,
#easy-invoice-content .form-textarea[readonly]:focus,
#easy-invoice-content input[readonly]:focus,
#easy-invoice-content textarea[readonly]:focus {
    outline: none;
    box-shadow: none;
    border-color: #d1d5db;
}

#easy-invoice-content .form-input[readonly]::placeholder,
#easy-invoice-content .form-textarea[readonly]::placeholder,
#easy-invoice-content input[readonly]::placeholder,
#easy-invoice-content textarea[readonly]::placeholder {
    color: #9ca3af;
}

#easy-invoice-content .form-select:disabled,
#easy-invoice-content select:disabled {
    background-color: #f3f4f6;
    color: #6b7280;
    border-color: #d1d5db;
    cursor: not-allowed;
}

/* Compact read-only variant for meta/header rows */
#easy-invoice-content .meta-row .form-input[readonly],
#easy-invoice-content .meta-row input[readonly] {
    padding: 6px 10px;
    font-size: 13px;
}

/* Invoice builder: Pro deposit / split inline with Save & Send */
.ei-invoice-builder-header .ei-builder-header-actions {
    min-width: 0;
}

.ei-invoice-builder-header .ei-builder-header-actions .deposit-invoice-section,
.ei-invoice-builder-header .ei-builder-header-actions .deposit-info-popover-trigger {
    max-width: 100%;
}

/* Pro: deposit popover must sit above live preview overlays (e.g. .loading-overlay z-index) */
.ei-invoice-builder-header .deposit-info-popover {
    z-index: 10001;
}

/* Builder pages: reinforce shared strip height (see easy-invoice.css body.easy-invoice-admin-body) */
@media (min-width: 1024px) {
    body.easy-invoice-admin-body .ei-invoice-builder-header.ei-app-header-sync,
    body.easy-invoice-admin-body .ei-quote-builder-header.ei-app-header-sync {
        height: var(--ei-app-header-strip-height, 6.5rem) !important;
        min-height: var(--ei-app-header-strip-height, 6.5rem) !important;
        max-height: var(--ei-app-header-strip-height, 6.5rem) !important;
    }
}