/* BlazorCommon - Shared Styles */

/* iOS Safari tab bar tint shim. 4px transparent fixed element in the
   bottom of the viewport — sits in Safari's tab bar sampling zone so
   the bar keeps its default translucent appearance instead of latching
   onto whatever page color happens to be at the bottom. Load-bearing
   despite looking empty: removing it lets iOS lock onto sampled colors
   (drawer panels etc.). Shared by every layout — after layout edits a
   hard refresh may be required to bust cached blazor-common.css. */
body::after {
    content: '';
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background-color: transparent;
    pointer-events: none;
    z-index: 99999;
}

:root {
    --primary-color: #0066CC;
    --secondary-color: #6C757D;
    --success-color: #28A745;
    --danger-color: #DC3545;
    --warning-color: #FFC107;
    --info-color: #17A2B8;
    --light-bg: #FFFFFF;
    --dark-bg: #1E1E1E;
    --light-text: #212529;
    --dark-text: #F8F9FA;
}

[data-theme="dark"] {
    --bg-color: var(--dark-bg);
    --text-color: var(--dark-text);
    --card-bg: #2D2D2D;
    --border-color: #444444;
}

[data-theme="light"] {
    --bg-color: var(--light-bg);
    --text-color: var(--light-text);
    --card-bg: #FFFFFF;
    --border-color: #E0E0E0;
}

/* Full viewport layout */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

#app, .main-layout {
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Drawer Styling */
.k-drawer-container .k-drawer {
    background-color: var(--card-bg);
    border-right: 1px solid var(--border-color);
}

.k-drawer-items .k-drawer-item {
    padding: 0.75rem 1rem;
    color: var(--text-color);
    transition: background-color 0.2s;
}

.k-drawer-items .k-drawer-item:hover {
    background-color: rgba(0, 102, 204, 0.1);
}

.k-drawer-items .k-drawer-item.k-selected {
    background-color: var(--primary-color);
    color: white;
}

/* Dark mode specific drawer styles */
[data-theme="dark"] .k-drawer {
    background: linear-gradient(180deg, #2D2D2D 0%, #1E1E1E 100%);
}

[data-theme="dark"] .k-drawer-items .k-drawer-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Login Component */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 1rem;
}

.login-card {
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    padding: 2rem;
    width: 100%;
    max-width: 400px;
    color: var(--text-color);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h1 {
    margin: 0 0 0.5rem 0;
    color: var(--primary-color);
    font-size: 2rem;
    font-weight: 300;
}

.login-subtitle {
    margin: 0;
    color: var(--secondary-color);
    font-size: 1.1rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-color);
}

.remember-label {
    margin-left: 0.5rem;
    /* !important beats Bootstrap's bold default on label elements. */
    font-weight: normal !important;
}

.login-additional {
    margin-top: 2rem;
    text-align: center;
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
}

.alert-danger {
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
    border-radius: 4px;
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

[data-theme="dark"] .alert-danger {
    color: #f8d7da;
    background-color: #721c24;
    border-color: #5a1a1a;
}

app, #app {
    height: 100vh;
    width: 100vw;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
}

/* Root wrapper to make TelerikRootComponent full size */
.root-wrapper {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/* Top level container classes */
.page {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100%;
    overflow: hidden;
}

.page-container {
    height: 100vh;
    width: 100vw;
}

/* Top row bar */
.top-row {
    height: 3.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0;
    background-color: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    width: 100%;
    box-sizing: border-box;
    z-index: 100;
    color: var(--text-color);
}

/* Left/Right content areas in top bar */
.left-content {
    padding-left: 0.5rem;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    overflow: hidden;
}

.right-content {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex: 1;
    padding-right: 1.5rem;
}

.right-content > a,
.right-content > div {
    margin-left: 1.5rem;
}

.top-row a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.top-row a:hover {
    text-decoration: underline;
}

/* Toggle button styling — !important beats Telerik k-button defaults
   (background/border/shadow/focus outline). */
.drawer-toggle-button {
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0.5rem;
}

.drawer-toggle-button:focus {
    outline: none !important;
}

/* !important beats Bootstrap's default anchor color so the logout link
   matches the primary color in both themes. */
.logout-link {
    color: var(--primary-color) !important;
    font-weight: 600;
    cursor: pointer;
}

/* Main container */
.main-container {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
    height: calc(100vh - 3.5rem);
    width: 100%;
}

/* Drawer styling */
.custom-drawer {
    width: 100%;
    height: 100%;
}

/* Force Telerik's k-drawer-content (and our wrapping main/.content) to
   fill the available row without scrolling — !important beats Telerik's
   own inline-style sizing that otherwise lets content overflow. */
.custom-drawer .k-drawer-content {
    overflow: hidden !important;
    height: 100% !important;
}

.custom-drawer .k-drawer-content > main {
    overflow: hidden !important;
    height: 100% !important;
}

.custom-drawer .k-drawer-content > main > .content {
    overflow: hidden !important;
    height: 100% !important;
}



.k-drawer-container {
    height: 100%;
    width: 100%;
}


/* Dark theme drawer gradient */
[data-theme="dark"] .k-drawer {
    background-image: linear-gradient(180deg, #001F3F 0%, #003366 100%);
    color: white;
}

/* Main content area */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    width: 100%;
    min-height: 0;
}

.content {
    padding: 0.8rem;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    width: 100%;
    box-sizing: border-box;
    animation: fadeIn 0.15s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Error UI */
#blazor-error-ui {
    background: #DC3545;
    color: white;
    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;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
    color: white;
}

#blazor-error-ui .reload {
    color: white;
    text-decoration: underline;
    font-weight: bold;
    margin-right: 1rem;
}

#blazor-error-ui .reload:hover {
    text-decoration: none;
}

/* Responsive layout */
@media (max-width: 640.98px) {
    .top-row {
        justify-content: space-between;
    }

    /* Hide non-essential items on small screens, keep toggle and logout */
    .top-row .right-content a[href*="anc.com"],
    .top-row .auth-status {
        display: none;
    }

    .top-row a, .top-row .btn-link {
        margin-left: 0;
    }

    main {
        margin-left: 0;
        width: 100%;
    }
}

@media (min-width: 641px) {
    main {
        transition: margin-left 0.3s ease-in-out;
    }
}

/* Telerik Utility Classes */
.k-mt-1 { margin-top: 0.25rem; }
.k-mt-2 { margin-top: 0.5rem; }
.k-mt-3 { margin-top: 1rem; }
.k-mt-4 { margin-top: 1.5rem; }
.k-mt-5 { margin-top: 3rem; }

.k-mb-1 { margin-bottom: 0.25rem; }
.k-mb-2 { margin-bottom: 0.5rem; }
.k-mb-3 { margin-bottom: 1rem; }
.k-mb-4 { margin-bottom: 1.5rem; }
.k-mb-5 { margin-bottom: 3rem; }

.k-ml-1 { margin-left: 0.25rem; }
.k-ml-2 { margin-left: 0.5rem; }
.k-ml-3 { margin-left: 1rem; }
.k-ml-4 { margin-left: 1.5rem; }
.k-ml-5 { margin-left: 3rem; }

.k-mr-1 { margin-right: 0.25rem; }
.k-mr-2 { margin-right: 0.5rem; }
.k-mr-3 { margin-right: 1rem; }
.k-mr-4 { margin-right: 1.5rem; }
.k-mr-5 { margin-right: 3rem; }

.k-pt-1 { padding-top: 0.25rem; }
.k-pt-2 { padding-top: 0.5rem; }
.k-pt-3 { padding-top: 1rem; }
.k-pt-4 { padding-top: 1.5rem; }
.k-pt-5 { padding-top: 3rem; }

.k-pb-1 { padding-bottom: 0.25rem; }
.k-pb-2 { padding-bottom: 0.5rem; }
.k-pb-3 { padding-bottom: 1rem; }
.k-pb-4 { padding-bottom: 1.5rem; }
.k-pb-5 { padding-bottom: 3rem; }

.k-pl-1 { padding-left: 0.25rem; }
.k-pl-2 { padding-left: 0.5rem; }
.k-pl-3 { padding-left: 1rem; }
.k-pl-4 { padding-left: 1.5rem; }
.k-pl-5 { padding-left: 3rem; }

.k-pr-1 { padding-right: 0.25rem; }
.k-pr-2 { padding-right: 0.5rem; }
.k-pr-3 { padding-right: 1rem; }
.k-pr-4 { padding-right: 1.5rem; }
.k-pr-5 { padding-right: 3rem; }

.k-w-100 { width: 100%; }
.k-h-100 { height: 100%; }

.k-d-flex { display: flex; }
.k-d-block { display: block; }
.k-d-inline { display: inline; }
.k-d-inline-block { display: inline-block; }
.k-d-none { display: none; }

.k-text-center { text-align: center; }
.k-text-left { text-align: left; }
.k-text-right { text-align: right; }
.k-text-muted { color: var(--secondary-color); opacity: 0.7; }

/* Bootstrap-style utility classes */
.align-center { align-items: center; }
.justify-center { justify-content: center; }
.align-items-center { align-items: center; }
.justify-content-center { justify-content: center; }
.align-items-start { align-items: flex-start; }
.justify-content-start { justify-content: flex-start; }
.align-items-end { align-items: flex-end; }
.justify-content-end { justify-content: flex-end; }
.justify-content-between { justify-content: space-between; }
.justify-content-around { justify-content: space-around; }

/* Utility Classes */
.flex-fill {
    flex: 1;
}

.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 1rem; }
.gap-4 { gap: 1.5rem; }

.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 1rem; }
.p-4 { padding: 1.5rem; }

.m-1 { margin: 0.25rem; }
.m-2 { margin: 0.5rem; }
.m-3 { margin: 1rem; }
.m-4 { margin: 1.5rem; }

