﻿/* Themis Frontend Styles */

:root {
    /* Light mode variables */
    --themis-bg: #f8f9fa;
    --themis-sidebar-bg: #ffffff;
    --themis-header-bg: #ffffff;
    --themis-card-bg: #ffffff;
    --themis-text-primary: #212529;
    --themis-text-secondary: #6c757d;
    --themis-border: #dee2e6;
    --themis-shadow: rgba(0, 0, 0, 0.1);
}

.rz-dark {
    /* Dark mode variables */
    --themis-bg: #1a1a2e;
    --themis-sidebar-bg: #16213e;
    --themis-header-bg: #16213e;
    --themis-card-bg: #0f3460;
    --themis-text-primary: #f8f9fa;
    --themis-text-secondary: #adb5bd;
    --themis-border: #2a2a4e;
    --themis-shadow: rgba(0, 0, 0, 0.3);
}

html, body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

#app {
    min-height: 100vh;
}

/* Login container */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 6.25rem);
    padding: 1rem;
}

/* KPI Cards */
.kpi-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.kpi-card:hover {
    transform: translateY(-0.125rem);
    box-shadow: 0 0.25rem 0.75rem var(--themis-shadow);
}

/* Radzen Layout Overrides */
.rz-layout {
    min-height: 100vh;
}

.rz-sidebar {
    background: var(--themis-sidebar-bg);
    border-right: 0.0625rem solid var(--themis-border);
}

.rz-header {
    background: var(--themis-header-bg);
    border-bottom: 0.0625rem solid var(--themis-border);
}

.rz-body {
    background: var(--themis-bg);
}

/* Panel Menu Styles */
.rz-panel-menu {
    padding: 0.5rem;
}

.rz-panel-menu-item {
    border-radius: 0.25rem;
    margin: 0.125rem 0;
}

/* Responsive adjustments */
@media (max-width: 48rem) {
    /* M13: Content fills full width when sidebar is hidden */
    .rz-sidebar {
        width: 100% !important;
        position: fixed;
        z-index: 1000;
        top: 0;
        left: 0;
        height: 100vh;
        transition: transform 0.3s ease;
    }

    .rz-body {
        margin-left: 0 !important;
        width: 100% !important;
    }

    .rz-layout > .rz-body {
        flex: 1 1 100% !important;
    }
    
    .login-container {
        padding: 0.5rem;
    }
    
    /* M10: Dashboard cards full-width on mobile */
    .kpi-card {
        margin-bottom: 0.5rem;
        width: 100% !important;
    }

    .rz-col, .rz-col-12, [class*="rz-col-"] {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }

    /* M11: Headings wrap properly on mobile */
    .rz-text-h3, h1, h2, h3 {
        font-size: 1.25rem !important;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    /* M12: Validation messages stack below fields on mobile */
    .rz-form-field {
        margin-bottom: 0.5rem;
    }

    .rz-message {
        font-size: 0.75rem;
        white-space: normal;
        word-wrap: break-word;
    }

    /* M14: Sidebar backdrop overlay on mobile */
    .rz-sidebar-overlay {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }
}

@media (max-width: 36rem) {
    .rz-header .rz-stack > :not(:first-child) {
        display: none;
    }
    
    .rz-header .rz-button {
        padding: 0.5rem;
    }
}

/* Loading states */
.rz-progress-bar-circular {
    z-index: 9999;
}

/* Form fields */
.rz-form-field {
    width: 100%;
}

/* Cards */
.rz-card {
    border-radius: 0.5rem;
    box-shadow: 0 0.125rem 0.5rem var(--themis-shadow);
}

/* Data list items */
.rz-datalist-data > div {
    border-bottom: 0.0625rem solid var(--themis-border);
}

/* Sidebar overlay - hidden by default, visible only on mobile */
.rz-sidebar-overlay {
    display: none;
}

.rz-datalist-data > div:last-child {
    border-bottom: none;
}

/* Chart container */
.rz-chart {
    min-height: 12.5rem;
}

/* Blazor error UI */
#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -0.0625rem 0.125rem 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;
}

/* Loading progress */
.loading-progress {
    position: relative;
    display: block;
    width: 8rem;
    height: 8rem;
    margin: 20vh auto 1rem auto;
}

.loading-progress circle {
    fill: none;
    stroke: #e0e0e0;
    stroke-width: 0.6rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: #1b6ec2;
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

.loading-progress-text:after {
    content: var(--blazor-load-percentage-text, "Loading");
}
