/* Global Styles */
html, body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
    font-size: 16px; /* Base font size for rem calculations */
}

/* Standardized text sizes across all pages */
* {
    font-size: inherit;
}

h1 { font-size: 2rem; } /* 32px - Large headers */
h2 { font-size: 1.75rem; } /* 28px - Medium headers */
h3 { font-size: 1.5rem; } /* 24px - Sub headers */
h4 { font-size: 1.25rem; } /* 20px - Small headers */
h5 { font-size: 1.125rem; } /* 18px - Smaller headers */
h6 { font-size: 1rem; } /* 16px - Smallest headers */

/* Page content - standardized for consistent readability */
p, div, span, li, label {
    font-size: 1rem; /* 16px - standard page content */
}

/* Form inputs and buttons */
input, select, textarea, button {
    font-size: 0.875rem; /* 14px - form elements */
}

/* Page containers - consistent sizing */
.page-content, .patients-container, .page, main, article {
    font-size: 1rem; /* 16px - consistent content */
}

/* Table and list specific content */
table, table td, table th, ul li, ol li {
    font-size: 0.9375rem; /* 15px - table/list content */
}

/* Login Page Specific Styles */
.login-container {
    min-height: 100vh;
    height: 100vh;
    width: 100vw;
    background: linear-gradient(135deg, #8e9aaf 0%, #7a8599 100%);
    background-color: #8e9aaf; /* Greyish fallback */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    margin: 0;
    position: fixed;
    top: 0;
    left: 0;
}

.login-card {
    background: white;
    border-radius: 10px;
    padding: 40px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
    min-width: 350px;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo {
    width: auto;
    height: 60px;
    margin-bottom: 20px;
}

.login-title {
    color: #4a90e2;
    font-size: 2.5rem; /* 40px - larger for title */
    font-weight: 600;
    margin-bottom: 5px;
}

.login-subtitle {
    color: #666;
    font-size: 1.5rem; /* 24px - matching global standard */
    margin-bottom: 0;
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 5px;
    color: #333;
    font-weight: 500;
    font-size: 1.5rem; /* 24px - matching global standard */
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1.5rem; /* 24px - matching global standard */
    transition: border-color 0.3s;
    box-sizing: border-box;
}

.form-input:focus {
    outline: none;
    border-color: #4a90e2;
    box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.1);
}

.form-input[type="password"] {
    font-family: text-security-disc;
}

.login-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    font-size: 15px; /* Increased from 14px */
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 5px;
}

.remember-me input[type="checkbox"] {
    margin: 0;
}

.forgot-password {
    color: #4a90e2;
    text-decoration: none;
}

.forgot-password:hover {
    text-decoration: underline;
}

.signin-button {
    width: 100%;
    background-color: #4a90e2;
    color: white;
    padding: 14px;
    border: none;
    border-radius: 6px;
    font-size: 17px; /* Increased from 16px */
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s;
}

.signin-button:hover {
    background-color: #357abd;
}

.signin-button:active {
    background-color: #2563eb;
}

.login-footer {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
    font-size: 12px;
    color: #999;
}

.error-message {
    color: #dc2626;
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    padding: 10px;
    margin-bottom: 15px;
    font-size: 14px;
}

.validation-errors {
    color: #dc2626;
    font-size: 14px;
    margin-bottom: 15px;
}

.validation-errors ul {
    margin: 0;
    padding-left: 20px;
}

/* Regular page styles */
.page {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.sidebar {
    background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%);
}

.top-row {
    background-color: #f7f7f7;
    border-bottom: 1px solid #d6d5d5;
    justify-content: flex-end;
    height: 3.5rem;
    display: flex;
    align-items: center;
}

.top-row ::deep a, .top-row ::deep .btn-link {
    white-space: nowrap;
    margin-left: 1.5rem;
    text-decoration: none;
}

.top-row ::deep a:hover, .top-row ::deep .btn-link:hover {
    text-decoration: underline;
}

.top-row ::deep a:first-child {
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 640.98px) {
    .top-row:not(.auth) {
        display: none;
    }

    .top-row.auth {
        justify-content: space-between;
    }

    .top-row ::deep a, .top-row ::deep .btn-link {
        margin-left: 0;
    }
}

@media (min-width: 641px) {
    .page {
        flex-direction: row;
    }

    .sidebar {
        width: 250px;
        height: 100vh;
        position: sticky;
        top: 0;
    }

    .top-row {
        position: sticky;
        top: 0;
        z-index: 1;
    }

    .top-row.auth ::deep a:first-child {
        flex: 1;
        text-align: right;
        width: 0;
    }

    .top-row, article {
        padding-left: 2rem !important;
        padding-right: 1.5rem !important;
    }
}

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

.btn {
    display: inline-block;
    font-weight: 400;
    line-height: 1.5;
    color: #212529;
    text-align: center;
    text-decoration: none;
    vertical-align: middle;
    cursor: pointer;
    user-select: none;
    background-color: transparent;
    border: 1px solid transparent;
    padding: 0.5rem 1rem; /* Increased padding for larger buttons */
    font-size: 1.05rem; /* Increased from 1rem */
    border-radius: 0.25rem;
    transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.btn-primary {
    color: #fff;
    background-color: #0d6efd;
    border-color: #0d6efd;
}

.btn-primary:hover {
    color: #fff;
    background-color: #0b5ed7;
    border-color: #0a58ca;
}

.btn-secondary {
    color: #fff;
    background-color: #6c757d;
    border-color: #6c757d;
}

.btn-secondary:hover {
    color: #fff;
    background-color: #5c636a;
    border-color: #565e64;
}

/* Uniform Input and Button Classes */
:root {
    /* Standard input/button dimensions based on Patient Page reference */
    --input-height: 48px;
    --input-padding: 14px 18px;
    --input-font-size: 16px;
    --input-border: 1px solid #ddd;
    --input-border-radius: 5px;
    --input-focus-color: #007bff;

    --button-height: 48px;
    --button-padding: 14px 24px;
    --button-font-size: 16px;
    --button-border-radius: 5px;

    /* Search box specific (with icon space) */
    --search-padding-left: 50px;
}

.uniform-input,
.uniform-textbox {
    width: 100%;
    height: var(--input-height);
    padding: var(--input-padding);
    font-size: var(--input-font-size);
    border: var(--input-border);
    border-radius: var(--input-border-radius);
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: white;
}

/* Search boxes get extra left padding for icon */
.uniform-search {
    width: 100%;
    height: var(--input-height);
    padding: 14px 18px 14px var(--search-padding-left);
    font-size: var(--input-font-size);
    border: var(--input-border);
    border-radius: var(--input-border-radius);
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: white;
}

.uniform-input:focus,
.uniform-textbox:focus,
.uniform-search:focus {
    outline: none;
    border-color: var(--input-focus-color);
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.uniform-select {
    width: 100%;
    height: var(--input-height);
    padding: var(--input-padding);
    font-size: var(--input-font-size);
    border: var(--input-border);
    border-radius: var(--input-border-radius);
    background-color: white;
    cursor: pointer;
    box-sizing: border-box;
}

.uniform-button,
.uniform-btn {
    height: var(--button-height);
    padding: var(--button-padding);
    font-size: var(--button-font-size);
    border: none;
    border-radius: var(--button-border-radius);
    cursor: pointer;
    font-weight: 500;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, transform 0.1s;
    box-sizing: border-box;
}

.uniform-button:hover,
.uniform-btn:hover {
    transform: translateY(-1px);
}

.uniform-button:active,
.uniform-btn:active {
    transform: translateY(0);
}

/* Smaller button variant for compact spaces */
.uniform-button-small,
.uniform-btn-sm {
    height: 36px;
    padding: 8px 16px;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Button variants */
.uniform-button-primary {
    background-color: #4a90e2;
    color: white;
}

.uniform-button-primary:hover {
    background-color: #357abd;
}

.uniform-button-secondary {
    background-color: #6c757d;
    color: white;
}

.uniform-button-secondary:hover {
    background-color: #5c636a;
}

.uniform-button-success {
    background-color: #28a745;
    color: white;
}

.uniform-button-success:hover {
    background-color: #218838;
}

.uniform-button-danger {
    background-color: #dc3545;
    color: white;
}

.uniform-button-danger:hover {
    background-color: #c82333;
}

/* Responsive UI - All Supported Resolutions */
/* Base: Works for 1920x1080 and above */

/* Dialog and Modal sizing */
:root {
    --modal-width: min(90vw, 600px);
    --modal-padding: 30px;
    --dialog-width: min(85vw, 500px);
}

/* Responsive helpers */
.responsive-grid {
    display: grid;
    gap: 20px;
}

.responsive-flex {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

/* 4K Resolution - 3840×2160 */
@media (min-width: 3840px) and (min-height: 2160px) {
    :root {
        font-size: 18px;
    }
}

/* Tablet - iPad Pro 12.9" - 2732×2048 */
@media (min-width: 2732px) and (max-width: 3839px) and (min-height: 2048px) and (max-height: 2159px) {
    :root {
        font-size: 17px;
        --modal-width: min(88vw, 700px);
        --modal-padding: 28px;
    }
}

/* 2K/QHD Desktop and Tablet - 2560×1440 and 2560×1600 */
@media (min-width: 2560px) and (max-width: 2731px) and (min-height: 1440px) {
    :root {
        font-size: 17px;
    }
}

/* Tablet - iPad Pro 11" and similar - 2048×1536 */
@media (min-width: 2048px) and (max-width: 2559px) and (min-height: 1536px) and (max-height: 1599px) {
    :root {
        font-size: 16px;
        --modal-width: min(88vw, 650px);
        --modal-padding: 26px;
    }
}

/* Full HD - 1920×1080 (default baseline for desktops and tablets) */
@media (min-width: 1920px) and (max-width: 2047px) and (min-height: 1080px) {
    :root {
        font-size: 16px;
    }
}

/* HD+ - 1440×900 */
@media (min-width: 1440px) and (max-width: 1919px) and (min-height: 900px) and (max-height: 1079px) {
    :root {
        font-size: 15px;
        --modal-width: min(90vw, 550px);
        --modal-padding: 25px;
    }
}

/* HD - 1366×768 */
@media (min-width: 1366px) and (max-width: 1439px) and (min-height: 768px) and (max-height: 899px) {
    :root {
        font-size: 14px;
        --modal-width: min(85vw, 500px);
        --modal-padding: 20px;
        --input-height: 42px;
        --input-padding: 12px 16px;
        --input-font-size: 14px;
        --button-height: 42px;
        --button-padding: 12px 20px;
        --button-font-size: 14px;
        --search-padding-left: 45px;
    }

    .uniform-search {
        padding: 12px 16px 12px 45px;
    }

    .uniform-button-small,
    .uniform-btn-sm {
        height: 32px;
        padding: 6px 14px;
        font-size: 13px;
    }
}

/* Tablet - 1280×800 (common Android tablet resolution) */
@media (min-width: 1280px) and (max-width: 1365px) and (min-height: 800px) and (max-height: 899px) {
    :root {
        font-size: 14px;
        --modal-width: min(88vw, 520px);
        --modal-padding: 22px;
        --input-height: 44px;
        --input-padding: 12px 16px;
        --input-font-size: 14px;
        --button-height: 44px;
        --button-padding: 12px 20px;
        --button-font-size: 14px;
        --search-padding-left: 44px;
    }

    .uniform-search {
        padding: 12px 16px 12px 44px;
    }

    .uniform-button-small,
    .uniform-btn-sm {
        height: 32px;
        padding: 6px 14px;
        font-size: 13px;
    }
}

/* HD Ready - 1280×720 */
@media (min-width: 1280px) and (max-width: 1365px) and (min-height: 720px) and (max-height: 799px) {
    :root {
        font-size: 13px;
        --modal-width: min(90vw, 480px);
        --modal-padding: 18px;
        --input-height: 38px;
        --input-padding: 10px 14px;
        --input-font-size: 13px;
        --button-height: 38px;
        --button-padding: 10px 18px;
        --button-font-size: 13px;
        --search-padding-left: 40px;
    }

    .uniform-search {
        padding: 10px 14px 10px 40px;
    }

    .uniform-button-small,
    .uniform-btn-sm {
        height: 30px;
        padding: 5px 12px;
        font-size: 12px;
    }

    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
}

/* Tablet and smaller */
@media (max-width: 1279px) {
    :root {
        --modal-width: 95vw;
        --modal-padding: 15px;
    }

    .responsive-flex {
        flex-direction: column;
    }
}

.table {
    width: 100%;
    margin-bottom: 1rem;
    color: #212529;
    border-collapse: collapse;
    font-size: 15px; /* Explicit table font size */
}

.table th,
.table td {
    padding: 0.75rem; /* Increased from 0.5rem for better spacing */
    vertical-align: top;
    border-top: 1px solid #dee2e6;
}

.table thead th {
    vertical-align: bottom;
    border-bottom: 2px solid #dee2e6;
    font-size: 16px; /* Slightly larger headers */
    font-weight: 600;
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(0, 0, 0, 0.05);
}

/* Standardized List/Table Styles (Based on System Logs Design) */
.standard-list-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.standard-list-table th {
    background: #f8f9fa;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #dee2e6;
    font-size: 14px;
    white-space: nowrap;
}

.standard-list-table td {
    padding: 12px;
    border-bottom: 1px solid #dee2e6;
    font-size: 13px;
    color: #555;
    vertical-align: middle;
}

.standard-list-table tr:hover {
    background: #f8f9fa;
    cursor: pointer;
}

/* Standard list container */
.standard-list-container {
    overflow-x: auto;
    margin-bottom: 20px;
}

/* Standard pagination */
.standard-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-top: 1px solid #dee2e6;
}

.standard-pagination-info {
    color: #666;
    font-size: 14px;
}

.standard-pagination-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.standard-pagination-btn {
    padding: 6px 12px;
    border: 1px solid #ddd;
    background: white;
    color: #333;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.standard-pagination-btn:hover:not(:disabled) {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.standard-pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.standard-page-number {
    padding: 0 10px;
    color: #333;
    font-weight: 500;
    font-size: 14px;
}

/* Standardized Dialog/Modal Styles - Responsive with vw/vh units */
.standard-dialog-box {
    background: white;
    border-radius: 8px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    padding: 0;
    margin: 0 auto;
    position: relative;
}

/* Dialog size variants */
.standard-dialog-large {
    width: 70vw;
    max-width: 1200px;
}

.standard-dialog-medium {
    width: 60vw;
    max-width: 900px;
}

.standard-dialog-small {
    width: 40vw;
    max-width: 600px;
    min-width: 400px;
}

/* Responsive adjustments for different resolutions */
@media (max-width: 1600px) {
    .standard-dialog-large {
        width: 75vw;
    }

    .standard-dialog-medium {
        width: 65vw;
    }

    .standard-dialog-small {
        width: 50vw;
    }
}

@media (max-width: 1280px) {
    .standard-dialog-large {
        width: 85vw;
    }

    .standard-dialog-medium {
        width: 75vw;
    }

    .standard-dialog-small {
        width: 60vw;
        min-width: 350px;
    }
}

@media (max-width: 768px) {
    .standard-dialog-large,
    .standard-dialog-medium,
    .standard-dialog-small {
        width: 95vw;
        min-width: unset;
    }
}

/* Standard dialog overlay */
.standard-dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* Standard dialog header */
.standard-dialog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid #dee2e6;
}

.standard-dialog-header h3 {
    margin: 0;
    color: #333;
    font-size: 20px;
    font-weight: 600;
}

/* Standard dialog body */
.standard-dialog-body {
    padding: 25px;
}

/* Standard dialog footer */
.standard-dialog-footer {
    border-top: 1px solid #dee2e6;
    padding: 20px 25px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Standard dialog close button */
.standard-dialog-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.standard-dialog-close:hover {
    color: #333;
}