/**
 * UI Components - Inspired by shadcn/ui
 */

/* Card */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    transition: none;
    box-shadow: var(--shadow-sm);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.card:hover {
    border-color: var(--border-color);
    box-shadow: var(--shadow-sm);
    transform: none;
}

[data-theme="light"] .card {
    box-shadow: none;
    border: 1px solid #e5e7eb;
    background: var(--bg-card);
}

[data-theme="light"] .card:hover {
    box-shadow: none;
    border-color: #e5e7eb;
    transform: none;
    background: var(--bg-card);
}

/* ===== LIGHT2 CARD - Ultra minimal, Wise/Stripe style ===== */
[data-theme="light2"] .card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: none;
    padding: 1.25rem;
}

[data-theme="light2"] .card:hover {
    background: var(--bg-card);
    border-color: var(--border-color);
    transform: none;
    box-shadow: none;
}

[data-theme="light2"] .card-header {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

[data-theme="light2"] .card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.card-header {
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--border-color);
}

[data-theme="light"] .card-header {
    border-bottom: 1px solid #e5e7eb;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0;
}

.card-body {
    padding: var(--spacing-md) 0;
}

/* Button */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all var(--transition-base);
    text-decoration: none;
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #374151;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .btn {
    font-weight: 500;
    border: 1px solid transparent;
}

[data-theme="light"] .btn-primary {
    background: var(--accent-blue);
    color: white;
    border: 1px solid var(--accent-blue);
}

[data-theme="light"] .btn-primary:hover:not(:disabled) {
    background: #0052a3;
    border-color: #0052a3;
    transform: none;
    box-shadow: none;
}

[data-theme="light"] .btn-primary:active:not(:disabled) {
    background: #003d7a;
    border-color: #003d7a;
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-hover);
    border-color: var(--accent-purple);
}

[data-theme="light"] .btn-secondary {
    background: var(--bg-card);
    border: 1px solid #d1d5db;
    color: var(--text-primary);
}

[data-theme="light"] .btn-secondary:hover:not(:disabled) {
    background: #f9fafb;
    border-color: #9ca3af;
    box-shadow: none;
}

[data-theme="light"] .btn-secondary:active:not(:disabled) {
    background: #f3f4f6;
    border-color: #6b7280;
}

/* ===== LIGHT2 BUTTONS - Wise/Stripe clean style ===== */
[data-theme="light2"] .btn {
    font-weight: 500;
    border-radius: 6px;
    transition: all 0.15s ease;
    letter-spacing: 0;
}

[data-theme="light2"] .btn-primary {
    background: #00b856;
    color: white;
    border: 1px solid #00b856;
}

[data-theme="light2"] .btn-primary:hover:not(:disabled) {
    background: #00a04d;
    border-color: #00a04d;
    transform: none;
    box-shadow: none;
}

[data-theme="light2"] .btn-primary:active:not(:disabled) {
    background: #008f44;
    border-color: #008f44;
}

[data-theme="light2"] .btn-secondary {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

[data-theme="light2"] .btn-secondary:hover:not(:disabled) {
    background: var(--bg-hover);
    border-color: #d1d5db;
    box-shadow: none;
}

[data-theme="light2"] .btn-secondary:active:not(:disabled) {
    background: #e5e7eb;
    border-color: #9ca3af;
}

/* Add/Create Button - Purple gradient style like Create Rule */
.btn-add,
.btn-create {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
    text-decoration: none;
    white-space: nowrap;
}

.btn-add:hover,
.btn-create:hover {
    background: linear-gradient(135deg, #7c3aed 0%, #9333ea 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.4);
    color: white;
    text-decoration: none;
}

.btn-add:active,
.btn-create:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
    background: linear-gradient(135deg, #7c3aed 0%, #9333ea 100%);
}

.btn-add:focus,
.btn-create:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.4), 0 2px 8px rgba(139, 92, 246, 0.3);
}

.btn-add svg,
.btn-create svg {
    transition: transform 0.2s ease;
    width: 14px;
    height: 14px;
}

.btn-add:hover svg,
.btn-create:hover svg {
    transform: rotate(90deg);
}

.btn-add.btn-sm,
.btn-create.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
    height: 2rem;
}

.btn-add.btn-sm svg,
.btn-create.btn-sm svg {
    width: 14px;
    height: 14px;
}

/* ===== LIGHT THEME Add/Create Buttons - Soft Gray ===== */
[data-theme="light"] .btn-add,
[data-theme="light"] .btn-create {
    background: #6b7280;
    color: white;
    border: none;
    border-radius: 6px;
    box-shadow: none;
    font-weight: 500;
}

[data-theme="light"] .btn-add:hover,
[data-theme="light"] .btn-create:hover {
    background: #4b5563;
    transform: none;
    box-shadow: none;
    color: white;
}

[data-theme="light"] .btn-add:active,
[data-theme="light"] .btn-create:active {
    background: #374151;
    transform: none;
    box-shadow: none;
}

[data-theme="light"] .btn-add:focus,
[data-theme="light"] .btn-create:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(107, 114, 128, 0.3);
}

[data-theme="light"] .btn-add:hover svg,
[data-theme="light"] .btn-create:hover svg {
    transform: none;
}

/* ===== LIGHT2 THEME Add/Create Buttons - Wise Green ===== */
[data-theme="light2"] .btn-add,
[data-theme="light2"] .btn-create {
    background: #00b856;
    color: white;
    border: none;
    border-radius: 6px;
    box-shadow: none;
    font-weight: 500;
}

[data-theme="light2"] .btn-add:hover,
[data-theme="light2"] .btn-create:hover {
    background: #00a04d;
    transform: none;
    box-shadow: none;
    color: white;
}

[data-theme="light2"] .btn-add:active,
[data-theme="light2"] .btn-create:active {
    background: #008f44;
    transform: none;
    box-shadow: none;
}

[data-theme="light2"] .btn-add:focus,
[data-theme="light2"] .btn-create:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 184, 86, 0.2);
}

[data-theme="light2"] .btn-add:hover svg,
[data-theme="light2"] .btn-create:hover svg {
    transform: none;
}

/* ===== LIGHT3 THEME Add/Create Buttons - Blue Professional ===== */
[data-theme="light3"] .btn-add,
[data-theme="light3"] .btn-create {
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 6px;
    box-shadow: none;
    font-weight: 500;
}

[data-theme="light3"] .btn-add:hover,
[data-theme="light3"] .btn-create:hover {
    background: #1d4ed8;
    transform: none;
    box-shadow: none;
    color: white;
}

[data-theme="light3"] .btn-add:active,
[data-theme="light3"] .btn-create:active {
    background: #1e40af;
    transform: none;
    box-shadow: none;
}

[data-theme="light3"] .btn-add:focus,
[data-theme="light3"] .btn-create:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

[data-theme="light3"] .btn-add:hover svg,
[data-theme="light3"] .btn-create:hover svg {
    transform: none;
}

.btn-success {
    background: var(--accent-green);
    color: white;
}

[data-theme="light"] .btn-success {
    background: #10b981;
    border: 1px solid #10b981;
    color: white;
}

[data-theme="light"] .btn-success:hover:not(:disabled) {
    background: #059669;
    border-color: #059669;
}

.btn-danger {
    background: var(--accent-red);
    color: white;
}

[data-theme="light"] .btn-danger {
    background: #ef4444;
    border: 1px solid #ef4444;
    color: white;
}

[data-theme="light"] .btn-danger:hover:not(:disabled) {
    background: #dc2626;
    border-color: #dc2626;
}

[data-theme="light2"] .btn-success {
    background: #00b856;
    border: 1px solid #00b856;
    color: white;
}

[data-theme="light2"] .btn-success:hover:not(:disabled) {
    background: #00a04d;
    border-color: #00a04d;
}

[data-theme="light2"] .btn-danger {
    background: #dc2626;
    border: 1px solid #dc2626;
    color: white;
}

[data-theme="light2"] .btn-danger:hover:not(:disabled) {
    background: #b91c1c;
    border-color: #b91c1c;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
}

.btn-sm.btn-icon {
    padding: 0.5rem;
    min-width: 32px;
    width: 32px;
    height: 32px;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

.btn-icon {
    padding: 0.625rem;
    aspect-ratio: 1;
    min-width: 40px;
}

.btn-icon svg {
    display: block;
}

/* Sync and Export Buttons - Semi-transparent beautiful style */
.btn-sync {
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent-purple);
    border: 1px solid rgba(59, 130, 246, 0.25);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.btn-sync:hover:not(:disabled) {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.4);
    color: var(--accent-purple);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

.btn-sync:active:not(:disabled) {
    background: rgba(159, 122, 234, 0.2);
    transform: translateY(0);
}

.btn-export {
    background: rgba(107, 114, 128, 0.15);
    color: #6b7280;
    border: 1px solid rgba(107, 114, 128, 0.3);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.btn-export:hover:not(:disabled) {
    background: rgba(107, 114, 128, 0.25);
    border-color: rgba(107, 114, 128, 0.5);
    color: #4b5563;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(107, 114, 128, 0.15);
}

.btn-export:active:not(:disabled) {
    background: rgba(107, 114, 128, 0.2);
    transform: translateY(0);
}

.btn-send {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.3);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.btn-send:hover:not(:disabled) {
    background: rgba(34, 197, 94, 0.25);
    border-color: rgba(34, 197, 94, 0.5);
    color: #16a34a;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.2);
}

.btn-send:active:not(:disabled) {
    background: rgba(34, 197, 94, 0.2);
    transform: translateY(0);
}

/* Light theme overrides */
[data-theme="light"] .btn-sync {
    background: rgba(0, 102, 204, 0.1);
    color: #0066cc;
    border: 1px solid rgba(0, 102, 204, 0.2);
}

[data-theme="light"] .btn-sync:hover:not(:disabled) {
    background: rgba(0, 102, 204, 0.15);
    border-color: rgba(0, 102, 204, 0.3);
    color: #0052a3;
    box-shadow: 0 2px 8px rgba(0, 102, 204, 0.15);
}

[data-theme="light"] .btn-export {
    background: rgba(107, 114, 128, 0.1);
    color: #6b7280;
    border: 1px solid rgba(107, 114, 128, 0.2);
}

[data-theme="light"] .btn-export:hover:not(:disabled) {
    background: rgba(107, 114, 128, 0.15);
    border-color: rgba(107, 114, 128, 0.3);
    color: #4b5563;
    box-shadow: 0 2px 8px rgba(107, 114, 128, 0.1);
}

/* Light2 theme overrides */
[data-theme="light2"] .btn-sync {
    background: rgba(0, 184, 86, 0.1);
    color: #00b856;
    border: 1px solid rgba(0, 184, 86, 0.2);
}

[data-theme="light2"] .btn-sync:hover:not(:disabled) {
    background: rgba(0, 184, 86, 0.15);
    border-color: rgba(0, 184, 86, 0.3);
    color: #00a04d;
    box-shadow: 0 2px 8px rgba(0, 184, 86, 0.15);
}

[data-theme="light2"] .btn-export {
    background: rgba(156, 163, 175, 0.1);
    color: #9ca3af;
    border: 1px solid rgba(156, 163, 175, 0.2);
}

[data-theme="light2"] .btn-export:hover:not(:disabled) {
    background: rgba(156, 163, 175, 0.15);
    border-color: rgba(156, 163, 175, 0.3);
    color: #6b7280;
    box-shadow: 0 2px 8px rgba(156, 163, 175, 0.1);
}

/* Light3 theme overrides */
[data-theme="light3"] .btn-sync {
    background: rgba(37, 99, 235, 0.1);
    color: #2563eb;
    border: 1px solid rgba(37, 99, 235, 0.2);
}

[data-theme="light3"] .btn-sync:hover:not(:disabled) {
    background: rgba(37, 99, 235, 0.15);
    border-color: rgba(37, 99, 235, 0.3);
    color: #1d4ed8;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.15);
}

[data-theme="light3"] .btn-export {
    background: rgba(148, 163, 184, 0.1);
    color: #94a3b8;
    border: 1px solid rgba(148, 163, 184, 0.2);
}

[data-theme="light3"] .btn-export:hover:not(:disabled) {
    background: rgba(148, 163, 184, 0.15);
    border-color: rgba(148, 163, 184, 0.3);
    color: #64748b;
    box-shadow: 0 2px 8px rgba(148, 163, 184, 0.1);
}

/* Light theme overrides for btn-send */
[data-theme="light"] .btn-send {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

[data-theme="light"] .btn-send:hover:not(:disabled) {
    background: rgba(34, 197, 94, 0.15);
    border-color: rgba(34, 197, 94, 0.3);
    color: #16a34a;
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.15);
}

[data-theme="light2"] .btn-send {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

[data-theme="light2"] .btn-send:hover:not(:disabled) {
    background: rgba(34, 197, 94, 0.15);
    border-color: rgba(34, 197, 94, 0.3);
    color: #16a34a;
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.15);
}

[data-theme="light3"] .btn-send {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

[data-theme="light3"] .btn-send:hover:not(:disabled) {
    background: rgba(34, 197, 94, 0.15);
    border-color: rgba(34, 197, 94, 0.3);
    color: #16a34a;
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.15);
}

/* Input */
.input,
.textarea,
.select {
    width: 100%;
    padding: 0.625rem 0.875rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: all var(--transition-base);
}

.select {
    padding-right: 2rem;
    cursor: pointer;
}

.select option {
    background: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
}

.select option:checked {
    background: var(--accent-purple) !important;
    color: white !important;
}

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

[data-theme="light"] .input,
[data-theme="light"] .textarea,
[data-theme="light"] .select {
    background: var(--bg-card);
    border: 1px solid #d1d5db;
    color: var(--text-primary);
}

[data-theme="light"] .input:hover:not(:focus),
[data-theme="light"] .textarea:hover:not(:focus),
[data-theme="light"] .select:hover:not(:focus) {
    border-color: #9ca3af;
}

[data-theme="light"] .input:focus,
[data-theme="light"] .textarea:focus,
[data-theme="light"] .select:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
    background: var(--bg-card);
}

.input::placeholder,
.textarea::placeholder {
    color: var(--text-muted);
}

.textarea {
    min-height: 100px;
    resize: vertical;
}

.input-group {
    margin-bottom: var(--spacing-md);
}

.label {
    display: block;
    margin-bottom: var(--spacing-sm);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

[data-theme="light"] .label {
    color: #374151;
    font-weight: 500;
}

/* ===== LIGHT2 FORM ELEMENTS ===== */
[data-theme="light2"] .label {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.8125rem;
    margin-bottom: 0.375rem;
}

[data-theme="light2"] .input-group {
    margin-bottom: 1rem;
}

[data-theme="light2"] .input-error {
    border-color: #dc2626;
}

[data-theme="light2"] .error-message {
    color: #dc2626;
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

.input-error {
    border-color: var(--accent-red);
}

[data-theme="light"] .input-error {
    border-color: #ef4444;
}

.error-message {
    display: block;
    margin-top: var(--spacing-xs);
    font-size: 0.8125rem;
    color: var(--accent-red);
}

[data-theme="light"] .error-message {
    color: #dc2626;
}

/* Table */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

[data-theme="light"] .table-wrapper {
    border: 1px solid #e5e7eb;
    box-shadow: none;
    background: var(--bg-card);
    border-radius: 0.5rem;
}

.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--bg-card);
}

.table thead {
    background: var(--bg-secondary);
}

[data-theme="light"] .table {
    background: var(--bg-card);
}

[data-theme="light"] .table thead {
    background: #f9fafb;
    border-bottom: 2px solid #e5e7eb;
}

.table th,
.table td {
    padding: 0.875rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

[data-theme="light"] .table th,
[data-theme="light"] .table td {
    border-bottom: 1px solid #e5e7eb;
    padding: 0.75rem 1rem;
}

.table th {
    font-weight: 600;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

[data-theme="light"] .table th {
    font-weight: 600;
    font-size: 0.75rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.75rem 1rem;
}

[data-theme="light"] .table td {
    color: var(--text-primary);
    font-size: 0.875rem;
}

.table tbody tr {
    transition: none;
}

.table tbody tr:hover {
    background: inherit;
}

[data-theme="light"] .table tbody tr {
    background: var(--bg-card);
}

[data-theme="light"] .table tbody tr:hover {
    background: var(--bg-card);
}

[data-theme="light"] .table tbody tr:not(:last-child) td {
    border-bottom: 1px solid #e5e7eb;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

[data-theme="light"] .table tbody tr:last-child td {
    border-bottom: none;
}

/* ===== LIGHT2 TABLE - Clean financial table ===== */
[data-theme="light2"] .table-wrapper {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-card);
    overflow-x: auto;
}

[data-theme="light2"] .table {
    background: var(--bg-card);
}

[data-theme="light2"] .table thead {
    background: var(--bg-secondary);
}

[data-theme="light2"] .table th {
    font-weight: 500;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

[data-theme="light2"] .table td {
    padding: 0.875rem 1rem;
    font-size: 0.875rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
}

[data-theme="light2"] .table tbody tr {
    transition: none;
}

[data-theme="light2"] .table tbody tr:hover {
    background: var(--bg-card);
}

[data-theme="light2"] .table tbody tr:last-child td {
    border-bottom: none;
}

/* Editable invoice name */
.editable-invoice-name {
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: all var(--transition-fast);
    display: inline-block;
    min-width: 100px;
}

.editable-invoice-name:hover {
    background: var(--bg-hover);
    color: var(--accent-purple);
}

[data-theme="light"] .editable-invoice-name:hover {
    background: var(--bg-primary);
    color: var(--accent-blue);
}

.editable-invoice-name:active {
    background: var(--bg-secondary);
}

.inline-edit-input {
    outline: none !important;
    border: 1px solid var(--accent-purple) !important;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15) !important;
}

[data-theme="light"] .inline-edit-input {
    border: 1px solid var(--accent-blue) !important;
    box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.1) !important;
}

/* ===== LIGHT2 EDITABLE ELEMENTS ===== */
[data-theme="light2"] .editable-invoice-name:hover {
    background: var(--bg-secondary);
    color: #00b856;
}

[data-theme="light2"] .inline-edit-input {
    border: 1px solid #00b856 !important;
    box-shadow: 0 0 0 2px rgba(0, 184, 86, 0.15) !important;
}

/* Badge */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    white-space: nowrap;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

/* Badge text should use full available width before truncating */
.badge > * {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    flex: 1 1 auto;
}

/* Badge in table cells - keep inline, don't stretch */
td .badge:only-child,
th .badge:only-child {
    display: inline-flex;
    width: auto;
}

div[style*="max-width"] .badge:only-child {
    display: flex;
    width: 100%;
}

.badge-primary {
    background: rgba(59, 130, 246, 0.12);
    color: var(--accent-purple);
}

[data-theme="light"] .badge-primary {
    background: rgba(0, 102, 204, 0.1);
    color: #0066cc;
    border: none;
}

[data-theme="light"] .badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
}

[data-theme="light"] .badge-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
}

[data-theme="light"] .badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: #d97706;
}

/* ===== LIGHT2 BADGES - Minimal style ===== */
[data-theme="light2"] .badge {
    font-size: 0.6875rem;
    font-weight: 500;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    letter-spacing: 0;
}

[data-theme="light2"] .badge-primary {
    background: rgba(0, 184, 86, 0.1);
    color: #00a04d;
}

[data-theme="light2"] .badge-success {
    background: rgba(0, 184, 86, 0.1);
    color: #00a04d;
}

[data-theme="light2"] .badge-danger {
    background: rgba(220, 38, 38, 0.1);
    color: #dc2626;
}

[data-theme="light2"] .badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: #d97706;
}

.badge-success {
    background: rgba(72, 187, 120, 0.2);
    color: var(--accent-green);
}

.badge-danger {
    background: rgba(245, 101, 101, 0.2);
    color: var(--accent-red);
}

.badge-warning {
    background: rgba(246, 173, 85, 0.2);
    color: var(--accent-orange);
}

/* Alert */
.alert {
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-md);
    border-left: 4px solid;
}

.alert-success {
    background: rgba(72, 187, 120, 0.1);
    border-color: var(--accent-green);
    color: var(--accent-green);
}

.alert-error {
    background: rgba(245, 101, 101, 0.1);
    border-color: var(--accent-red);
    color: var(--accent-red);
}

.alert-warning {
    background: rgba(246, 173, 85, 0.1);
    border-color: var(--accent-orange);
    color: var(--accent-orange);
}

.alert-info {
    background: rgba(66, 153, 225, 0.1);
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}

[data-theme="light"] .alert {
    border-left-width: 4px;
    border-radius: 0.375rem;
}

[data-theme="light"] .alert-success {
    background: rgba(16, 185, 129, 0.1);
    border-left-color: #10b981;
    color: #047857;
}

[data-theme="light"] .alert-error {
    background: rgba(239, 68, 68, 0.1);
    border-left-color: #ef4444;
    color: #b91c1c;
}

[data-theme="light"] .alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border-left-color: #f59e0b;
    color: #b45309;
}

[data-theme="light"] .alert-info {
    background: rgba(0, 102, 204, 0.1);
    border-left-color: #0066cc;
    color: #0052a3;
}

/* ===== LIGHT2 ALERTS - Clean minimal style ===== */
[data-theme="light2"] .alert {
    border-radius: 6px;
    border-left-width: 3px;
    padding: 0.875rem 1rem;
}

[data-theme="light2"] .alert-success {
    background: rgba(0, 184, 86, 0.08);
    border-left-color: #00b856;
    color: #00864d;
}

[data-theme="light2"] .alert-error {
    background: rgba(220, 38, 38, 0.08);
    border-left-color: #dc2626;
    color: #b91c1c;
}

[data-theme="light2"] .alert-warning {
    background: rgba(245, 158, 11, 0.08);
    border-left-color: #f59e0b;
    color: #b45309;
}

[data-theme="light2"] .alert-info {
    background: rgba(0, 184, 86, 0.08);
    border-left-color: #00b856;
    color: #00864d;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn var(--transition-base);
}

[data-theme="light"] .modal-overlay {
    background: rgba(0, 0, 0, 0.5);
}

.modal-overlay.hidden,
#uploadModal.hidden {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideIn var(--transition-base);
}

[data-theme="light"] .modal {
    border: 1px solid #e5e7eb;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.modal-header {
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header .modal-title {
    flex: 0 1 auto;
}

.modal-header button:last-child {
    flex: 0 0 auto;
    margin-left: auto;
}

[data-theme="light"] .modal-header {
    border-bottom: 1px solid #e5e7eb;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.modal-body {
    padding: var(--spacing-lg);
}

.modal-footer {
    padding: var(--spacing-lg);
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: var(--spacing-sm);
    justify-content: flex-end;
}

[data-theme="light"] .modal-footer {
    border-top: 1px solid #e5e7eb;
}

/* ===== LIGHT2 MODAL - Clean minimal style ===== */
[data-theme="light2"] .modal-overlay {
    background: rgba(31, 41, 55, 0.5);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}

[data-theme="light2"] .modal {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

[data-theme="light2"] .modal-header {
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem;
}

[data-theme="light2"] .modal-title {
    font-size: 1.125rem;
    font-weight: 600;
}

[data-theme="light2"] .modal-body {
    padding: 1.25rem;
}

[data-theme="light2"] .modal-footer {
    border-top: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
}

/* Loading spinner */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent-purple);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

[data-theme="light"] .spinner {
    border-color: var(--border-color);
    border-top-color: var(--accent-blue);
}

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

/* Progress bar */
.progress {
    height: 8px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--gradient-primary);
    transition: width var(--transition-slow);
}

[data-theme="light"] .progress-bar {
    background: var(--accent-blue);
}

[data-theme="light"] .progress {
    background: var(--bg-primary);
}

/* ===== LIGHT2 SPINNER & PROGRESS - Clean style ===== */
[data-theme="light2"] .spinner {
    border-color: var(--border-color);
    border-top-color: #00b856;
}

[data-theme="light2"] .progress {
    height: 6px;
    background: var(--bg-secondary);
    border-radius: 3px;
}

[data-theme="light2"] .progress-bar {
    background: #00b856;
    border-radius: 3px;
}

/* Dropdown */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.25rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    z-index: 100;
    animation: slideIn var(--transition-base);
}

[data-theme="light"] .dropdown-menu {
    border: 1px solid #e5e7eb;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    background: var(--bg-card);
    padding: 0.25rem 0;
}

.dropdown-item {
    display: block;
    padding: 0.625rem 1rem;
    color: var(--text-primary);
    text-decoration: none;
    transition: background var(--transition-fast);
}

[data-theme="light"] .dropdown-item {
    padding: 0.5rem 1rem;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.dropdown-item:hover {
    background: var(--bg-hover);
}

[data-theme="light"] .dropdown-item:hover {
    background: #f9fafb;
}

[data-theme="light"] .dropdown-item:active {
    background: #f3f4f6;
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: var(--spacing-sm) 0;
}

[data-theme="light"] .dropdown-divider {
    background: #e5e7eb;
    margin: 0.25rem 0;
}

/* ===== LIGHT2 DROPDOWN - Clean minimal style ===== */
[data-theme="light2"] .dropdown-menu {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-card);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.08);
    padding: 0.375rem;
}

[data-theme="light2"] .dropdown-item {
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    font-size: 0.875rem;
    color: var(--text-primary);
}

[data-theme="light2"] .dropdown-item:hover {
    background: var(--bg-secondary);
}

[data-theme="light2"] .dropdown-divider {
    background: var(--border-color);
    margin: 0.375rem 0;
}

/* Tooltip */
.tooltip {
    position: relative;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.8125rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-base);
    margin-bottom: var(--spacing-sm);
}

.tooltip:hover::after {
    opacity: 1;
}

/* ===== LIGHT3 THEME OVERRIDES - Clear financial UI ===== */
[data-theme="light3"] .card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: none;
    padding: 1.25rem;
}

[data-theme="light3"] .card:hover {
    background: var(--bg-card);
    border-color: #cbd5e1;
    transform: none;
    box-shadow: none;
}

[data-theme="light3"] .card-header {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

[data-theme="light3"] .card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

[data-theme="light3"] .btn {
    font-weight: 500;
    border: 1px solid transparent;
    border-radius: 6px;
}

[data-theme="light3"] .btn-primary {
    background: var(--accent-blue);
    color: white;
    border: 1px solid var(--accent-blue);
}

[data-theme="light3"] .btn-primary:hover:not(:disabled) {
    background: #1d4ed8;
    border-color: #1d4ed8;
    transform: none;
    box-shadow: none;
}

[data-theme="light3"] .btn-primary:active:not(:disabled) {
    background: #1e40af;
    border-color: #1e40af;
}

[data-theme="light3"] .btn-secondary {
    background: var(--bg-card);
    border: 1px solid #cbd5e1;
    color: var(--text-primary);
}

[data-theme="light3"] .btn-secondary:hover:not(:disabled) {
    background: #f8fafc;
    border-color: #94a3b8;
    box-shadow: none;
}

[data-theme="light3"] .btn-secondary:active:not(:disabled) {
    background: #f1f5f9;
    border-color: #64748b;
}

[data-theme="light3"] .btn-success {
    background: #16a34a;
    border: 1px solid #16a34a;
    color: white;
}

[data-theme="light3"] .btn-success:hover:not(:disabled) {
    background: #15803d;
    border-color: #15803d;
}

[data-theme="light3"] .btn-danger {
    background: #dc2626;
    border: 1px solid #dc2626;
    color: white;
}

[data-theme="light3"] .btn-danger:hover:not(:disabled) {
    background: #b91c1c;
    border-color: #b91c1c;
}

[data-theme="light3"] .input,
[data-theme="light3"] .textarea,
[data-theme="light3"] .select {
    background: var(--bg-card);
    border: 1px solid #cbd5e1;
    color: var(--text-primary);
}

[data-theme="light3"] .input:hover:not(:focus),
[data-theme="light3"] .textarea:hover:not(:focus),
[data-theme="light3"] .select:hover:not(:focus) {
    border-color: #94a3b8;
}

[data-theme="light3"] .input:focus,
[data-theme="light3"] .textarea:focus,
[data-theme="light3"] .select:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
    background: var(--bg-card);
}

[data-theme="light3"] .label {
    color: var(--text-secondary);
    font-weight: 500;
}

[data-theme="light3"] .input-error {
    border-color: #dc2626;
}

[data-theme="light3"] .error-message {
    color: #b91c1c;
}

[data-theme="light3"] .table-wrapper {
    border: 1px solid var(--border-color);
    box-shadow: none;
    background: var(--bg-card);
    border-radius: 0.5rem;
}

[data-theme="light3"] .table {
    background: var(--bg-card);
}

[data-theme="light3"] .table thead {
    background: #f8fafc;
    border-bottom: 1px solid var(--border-color);
}

[data-theme="light3"] .table th,
[data-theme="light3"] .table td {
    border-bottom: 1px solid #e2e8f0;
    padding: 0.75rem 1rem;
}

[data-theme="light3"] .table th {
    font-weight: 600;
    font-size: 0.75rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

[data-theme="light3"] .table td {
    color: var(--text-primary);
    font-size: 0.875rem;
}

[data-theme="light3"] .table tbody tr {
    background: var(--bg-card);
}

[data-theme="light3"] .table tbody tr:hover {
    background: var(--bg-card);
}

[data-theme="light3"] .table tbody tr:not(:last-child) td {
    border-bottom: 1px solid #e2e8f0;
}

[data-theme="light3"] .table tbody tr:last-child td {
    border-bottom: none;
}

[data-theme="light3"] .editable-invoice-name:hover {
    background: #f1f5f9;
    color: var(--accent-blue);
}

[data-theme="light3"] .inline-edit-input {
    border: 1px solid var(--accent-blue) !important;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12) !important;
}

[data-theme="light3"] .badge-primary {
    background: rgba(37, 99, 235, 0.1);
    color: #1d4ed8;
    border: none;
}

[data-theme="light3"] .badge-success {
    background: rgba(22, 163, 74, 0.1);
    color: #15803d;
}

[data-theme="light3"] .badge-danger {
    background: rgba(220, 38, 38, 0.1);
    color: #b91c1c;
}

[data-theme="light3"] .badge-warning {
    background: rgba(249, 115, 22, 0.1);
    color: #c2410c;
}

[data-theme="light3"] .alert {
    border-left-width: 3px;
    border-radius: 6px;
    padding: 0.875rem 1rem;
}

[data-theme="light3"] .alert-success {
    background: rgba(22, 163, 74, 0.08);
    border-left-color: #16a34a;
    color: #166534;
}

[data-theme="light3"] .alert-error {
    background: rgba(220, 38, 38, 0.08);
    border-left-color: #dc2626;
    color: #991b1b;
}

[data-theme="light3"] .alert-warning {
    background: rgba(249, 115, 22, 0.08);
    border-left-color: #f97316;
    color: #9a3412;
}

[data-theme="light3"] .alert-info {
    background: rgba(37, 99, 235, 0.08);
    border-left-color: #2563eb;
    color: #1e40af;
}

[data-theme="light3"] .modal-overlay {
    background: rgba(15, 23, 42, 0.45);
}

[data-theme="light3"] .modal {
    border: 1px solid var(--border-color);
    box-shadow: 0 16px 32px rgba(15, 23, 42, 0.12);
}

[data-theme="light3"] .modal-header {
    border-bottom: 1px solid var(--border-color);
}

[data-theme="light3"] .modal-footer {
    border-top: 1px solid var(--border-color);
}

[data-theme="light3"] .spinner {
    border-color: #e2e8f0;
    border-top-color: var(--accent-blue);
}

[data-theme="light3"] .progress {
    background: #f1f5f9;
}

[data-theme="light3"] .progress-bar {
    background: var(--accent-blue);
}

[data-theme="light3"] .dropdown-menu {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-card);
    box-shadow: 0 8px 16px rgba(15, 23, 42, 0.08);
    padding: 0.375rem;
}

[data-theme="light3"] .dropdown-item {
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    font-size: 0.875rem;
    color: var(--text-primary);
}

[data-theme="light3"] .dropdown-item:hover {
    background: #f8fafc;
}

[data-theme="light3"] .dropdown-item:active {
    background: #f1f5f9;
}

[data-theme="light3"] .dropdown-divider {
    background: var(--border-color);
    margin: 0.375rem 0;
}
