/* FMBD - Custom Styles */

/* Cards */
.card {
    background: rgba(30, 41, 59, 0.5);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 1rem;
}

/* Tab buttons */
.tab-btn {
    color: #94a3b8;
}

.tab-btn:hover {
    color: #e2e8f0;
    background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
    color: #ffffff;
    background: rgba(59, 130, 246, 0.15);
}

/* Inputs */
.input {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border-radius: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
    font-size: 0.875rem;
    transition: all 0.2s;
    outline: none;
}

.input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.input::placeholder {
    color: #475569;
}

.input-sm {
    padding: 0.375rem 0.625rem;
    border-radius: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
    font-size: 0.75rem;
    outline: none;
    transition: all 0.2s;
}

.input-sm:focus {
    border-color: #3b82f6;
}

/* Labels */
.label {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    color: #94a3b8;
    margin-bottom: 0.375rem;
}

.relation-type-btn,
.relation-sentiment-btn,
.relation-weight-btn,
.relation-action-btn {
    transition: all 0.2s ease;
    border-radius: 0.75rem;
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: rgba(15, 23, 42, 0.65);
    color: #e2e8f0;
    cursor: pointer;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}

.relation-type-btn {
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.relation-type-btn:hover,
.relation-sentiment-btn:hover,
.relation-weight-btn:hover,
.relation-action-btn:hover {
    transform: translateY(-1px);
    border-color: rgba(96, 165, 250, 0.55);
    background: rgba(30, 41, 59, 0.9);
}

.relation-type-btn.active,
.relation-sentiment-btn.active,
.relation-weight-btn.active {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.25), rgba(168, 85, 247, 0.18));
    border-color: rgba(96, 165, 250, 0.9);
    color: #f8fbff;
    box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.3), 0 8px 20px rgba(37, 99, 235, 0.18);
}

.relation-sentiment-btn {
    padding: 0.5rem 0.7rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.relation-weight-btn {
    width: 2.25rem;
    height: 2.25rem;
    font-size: 0.75rem;
    font-weight: 700;
}

.relation-card {
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.72), rgba(15, 23, 42, 0.45));
    border: 1px solid rgba(148, 163, 184, 0.14);
}

.relation-action-btn {
    padding: 0.3rem 0.55rem;
    font-size: 0.7rem;
    font-weight: 600;
}

.relation-action-edit {
    color: #93c5fd;
}

.relation-action-delete {
    color: #fca5a5;
}

/* Buttons */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: 0.75rem;
    background: #2563eb;
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
}

.btn-primary:hover {
    background: #1d4ed8;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #94a3b8;
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.2s;
    cursor: pointer;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
}

.btn-danger {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    border-radius: 0.5rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #f87171;
    font-size: 0.75rem;
    transition: all 0.2s;
    cursor: pointer;
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 0.5rem;
    background: transparent;
    border: none;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #e2e8f0;
}

/* Positive/Negative values */
.val-positive {
    color: #34d399;
}

.val-negative {
    color: #f87171;
}

.val-zero {
    color: #64748b;
}

/* Badge */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.6875rem;
    font-weight: 500;
}

.badge-green {
    background: rgba(52, 211, 153, 0.1);
    color: #34d399;
}

.badge-red {
    background: rgba(248, 113, 113, 0.1);
    color: #f87171;
}

.badge-amber {
    background: rgba(251, 191, 36, 0.1);
    color: #fbbf24;
}

.badge-blue {
    background: rgba(96, 165, 250, 0.1);
    color: #60a5fa;
}

/* Group collapse/expand */
.group-header td {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.group-row {
    transition: all 0.15s ease;
}

.group-row.group-hidden {
    display: none;
}

.group-chevron {
    transition: transform 0.2s ease;
}

/* History filter inputs */
.filter-input {
    width: 100%;
    padding: 0.25rem 0.4rem;
    border-radius: 0.25rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
    font-size: 0.75rem;
    outline: none;
}

.filter-input:focus {
    border-color: rgba(96, 165, 250, 0.4);
    background: rgba(255, 255, 255, 0.06);
}

.filter-input::placeholder {
    color: #475569;
}

/* Bulk input styling */
.bulk-input {
    width: 100%;
    padding: 0.375rem 0.5rem;
    border-radius: 0.375rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
    font-size: 0.8125rem;
    outline: none;
    transition: border-color 0.2s;
}

.bulk-input:focus {
    border-color: #3b82f6;
}

/* Toast animations */
.toast-show {
    animation: slideIn 0.3s ease-out;
}

.toast-hide {
    animation: slideOut 0.3s ease-in forwards;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }

    to {
        opacity: 0;
        transform: translateY(20px);
    }
}

/* Table row hover */
tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Select option styling for dark theme */
select option {
    background: #1e293b;
    color: #e2e8f0;
}

/* Responsive table min-width */
@media (max-width: 640px) {
    table {
        min-width: 400px;
    }

    #bulkTable {
        min-width: 600px;
    }
}

/* Loading spinner */
.spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* ==============================
   THEME-AWARE TEXT HELPER
   ============================== */
.th-text-heading {
    color: #ffffff;
}

/* ==============================
   LIGHT THEME OVERRIDES
   ============================== */
[data-theme="light"] body {
    background: #f1f5f9 !important;
    color: #1e293b !important;
}

[data-theme="light"] nav {
    background: rgba(255, 255, 255, 0.92) !important;
    border-bottom-color: rgba(0, 0, 0, 0.08) !important;
}

[data-theme="light"] .card {
    background: rgba(255, 255, 255, 0.85) !important;
    border-color: rgba(0, 0, 0, 0.08) !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .input,
[data-theme="light"] .input-sm,
[data-theme="light"] .bulk-input,
[data-theme="light"] .filter-input {
    background: rgba(0, 0, 0, 0.03) !important;
    border-color: rgba(0, 0, 0, 0.15) !important;
    color: #1e293b !important;
}

[data-theme="light"] .input:focus,
[data-theme="light"] .input-sm:focus {
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12) !important;
}

[data-theme="light"] .input::placeholder,
[data-theme="light"] .filter-input::placeholder,
[data-theme="light"] .bulk-input::placeholder {
    color: #94a3b8 !important;
}

[data-theme="light"] select option {
    background: #ffffff !important;
    color: #1e293b !important;
}

[data-theme="light"] .tab-btn {
    color: #64748b;
}

[data-theme="light"] .tab-btn:hover {
    color: #1e293b;
    background: rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .tab-btn.active {
    color: #1e40af;
    background: rgba(59, 130, 246, 0.1);
}

[data-theme="light"] .th-text-heading {
    color: #0f172a !important;
}

[data-theme="light"] tbody tr:hover {
    background: rgba(0, 0, 0, 0.02) !important;
}

[data-theme="light"] .btn-secondary {
    background: rgba(0, 0, 0, 0.04) !important;
    border-color: rgba(0, 0, 0, 0.12) !important;
    color: #475569 !important;
}

[data-theme="light"] .btn-secondary:hover {
    background: rgba(0, 0, 0, 0.08) !important;
    color: #1e293b !important;
}

[data-theme="light"] .btn-icon {
    color: #94a3b8;
}

[data-theme="light"] .btn-icon:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #1e293b;
}

[data-theme="light"] .group-header:hover {
    background: rgba(0, 0, 0, 0.03) !important;
}

[data-theme="light"] .group-header td {
    border-bottom-color: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .label {
    color: #475569;
}

[data-theme="light"] .badge-green {
    background: rgba(22, 163, 74, 0.1);
    color: #16a34a;
}

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

[data-theme="light"] .badge-amber {
    background: rgba(217, 119, 6, 0.1);
    color: #d97706;
}

[data-theme="light"] .badge-blue {
    background: rgba(37, 99, 235, 0.1);
    color: #2563eb;
}

[data-theme="light"] .val-positive {
    color: #16a34a;
}

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

[data-theme="light"] .val-zero {
    color: #94a3b8;
}

[data-theme="light"] ::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15) !important;
}

[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25) !important;
}

[data-theme="light"] #toast .backdrop-blur-lg {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .spinner {
    border-color: rgba(0, 0, 0, 0.1);
    border-top-color: #3b82f6;
}

/* ==============================
   CASH COUNTER (Kalkulator koverti)
   ============================== */
.cash-counter-card {
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.cash-counter-btn {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.25);
    color: #10b981;
    border-radius: 0.5rem;
    padding: 0.45rem;
    transition: all 0.2s;
}

.cash-counter-btn:hover {
    background: rgba(16, 185, 129, 0.2);
    border-color: rgba(16, 185, 129, 0.5);
}

.cash-denom-row {
    padding: 0.35rem 0;
}

.cash-denom-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 4.5rem;
    padding: 0.2rem 0.6rem;
    border-radius: 0.5rem;
    font-size: 0.8rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.cash-adj-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 0.375rem;
    background: rgba(255, 255, 255, 0.05);
    color: #94a3b8;
    font-size: 1.1rem;
    font-weight: 700;
    border: 1px solid rgba(255, 255, 255, 0.08);
    cursor: pointer;
    transition: all 0.15s;
    user-select: none;
}

.cash-adj-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
}

.cash-adj-btn:active {
    transform: scale(0.92);
}

.cash-qty-input {
    width: 3.5rem;
    text-align: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.375rem;
    color: #e2e8f0;
    font-size: 0.875rem;
    font-weight: 600;
    padding: 0.25rem 0.25rem;
    font-variant-numeric: tabular-nums;
    -moz-appearance: textfield;
}

.cash-qty-input::-webkit-outer-spin-button,
.cash-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.cash-qty-input:focus {
    outline: none;
    border-color: rgba(59, 130, 246, 0.5);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.cash-subtotal {
    font-variant-numeric: tabular-nums;
}

/* Cash counter - light theme */
[data-theme="light"] .cash-counter-card {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.1);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .cash-counter-btn {
    background: rgba(16, 185, 129, 0.08);
    border-color: rgba(16, 185, 129, 0.3);
}

[data-theme="light"] .cash-adj-btn {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.1);
    color: #475569;
}

[data-theme="light"] .cash-adj-btn:hover {
    background: rgba(0, 0, 0, 0.08);
    color: #1e293b;
}

[data-theme="light"] .cash-qty-input {
    background: #f8fafc;
    border-color: rgba(0, 0, 0, 0.12);
    color: #1e293b;
}

[data-theme="light"] .cash-qty-input:focus {
    border-color: rgba(59, 130, 246, 0.5);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

[data-theme="light"] .cash-subtotal {
    color: #64748b;
}

/* ==============================
   ITEM HISTORY MODAL
   ============================== */
.item-history-card {
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

[data-theme="light"] .item-history-card {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.1);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}