:root {
    --danger: #ef4444; /* Red 500 */
    --danger-light: #fef2f2;
    --warning: #f59e0b; /* Amber 500 */
    --font-family: 'Inter', sans-serif;
}

/* Color Schemes */
.app-container, .theme-blue {
    --primary: #2563eb; /* Blue 600 */
    --primary-hover: #1d4ed8; /* Blue 700 */
    --primary-light: #eff6ff; /* Blue 50 */
    --bg-content: #f8fafc;
    --bg-card: #ffffff;
    --text-color: #1e293b;
    --text-dark: #0f172a;
    --border-color: #e2e8f0;
    --header-bg: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}

.theme-emerald {
    --primary: #059669; /* Emerald 600 */
    --primary-hover: #047857; /* Emerald 700 */
    --primary-light: #ecfdf5; /* Emerald 50 */
    --header-bg: linear-gradient(135deg, #059669 0%, #0d9488 100%);
}

.theme-indigo {
    --primary: #4f46e5; /* Indigo 600 */
    --primary-hover: #4338ca; /* Indigo 700 */
    --primary-light: #eef2ff; /* Indigo 50 */
    --header-bg: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%);
}

.theme-amber {
    --primary: #d97706; /* Amber 600 */
    --primary-hover: #b45309; /* Amber 700 */
    --primary-light: #fffbeb; /* Amber 50 */
    --header-bg: linear-gradient(135deg, #d97706 0%, #b45309 100%);
}

/* Dark Scheme Override */
.theme-dark {
    --primary: #3b82f6; /* Blue 500 */
    --primary-hover: #60a5fa; /* Blue 400 */
    --primary-light: rgba(59, 130, 246, 0.15);
    --bg-content: #0f172a; /* Slate 900 */
    --bg-card: #1e293b; /* Slate 800 */
    --text-color: #f1f5f9; /* Slate 100 */
    --text-dark: #f8fafc; /* Slate 50 */
    --border-color: #334155; /* Slate 700 */
    --header-bg: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
}

html, body {
    background-color: var(--bg-content, #f8fafc);
    font-family: var(--font-family);
    margin: 0;
    padding: 0;
    color: var(--text-color, #1e293b);
    min-height: 100vh;
}

/* App Container Wrapper */
.app-container {
    width: 100%;
    min-height: 100vh;
    background-color: var(--bg-card);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Header */
.app-header {
    background: var(--header-bg);
    color: white;
    padding: 1.1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    z-index: 10;
    flex-shrink: 0;
}

.app-header h1 {
    font-size: 1.35rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.025em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Scrollable Content Area */
.app-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
    background-color: #f8fafc;
    position: relative;
}

/* Dropdown Overrides */
.dropdown-item {
    transition: background-color 0.15s ease, color 0.15s ease;
}
.dropdown-item:hover {
    background-color: var(--primary-light) !important;
    color: var(--primary-hover) !important;
}
.dropdown-item:active {
    background-color: var(--primary) !important;
    color: white !important;
}

/* Cards */
.splitz-card {
    background-color: white;
    border-radius: 1rem;
    border: 1px solid var(--border-color);
    padding: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.splitz-card-header {
    font-weight: 700;
    font-size: 1.05rem;
    margin-bottom: 0.75rem;
    color: var(--dark);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Premium Buttons */
.btn-emerald {
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 0.75rem;
    padding: 0.7rem 1.25rem;
    font-weight: 600;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-emerald:hover {
    background-color: var(--primary-hover);
    color: white;
    transform: translateY(-1px);
}

.btn-emerald:active {
    transform: translateY(0);
}

.btn-outline-emerald {
    background-color: transparent;
    color: var(--primary);
    border: 1.5px solid var(--primary);
    border-radius: 0.75rem;
    padding: 0.65rem 1.25rem;
    font-weight: 600;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-outline-emerald:hover {
    background-color: var(--primary-light);
    color: var(--primary-hover);
    transform: translateY(-1px);
}

/* Inputs */
.form-control-custom {
    border: 1.5px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 0.7rem 0.9rem;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    width: 100%;
}

.form-control-custom:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.15);
}

/* Form Checkboxes & Switches Theme Styling */
.form-check-input:checked {
    background-color: var(--primary) !important;
    border-color: var(--primary) !important;
}

.form-check-input:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 0.2rem var(--primary-light) !important;
}

.form-switch .form-check-input:checked {
    background-color: var(--primary) !important;
    border-color: var(--primary) !important;
}

/* Colors */
.balance-positive {
    color: var(--primary) !important;
    font-weight: 700;
}

.balance-negative {
    color: var(--danger) !important;
    font-weight: 700;
}

.balance-neutral {
    color: #64748b;
    font-weight: 600;
}

/* Badges */
.badge-settled {
    background-color: var(--primary-light);
    color: var(--primary);
    padding: 0.35rem 0.75rem;
    border-radius: 2rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-active {
    background-color: #eff6ff;
    color: #2563eb;
    padding: 0.35rem 0.75rem;
    border-radius: 2rem;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Modal Drawer Custom styling */
.bottom-drawer-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(15, 23, 42, 0.6);
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.bottom-drawer-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

.bottom-drawer {
    position: fixed;
    bottom: -100%;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 500px;
    background-color: white;
    border-radius: 1.5rem 1.5rem 0 0;
    box-shadow: 0 -10px 25px -5px rgba(0, 0, 0, 0.15);
    z-index: 1001;
    transition: bottom 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

.bottom-drawer.open {
    bottom: 0;
}

.bottom-drawer-header {
    padding: 1.25rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.bottom-drawer-header h5 {
    margin: 0;
    font-weight: 700;
    color: var(--dark);
}

.bottom-drawer-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: #64748b;
    cursor: pointer;
}

.bottom-drawer-body {
    padding: 1.25rem;
    overflow-y: auto;
    flex: 1;
}

/* Blazor custom UI overrides */
#blazor-error-ui {
    background: #fee2e2;
    color: #991b1b;
    bottom: 0;
    box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    font-size: 0.85rem;
    font-weight: 500;
}

#blazor-error-ui .reload {
    text-decoration: underline;
    color: #b91c1c;
    margin-left: 0.5rem;
    font-weight: 700;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.6rem;
    font-size: 1rem;
}

.list-group-item-custom {
    padding: 0.9rem 1.25rem;
    border-color: var(--border-color);
    transition: background-color 0.2s ease;
}

.list-group-item-custom:hover {
    background-color: #f8fafc;
}

/* QR Code & Share modal styles */
.share-code-box {
    background-color: #f1f5f9;
    border: 2px dashed #cbd5e1;
    border-radius: 0.75rem;
    padding: 1rem;
    font-family: monospace;
    font-size: 1.2rem;
    font-weight: bold;
    text-align: center;
    color: var(--dark);
    margin: 1rem 0;
    letter-spacing: 0.1em;
}

.qr-placeholder {
    width: 150px;
    height: 150px;
    margin: 1.5rem auto;
    background-color: white;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    padding: 0.5rem;
}

/* Dark Theme specific overrides */
.theme-dark {
    color: var(--text-color) !important;
}
.theme-dark.app-container {
    background-color: var(--bg-card) !important;
}
.theme-dark .app-content {
    background-color: var(--bg-content) !important;
}
.theme-dark .splitz-card {
    background-color: var(--bg-card) !important;
    border-color: var(--border-color) !important;
}
.theme-dark .text-dark {
    color: var(--text-dark) !important;
}
.theme-dark .text-slate-800 {
    color: #cbd5e1 !important;
}
.theme-dark .list-group-item-custom {
    border-color: var(--border-color) !important;
    background-color: var(--bg-card) !important;
    color: var(--text-color) !important;
}
.theme-dark .list-group-item-custom:hover {
    background-color: #334155 !important;
}
.theme-dark select, 
.theme-dark input, 
.theme-dark textarea {
    background-color: #1e293b !important;
    color: #f1f5f9 !important;
    border-color: var(--border-color) !important;
}
.theme-dark select:focus, 
.theme-dark input:focus, 
.theme-dark textarea:focus {
    background-color: #1e293b !important;
    color: #ffffff !important;
    border-color: var(--primary) !important;
}
.theme-dark .dropdown-menu {
    background-color: #1e293b !important;
    border-color: var(--border-color) !important;
    color: #f1f5f9 !important;
}
.theme-dark .dropdown-item {
    color: #f1f5f9 !important;
}
.theme-dark .dropdown-item:hover {
    background-color: #334155 !important;
    color: #ffffff !important;
}
.theme-dark .bg-light {
    background-color: #1e293b !important;
}
.theme-dark .alert-light {
    background-color: #1e293b !important;
    border-color: var(--border-color) !important;
    color: #f1f5f9 !important;
}
.theme-dark .alert-success {
    background-color: rgba(5, 150, 105, 0.15) !important;
    border-color: rgba(5, 150, 105, 0.3) !important;
    color: #6ee7b7 !important;
}
.theme-dark .btn-outline-secondary {
    color: #cbd5e1 !important;
    border-color: #475569 !important;
}
.theme-dark .btn-outline-secondary:hover {
    background-color: #334155 !important;
}
.theme-dark .bottom-drawer {
    background-color: var(--bg-card) !important;
    border-color: var(--border-color) !important;
}
.theme-dark .bottom-drawer-header {
    border-color: var(--border-color) !important;
}
.theme-dark .bottom-drawer-header h5 {
    color: var(--text-dark) !important;
}
.theme-dark .bottom-drawer-close {
    color: #cbd5e1 !important;
}
.theme-dark .border-top {
    border-color: var(--border-color) !important;
}
.theme-dark .border-bottom {
    border-color: var(--border-color) !important;
}
.theme-dark .border {
    border-color: var(--border-color) !important;
}
.theme-dark .share-code-box {
    background-color: #0f172a !important;
    border-color: var(--border-color) !important;
    color: #ffffff !important;
}
.theme-dark .nav-pills {
    background-color: #0f172a !important;
    border-color: var(--border-color) !important;
}
.theme-dark .nav-link:not(.active) {
    color: #94a3b8 !important;
}
.theme-dark .modal-content {
    background-color: var(--bg-card) !important;
    border-color: var(--border-color) !important;
    color: var(--text-color) !important;
}
.theme-dark .badge-settled {
    background-color: rgba(5, 150, 105, 0.15) !important;
    color: #34d399 !important;
}
.theme-dark .list-group-item {
    background-color: var(--bg-card) !important;
    color: var(--text-color) !important;
    border-color: var(--border-color) !important;
}
.theme-dark .form-text {
    color: #94a3b8 !important;
}

/* Theme Colors & Nav Pills selected overrides */
.text-theme {
    color: var(--primary) !important;
}

.nav-pills .nav-link.active {
    background-color: var(--primary) !important;
    color: white !important;
}

.nav-pills-custom .nav-link {
    font-size: 0.78rem !important;
    padding: 0.5rem 0.25rem !important;
    white-space: nowrap !important;
}