/* Payroll-Lah - Singapore Payroll Management System Styles */
html, body {
    margin: 0;
    padding: 0;
    height: 100%;
}

#app {
    min-height: 100vh;
}

.loading-screen {
    background-color: #350666;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.loading-progress {
    position: relative;
    width: 80%;
    height: 4px;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    margin: 20px auto;
    max-width: 400px;
    overflow: hidden;
}

.loading-progress-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #c084fc, #ff9e7d);
    border-radius: 2px;
    animation: loading 1.5s ease-in-out infinite;
}

@keyframes loading {
    0% { width: 0%; left: 0; }
    50% { width: 70%; left: 15%; }
    100% { width: 0%; left: 100%; }
}

.loading-text {
    text-align: center;
    font-family: 'Roboto', sans-serif;
    font-size: 16px;
    color: #ffffff;
    margin-top: 16px;
}

#blazor-error-ui {
    background: #ffffe0;
    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;
}

/* Utility classes */
.text-center {
    text-align: center;
}

.mt-16 {
    margin-top: 64px;
}

.mb-4 {
    margin-bottom: 16px;
}

.mb-8 {
    margin-bottom: 32px;
}

.pa-4 {
    padding: 16px;
}

/* Login page styles */
.login-layout {
    position: relative;
}

.login-layout::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(26, 11, 46, 0.3);
    z-index: 0;
}

.login-layout > * {
    position: relative;
    z-index: 1;
}

.login-field .mud-input-root {
    color: #ffffff !important;
}

.login-field .mud-input-label.mud-input-label-outlined {
    background-color: #2d1b4e !important;
    color: rgba(255, 255, 255, 0.85) !important;
}

.login-field .mud-input-outlined-border {
    border-color: rgba(255, 255, 255, 0.3) !important;
}

.login-field .mud-input-outlined-border legend span {
    color: rgba(255, 255, 255, 0.85) !important;
    background-color: #2d1b4e !important;
    padding: 0 6px !important;
}

.login-field .mud-input:focus-within .mud-input-outlined-border {
    border-color: #ff9e7d !important;
    box-shadow: 0 0 0 1px #ff9e7d !important;
}

.login-field .mud-input-adornment-start .mud-icon-root {
    color: rgba(255, 255, 255, 0.6) !important;
}

.login-field .mud-input-helper-text {
    color: rgba(255, 255, 255, 0.5) !important;
}

.login-btn:hover {
    background: linear-gradient(135deg, #ff6b4a 0%, #fd9f5e 100%) !important;
    box-shadow: 0 4px 15px rgba(255, 126, 95, 0.4) !important;
}

/* Pay slip styles */
.payslip-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

.payslip-header {
    border-bottom: 2px solid #4b0973;
    padding-bottom: 16px;
    margin-bottom: 24px;
}

.payslip-section {
    margin-bottom: 24px;
}

.payslip-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #e0e0e0;
}

.payslip-total {
    font-weight: bold;
    background-color: #f5f5f5;
    padding: 12px;
    border-radius: 4px;
}

/* Dashboard background */
.dashboard-bg {
    background-image: url('../images/leaves_small.jpg');
    background-repeat: repeat;
    background-size: auto;
    min-height: calc(100vh - 64px);
    margin: -16px;
    padding: 16px;
}

.theme-dark .dashboard-bg {
    background-image: url('../images/leaves_small_dark.jpg');
}

/* Chat Widget Styles */
.chat-fab {
    position: fixed !important;
    bottom: 24px;
    right: 24px;
    z-index: 1300;
}

.chat-panel {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 35vw;
    height: 90vh;
    z-index: 1300;
    display: flex;
    flex-direction: column;
    border-radius: 12px;
    overflow: hidden;
    resize: both;
    min-width: 300px;
    min-height: 350px;
    max-width: calc(100vw - 48px);
    max-height: calc(100vh - 48px);
    background-color: #E6E6E6 !important;
}

.chat-panel::after {
    content: '';
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    cursor: nwse-resize;
    background: linear-gradient(135deg, transparent 50%, var(--mud-palette-text-secondary) 50%);
    opacity: 0.5;
    pointer-events: none;
    z-index: 1400;
}

.chat-header {
    flex-shrink: 0;
    height: 48px;
    min-height: 48px;
}

.chat-status {
    opacity: 0.8;
    line-height: 1;
}

.chat-messages {
    margin-top: 16px;
    flex-grow: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    scroll-behavior: smooth;
}

.chat-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 24px;
    text-align: center;
}

.chat-message-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    max-width: 100%;
}

.chat-message-user {
    justify-content: flex-end;
}

.chat-message-bot {
    justify-content: flex-start;
}

.chat-avatar {
    flex-shrink: 0;
}

.chat-bubble {
    padding: 10px 14px;
    border-radius: 16px;
    word-break: break-word;
}

.chat-bubble-user {
    border-bottom-right-radius: 4px;
    background-color: var(--mud-palette-primary);
    color: var(--mud-palette-primary-text);
    max-width: 75%;
}

.chat-bubble-bot {
    border-bottom-left-radius: 4px;
    background-color: var(--mud-palette-background-grey);
    max-width: 95%;
}

.chat-timestamp {
    display: block;
    margin-top: 4px;
    opacity: 0.7;
    font-size: 0.7rem;
}

.chat-input-area {
    flex-shrink: 0;
    padding: 8px 12px 12px 12px;
    border-top: 1px solid var(--mud-palette-divider);
}

.chat-input-field .mud-input-outlined-border {
    border-radius: 24px;
}

@media (max-width: 480px) {
    .chat-panel {
        width: calc(100vw - 32px);
        height: calc(100vh - 100px);
        bottom: 16px;
        right: 16px;
    }
}

/* Markdown rendering styles for chat messages */
.markdown-body {
    font-size: 0.875rem;
    line-height: 1.6;
    color: inherit;
}

.markdown-body :first-child {
    margin-top: 0;
}

.markdown-body :last-child {
    margin-bottom: 0;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
    margin-top: 12px;
    margin-bottom: 8px;
    font-weight: 600;
    line-height: 1.3;
    color: inherit;
}

.markdown-body h1 { font-size: 1.25rem; }
.markdown-body h2 { font-size: 1.1rem; }
.markdown-body h3 { font-size: 1rem; }
.markdown-body h4 { font-size: 0.95rem; }
.markdown-body h5 { font-size: 0.9rem; }
.markdown-body h6 { font-size: 0.85rem; }

.markdown-body p {
    margin-top: 0;
    margin-bottom: 8px;
}

.markdown-body strong,
.markdown-body b {
    font-weight: 600;
    color: inherit;
}

.markdown-body em,
.markdown-body i {
    font-style: italic;
}

.markdown-body a {
    color: var(--mud-palette-primary);
    text-decoration: underline;
    word-break: break-word;
}

.markdown-body a:hover {
    opacity: 0.8;
}

.markdown-body ul,
.markdown-body ol {
    margin-top: 4px;
    margin-bottom: 8px;
    padding-left: 20px;
}

.markdown-body ul {
    list-style-type: disc;
}

.markdown-body ol {
    list-style-type: decimal;
}

.markdown-body li {
    margin-bottom: 2px;
}

.markdown-body li > ul,
.markdown-body li > ol {
    margin-top: 2px;
    margin-bottom: 2px;
}

.markdown-body .table-wrapper {
    overflow-x: auto;
    max-width: 100%;
    width: 100%;
    min-width: 100%;
    margin-bottom: 8px;
    border-radius: 8px;
    border: 1px solid var(--mud-palette-divider);
}

.markdown-body table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    min-width: 300px;
}

.markdown-body thead {
    background-color: var(--mud-palette-background-grey);
}

.markdown-body th,
.markdown-body td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid var(--mud-palette-divider);
    vertical-align: top;
}

.markdown-body th {
    font-weight: 600;
    color: var(--mud-palette-text-primary);
    white-space: nowrap;
}

.markdown-body tbody tr:last-child td {
    border-bottom: none;
}

.markdown-body tbody tr:hover {
    background-color: rgba(128, 128, 128, 0.05);
}

.markdown-body blockquote {
    margin: 8px 0;
    padding: 8px 12px;
    border-left: 3px solid var(--mud-palette-primary);
    background-color: var(--mud-palette-background-grey);
    border-radius: 0 8px 8px 0;
    font-style: italic;
}

.markdown-body blockquote p:last-child {
    margin-bottom: 0;
}

.markdown-body code {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    background-color: rgba(128, 128, 128, 0.12);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8em;
    color: inherit;
}

.markdown-body pre {
    background-color: var(--mud-palette-background-grey);
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 8px 0;
}

.markdown-body pre code {
    background-color: transparent;
    padding: 0;
    font-size: 0.8em;
}

.markdown-body hr {
    border: none;
    border-top: 1px solid var(--mud-palette-divider);
    margin: 12px 0;
}

.markdown-body .task-list-item {
    list-style-type: none;
    padding-left: 0;
}

.markdown-body .contains-task-list {
    padding-left: 0;
    list-style-type: none;
}

/* Chat close button styles */
.chat-close-btn {
    border-radius: 50% !important;
    transition: background-color 0.2s ease;
}

.chat-close-btn:hover {
    background-color: rgba(255, 255, 255, 0.2) !important;
}

.chat-bottom-bar {
    display: flex;
    justify-content: space-between;
    padding-top: 4px;
    margin-top: 4px;
    border-top: 1px solid var(--mud-palette-divider);
}

.chat-bottom-clear-btn {
    text-transform: none;
    font-size: 0.75rem;
}

.chat-bottom-close-btn {
    text-transform: none;
    font-size: 0.75rem;
}
