/* Base styles that use design tokens */

html,
body {
    height: 100%;
}

body {
    margin: 0;
    background: var(--tf-bg-body);
    color: var(--tf-text-main);
    font-family: var(--tf-font-family-base);
    font-size: 16px;
    /* ensures 1rem = 16px for clearer typography */
    line-height: var(--tf-line-height-base);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    -webkit-text-size-adjust: 100%;
}

.tf-container {
    max-width: var(--tf-container-max-width);
    margin: 0 auto;
    padding: var(--tf-space-4);
}

.tf-app {
    min-height: 100%;
    background: var(--tf-bg-body);
    color: var(--tf-text-main);
}

.tf-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    min-height: 100vh;
}

.tf-main {
    min-width: 0;
}

.tf-page {
    width: 100%;
    max-width: var(--tf-container-max-width);
    margin: 0 auto;
    padding: var(--tf-space-4);
}

.tf-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--tf-space-3);
    margin-bottom: var(--tf-space-4);
}

.tf-page-title {
    margin: 0;
    color: var(--tf-text-main);
    font-size: var(--tf-font-size-xl);
    line-height: var(--tf-line-height-heading);
}

.tf-action-bar {
    display: flex;
    align-items: center;
    gap: var(--tf-space-2);
    flex-wrap: wrap;
}

.tf-filter-panel {
    display: grid;
    gap: var(--tf-space-3);
    margin-bottom: var(--tf-space-4);
    padding: var(--tf-space-4);
    background: var(--tf-bg-surface);
    border: var(--tf-border-default);
    border-radius: var(--tf-radius-lg);
}

h1,
h2,
h3,
h4,
h5 {
    margin: 0 0 var(--tf-space-3) 0;
}

/* Simple RTL support */
:root[dir='rtl'] {
    direction: rtl;
}

/* Improve default heading sizes for readability */
h1 {
    font-size: 1.75rem;
    font-weight: 700
}

h2 {
    font-size: 1.25rem;
    font-weight: 600
}

h3 {
    font-size: 1rem;
    font-weight: 600
}

/* loading state for tables */
.tf-loading {
    padding: 0.75rem 1rem;
    background: var(--tf-bg-surface);
    border: 1px solid var(--tf-border-color);
    border-radius: 6px;
    color: var(--tf-text-muted);
}

.tf-empty {
    padding: 1.5rem;
    text-align: center;
    color: var(--tf-text-muted);
}

@media (max-width: 640px) {
    .tf-page-header {
        align-items: stretch;
        flex-direction: column;
    }

    .tf-action-bar {
        width: 100%;
    }
}
