/* ========================================
   AccountsManager - Tailwind CSS Customizations
   Theme Variables and Size Scaling System
   ======================================== */

/* Base styles */
html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

/* ========================================
   Table Base Styles (Tailwind CDN doesn't include these)
   ======================================== */

table {
    border-collapse: collapse;
    width: 100%;
}

th, td {
    text-align: left;
    vertical-align: middle;
}

/* Ensure table headers and cells don't wrap awkwardly */
th {
    font-weight: 600;
    white-space: nowrap;
}

/* Table text alignment helpers */
.text-right {
    text-align: right !important;
}

.text-center {
    text-align: center !important;
}

/* Table cell padding consistency */
table th,
table td {
    padding: 0.75rem 1rem;
}

/* Table borders for better visual structure */
table thead {
    border-bottom: 2px solid #e5e7eb;
}

.dark table thead {
    border-bottom: 2px solid #374151;
}

table tbody tr {
    border-bottom: 1px solid #e5e7eb;
}

.dark table tbody tr {
    border-bottom: 1px solid #374151;
}

table tfoot {
    border-top: 2px solid #e5e7eb;
}

.dark table tfoot {
    border-top: 2px solid #374151;
}

/* ========================================
   Grid and Flex Layout Utilities
   (Ensures layouts work with Tailwind CDN)
   ======================================== */

.grid {
    display: grid !important;
}

.flex {
    display: flex !important;
}

.flex-col {
    flex-direction: column !important;
}

.flex-wrap {
    flex-wrap: wrap !important;
}

.flex-1 {
    flex: 1 1 0% !important;
}

.items-center {
    align-items: center !important;
}

.items-end {
    align-items: flex-end !important;
}

.justify-center {
    justify-content: center !important;
}

.justify-between {
    justify-content: space-between !important;
}

.justify-end {
    justify-content: flex-end !important;
}

.gap-1 {
    gap: 0.25rem !important;
}

.gap-2 {
    gap: 0.5rem !important;
}

.gap-3 {
    gap: 0.75rem !important;
}

.gap-4 {
    gap: 1rem !important;
}

.space-y-3 > * + * {
    margin-top: 0.75rem;
}

.space-y-4 > * + * {
    margin-top: 1rem;
}

/* Grid columns */
.grid-cols-1 {
    grid-template-columns: repeat(1, minmax(0, 1fr)) !important;
}

.grid-cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}

.grid-cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
}

.col-span-2 {
    grid-column: span 2 / span 2 !important;
}

.col-span-3 {
    grid-column: span 3 / span 3 !important;
}

/* Responsive grid - md breakpoint (768px) */
@media (min-width: 768px) {
    .md\:grid-cols-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    .md\:grid-cols-3 {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }

    .md\:grid-cols-4 {
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    }

    .md\:grid-cols-6 {
        grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
    }

    .md\:col-span-2 {
        grid-column: span 2 / span 2 !important;
    }

    .md\:col-span-3 {
        grid-column: span 3 / span 3 !important;
    }

    .md\:flex-row {
        flex-direction: row !important;
    }

    .md\:w-64 {
        width: 16rem !important;
    }

    .md\:w-1\/2 {
        width: 50% !important;
    }

    .md\:w-1\/3 {
        width: 33.333333% !important;
    }
}

/* Width utilities */
.w-full {
    width: 100%;
}

.w-4 {
    width: 1rem;
}

.w-8 {
    width: 2rem;
}

.h-4 {
    height: 1rem;
}

.h-8 {
    height: 2rem;
}

.h-14 {
    height: 3.5rem;
}

.min-h-screen {
    min-height: 100vh;
}

.min-w-0 {
    min-width: 0;
}

.max-w-md {
    max-width: 28rem;
}

/* ========================================
   Spacing Utilities
   ======================================== */

.p-4 {
    padding: 1rem;
}

.px-2 {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

.px-3 {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
}

.px-4 {
    padding-left: 1rem;
    padding-right: 1rem;
}

.py-1 {
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
}

.py-2 {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

.py-3 {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}

.py-8 {
    padding-top: 2rem;
    padding-bottom: 2rem;
}

.py-12 {
    padding-top: 3rem;
    padding-bottom: 3rem;
}

.mb-1 {
    margin-bottom: 0.25rem;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mb-3 {
    margin-bottom: 0.75rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.mt-1 {
    margin-top: 0.25rem;
}

.mt-2 {
    margin-top: 0.5rem;
}

.mt-3 {
    margin-top: 0.75rem;
}

.mt-4 {
    margin-top: 1rem;
}

.mr-2 {
    margin-right: 0.5rem;
}

.mr-4 {
    margin-right: 1rem;
}

.ml-2 {
    margin-left: 0.5rem;
}

.mx-4 {
    margin-left: 1rem;
    margin-right: 1rem;
}

.my-4 {
    margin-top: 1rem;
    margin-bottom: 1rem;
}

/* ========================================
   Display Utilities
   ======================================== */

.block {
    display: block;
}

.inline-block {
    display: inline-block;
}

.hidden {
    display: none;
}

@media (min-width: 768px) {
    .md\:block {
        display: block;
    }

    .md\:hidden {
        display: none;
    }
}

/* ========================================
   Border and Rounded Utilities
   ======================================== */

.rounded {
    border-radius: 0.25rem;
}

.rounded-md {
    border-radius: 0.375rem;
}

.rounded-lg {
    border-radius: 0.5rem;
}

.rounded-full {
    border-radius: 9999px;
}

.rounded-t-lg {
    border-top-left-radius: 0.5rem;
    border-top-right-radius: 0.5rem;
}

.border {
    border-width: 1px;
}

.border-b {
    border-bottom-width: 1px;
}

.border-t {
    border-top-width: 1px;
}

.border-2 {
    border-width: 2px;
}

.border-4 {
    border-width: 4px;
}

/* ========================================
   Shadow Utilities
   ======================================== */

.shadow {
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
}

.shadow-xl {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

/* ========================================
   Text Utilities
   ======================================== */

.text-xs {
    font-size: 0.75rem;
    line-height: 1rem;
}

.text-sm {
    font-size: 0.875rem;
    line-height: 1.25rem;
}

.text-lg {
    font-size: 1.125rem;
    line-height: 1.75rem;
}

.text-xl {
    font-size: 1.25rem;
    line-height: 1.75rem;
}

.text-2xl {
    font-size: 1.5rem;
    line-height: 2rem;
}

.font-medium {
    font-weight: 500;
}

.font-semibold {
    font-weight: 600;
}

.font-bold {
    font-weight: 700;
}

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.whitespace-nowrap {
    white-space: nowrap;
}

/* ========================================
   Overflow Utilities
   ======================================== */

.overflow-x-auto {
    overflow-x: auto;
}

.overflow-y-auto {
    overflow-y: auto;
}

.overflow-hidden {
    overflow: hidden;
}

/* ========================================
   Position Utilities
   ======================================== */

.relative {
    position: relative;
}

.absolute {
    position: absolute;
}

.fixed {
    position: fixed;
}

.sticky {
    position: sticky;
}

.inset-0 {
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
}

.top-0 {
    top: 0;
}

.bottom-0 {
    bottom: 0;
}

.left-0 {
    left: 0;
}

.right-0 {
    right: 0;
}

.z-10 {
    z-index: 10;
}

.z-50 {
    z-index: 50;
}

/* ========================================
   Animation Utilities
   ======================================== */

.animate-spin {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.transition-colors {
    transition-property: color, background-color, border-color;
    transition-duration: 150ms;
}

/* ========================================
   Cursor and Interaction Utilities
   ======================================== */

.cursor-pointer {
    cursor: pointer;
}

.disabled\:opacity-50:disabled {
    opacity: 0.5;
}

/* ========================================
   Color Utilities (borders, backgrounds, text)
   ======================================== */

/* Border colors */
.border-gray-200 {
    border-color: #e5e7eb;
}

.border-gray-300 {
    border-color: #d1d5db;
}

.border-gray-400 {
    border-color: #9ca3af;
}

.border-gray-600 {
    border-color: #4b5563;
}

.border-gray-700 {
    border-color: #374151;
}

.border-blue-600 {
    border-color: #2563eb;
}

.border-green-600 {
    border-color: #16a34a;
}

.border-red-200 {
    border-color: #fecaca;
}

.border-red-600 {
    border-color: #dc2626;
}

.border-yellow-600 {
    border-color: #ca8a04;
}

.border-t-transparent {
    border-top-color: transparent;
}

/* Background colors */
.bg-white {
    background-color: #ffffff;
}

.bg-black\/50 {
    background-color: rgba(0, 0, 0, 0.5);
}

.bg-gray-50 {
    background-color: #f9fafb;
}

.bg-gray-100 {
    background-color: #f3f4f6;
}

.bg-gray-600 {
    background-color: #4b5563;
}

.bg-gray-700 {
    background-color: #374151;
}

.bg-gray-800 {
    background-color: #1f2937;
}

.bg-gray-900 {
    background-color: #111827;
}

.bg-blue-50 {
    background-color: #eff6ff;
}

.bg-blue-100 {
    background-color: #dbeafe;
}

.bg-blue-600 {
    background-color: #2563eb;
}

.bg-green-100 {
    background-color: #dcfce7;
}

.bg-green-600 {
    background-color: #16a34a;
}

.bg-red-100 {
    background-color: #fee2e2;
}

.bg-red-600 {
    background-color: #dc2626;
}

.bg-yellow-50 {
    background-color: #fefce8;
}

.bg-yellow-100 {
    background-color: #fef9c3;
}

.bg-yellow-500 {
    background-color: #eab308;
}

.bg-cyan-50 {
    background-color: #ecfeff;
}

.bg-cyan-500 {
    background-color: #06b6d4;
}

/* Text colors */
.text-white {
    color: #ffffff;
}

.text-gray-100 {
    color: #f3f4f6;
}

.text-gray-200 {
    color: #e5e7eb;
}

.text-gray-300 {
    color: #d1d5db;
}

.text-gray-400 {
    color: #9ca3af;
}

.text-gray-500 {
    color: #6b7280;
}

.text-gray-600 {
    color: #4b5563;
}

.text-gray-700 {
    color: #374151;
}

.text-gray-900 {
    color: #111827;
}

.text-blue-100 {
    color: #dbeafe;
}

.text-blue-600 {
    color: #2563eb;
}

.text-blue-800 {
    color: #1e40af;
}

.text-green-100 {
    color: #dcfce7;
}

.text-green-200 {
    color: #bbf7d0;
}

.text-green-400 {
    color: #4ade80;
}

.text-green-600 {
    color: #16a34a;
}

.text-green-800 {
    color: #166534;
}

.text-red-100 {
    color: #fee2e2;
}

.text-red-200 {
    color: #fecaca;
}

.text-red-400 {
    color: #f87171;
}

.text-red-600 {
    color: #dc2626;
}

.text-red-800 {
    color: #991b1b;
}

.text-yellow-100 {
    color: #fef9c3;
}

.text-yellow-400 {
    color: #facc15;
}

.text-yellow-600 {
    color: #ca8a04;
}

.text-yellow-800 {
    color: #854d0e;
}

.text-cyan-100 {
    color: #cffafe;
}

.text-cyan-400 {
    color: #22d3ee;
}

.text-cyan-600 {
    color: #0891b2;
}

/* Dark mode variants */
.dark .dark\:bg-gray-600 {
    background-color: #4b5563;
}

.dark .dark\:bg-gray-700 {
    background-color: #374151;
}

.dark .dark\:bg-gray-800 {
    background-color: #1f2937;
}

.dark .dark\:bg-gray-900 {
    background-color: #111827;
}

.dark .dark\:bg-blue-900 {
    background-color: #1e3a8a;
}

.dark .dark\:bg-green-900 {
    background-color: #14532d;
}

.dark .dark\:bg-red-900 {
    background-color: #7f1d1d;
}

.dark .dark\:bg-yellow-900 {
    background-color: #713f12;
}

.dark .dark\:bg-cyan-900 {
    background-color: #164e63;
}

.dark .dark\:border-gray-600 {
    border-color: #4b5563;
}

.dark .dark\:border-gray-700 {
    border-color: #374151;
}

.dark .dark\:border-red-900 {
    border-color: #7f1d1d;
}

.dark .dark\:text-white {
    color: #ffffff;
}

.dark .dark\:text-gray-100 {
    color: #f3f4f6;
}

.dark .dark\:text-gray-200 {
    color: #e5e7eb;
}

.dark .dark\:text-gray-300 {
    color: #d1d5db;
}

.dark .dark\:text-gray-400 {
    color: #9ca3af;
}

.dark .dark\:text-blue-200 {
    color: #bfdbfe;
}

.dark .dark\:text-blue-400 {
    color: #60a5fa;
}

.dark .dark\:text-green-200 {
    color: #bbf7d0;
}

.dark .dark\:text-green-400 {
    color: #4ade80;
}

.dark .dark\:text-red-200 {
    color: #fecaca;
}

.dark .dark\:text-red-400 {
    color: #f87171;
}

.dark .dark\:text-yellow-200 {
    color: #fef08a;
}

.dark .dark\:text-yellow-400 {
    color: #facc15;
}

.dark .dark\:text-cyan-200 {
    color: #a5f3fc;
}

.dark .dark\:text-cyan-400 {
    color: #22d3ee;
}

/* Hover states */
.hover\:bg-blue-700:hover {
    background-color: #1d4ed8;
}

.hover\:bg-gray-700:hover {
    background-color: #374151;
}

.hover\:bg-green-700:hover {
    background-color: #15803d;
}

.hover\:bg-red-700:hover {
    background-color: #b91c1c;
}

.hover\:bg-gray-50:hover {
    background-color: #f9fafb;
}

.hover\:bg-gray-100:hover {
    background-color: #f3f4f6;
}

.hover\:bg-gray-600:hover {
    background-color: #4b5563;
}

.hover\:bg-blue-600:hover {
    background-color: #2563eb;
}

.hover\:bg-green-600:hover {
    background-color: #16a34a;
}

.hover\:bg-red-600:hover {
    background-color: #dc2626;
}

.hover\:bg-yellow-600:hover {
    background-color: #ca8a04;
}

.hover\:text-white:hover {
    color: #ffffff;
}

.hover\:text-gray-200:hover {
    color: #e5e7eb;
}

.hover\:text-gray-600:hover {
    color: #4b5563;
}

.hover\:opacity-70:hover {
    opacity: 0.7;
}

.hover\:underline:hover {
    text-decoration: underline;
}

.dark .dark\:hover\:bg-gray-600:hover {
    background-color: #4b5563;
}

.dark .dark\:hover\:bg-gray-700:hover {
    background-color: #374151;
}

.dark .dark\:hover\:text-gray-300:hover {
    color: #d1d5db;
}

/* List styles */
.list-disc {
    list-style-type: disc;
}

.list-inside {
    list-style-position: inside;
}

/* ========================================
   Size Scaling System
   - Small: 62.5% of base
   - Medium: 75% of base (default)
   - Large: 100% of base
   ======================================== */

:root {
    --base-font-size: 16px;
    --scale-factor: 0.75;
}

html.ui-size-small {
    --scale-factor: 0.625;
    font-size: 10px;  /* 16px * 0.625 */
}

html.ui-size-medium {
    --scale-factor: 0.75;
    font-size: 12px;  /* 16px * 0.75 */
}

html.ui-size-large {
    --scale-factor: 1;
    font-size: 16px;  /* 16px * 1 */
}

html {
    font-size: 12px;  /* Default to medium */
}

/* Scale specific elements proportionally */
.ui-size-small table {
    font-size: 0.85rem;
}

.ui-size-small .btn, .ui-size-small button {
    padding: 0.25rem 0.5rem;
}

.ui-size-medium table {
    font-size: 0.9rem;
}

.ui-size-large table {
    font-size: 1rem;
}

/* ========================================
   Form Focus States
   ======================================== */

input:focus, select:focus, textarea:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5);
}

/* ========================================
   Validation States
   ======================================== */

.valid.modified:not([type=checkbox]) {
    outline: 2px solid #22c55e;
}

.invalid {
    outline: 2px solid #ef4444;
}

.validation-message {
    color: #ef4444;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* ========================================
   Blazor Error Handling
   ======================================== */

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "An error has occurred."
}

#blazor-error-ui {
    background: #fef3c7;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

.dark #blazor-error-ui {
    background: #78350f;
    color: #fef3c7;
}

/* ========================================
   Smooth Transitions for Theme Changes
   ======================================== */

body, .card, .bg-white, .bg-gray-50, .bg-gray-100,
.border, .text-gray-900, .text-gray-700, .text-gray-500 {
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

/* ========================================
   Sidebar Gradient
   ======================================== */

.sidebar-gradient {
    background: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 100%) !important;
}

/* ========================================
   Custom Scrollbar (optional, for webkit browsers)
   ======================================== */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.dark ::-webkit-scrollbar-track {
    background: #374151;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.dark ::-webkit-scrollbar-thumb {
    background: #6b7280;
}

::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

.dark ::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* ========================================
   Table Row Hover States (for data tables)
   ======================================== */

.table-row-hover:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

.dark .table-row-hover:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

/* ========================================
   Print Styles
   ======================================== */

@media print {
    .no-print {
        display: none !important;
    }

    body {
        background: white !important;
        color: black !important;
    }
}
