/* -------------------------------------
   Global Styles
------------------------------------- */
body {
    background-color: var(--bg-primary, #f9f9f9ee);
    color: var(--text-primary, #333);
}

/* -------------------------------------
   Layout
------------------------------------- */
.container {
    padding-left: 2vw;
    padding-right: 2vw;
}

.container-box {
    width: 80%;
    height: auto;
    margin: 0 auto; /* Center the container */
    background-color: var(--bg-secondary, #ffffff);
    padding: 1.5vw;
    box-shadow: var(--shadow-md, 0 4px 8px rgba(0, 0, 0, 0.1));
    border-radius: 8px;
    overflow: visible; /* Ensure content is not clipped */
    display: flex;
    flex-direction: column;
}

.dashboard {
    display: flex;
    flex-wrap: wrap;
    padding: 1.5vw 2vw;
    margin: 1vw auto;
    max-width: 1500px;
    background-color: var(--bg-secondary, #ffffff);
    border-radius: 8px;
    box-shadow: var(--shadow-lg, 0 4px 12px rgba(0, 0, 0, 0.15));
}

.dashboard > div {
    padding: 0 0.5vw !important;
    display: flex;
    margin-bottom: 0 !important;
}

.dashboard *:focus,
.dashboard *:active,
.dashboard *:focus-visible {
    outline: none !important;
    box-shadow: none !important;
}

/* -------------------------------------
   Typography
------------------------------------- */
header {
    text-align: center;
    margin-bottom: 30px;
}

h2 {
    font-size: 1.25rem;
    display: inline-block;
}

.card-title {
    margin: 0;
    font-size: 1.25rem;
    line-height: 1.2;
    flex-grow: 1;
    display: flex;
    align-items: center; /* Center text vertically */
    justify-content: center; /* Center text horizontally */
    height: 40%;
    max-height: 80px;
}

/* -------------------------------------
   Navigation
------------------------------------- */
.navbar {
    background: var(--navbar-bg, linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%)) !important;
    box-shadow: var(--shadow-sm, 0 2px 8px rgba(0, 0, 0, 0.1));
    padding: 12px 24px;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.3rem;
    color: var(--link-color, #0066cc) !important;
    padding: 8px 16px;
    border-radius: 8px;
    background-color: var(--navbar-brand-bg, #ffffff);
    box-shadow: var(--navbar-brand-shadow, 0 2px 6px rgba(0, 102, 204, 0.15));
    transition: all 0.2s ease;
}

.navbar-brand:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 102, 204, 0.25);
    color: var(--link-hover, #0052a3) !important;
}

.navbar img {
    height: 30px; /* Adjust size for navbar icons */
    margin-right: 5px; /* Space between icon and text */
}

.navbar .nav-link {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    border-radius: 6px;
    transition: all 0.2s ease;
    color: var(--text-primary, #333);
    font-weight: 500;
}

.navbar .nav-link:hover {
    background-color: var(--bg-tertiary, rgba(255, 255, 255, 0.8));
    color: var(--link-color, #0066cc);
    transform: translateY(-1px);
}

.navbar .nav-link img {
    filter: grayscale(20%);
    transition: filter 0.2s ease;
}

.navbar .nav-link:hover img {
    filter: grayscale(0%);
}

/* -------------------------------------
   Components
------------------------------------- */
.client {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 1vw 0.75vw;
    margin: 0 0.3vw;
    background-color: transparent;
    border-radius: 8px;
    transition: all 0.2s ease;
    text-decoration: none;
    color: var(--text-primary, #333);
    min-height: 130px;
    max-height: 130px;
    flex: 1;
    box-sizing: border-box;
    box-shadow: none !important;
    outline: none !important;
}

.client:hover {
    background-color: var(--bg-tertiary, #f8f9fa);
    text-decoration: none;
    color: var(--link-color, #0066cc);
}

.client:focus,
.client:active,
.client:focus-visible {
    background-color: var(--bg-tertiary, #f8f9fa) !important;
    text-decoration: none !important;
    color: var(--link-color, #0066cc) !important;
    box-shadow: 0 0 0 2px var(--highlight-border, rgba(0, 102, 204, 0.2)) !important;
    outline: none !important;
    border: none !important;
}

.client img {
    width: 52px;
    height: 52px;
    object-fit: contain;
    margin-bottom: 12px;
    flex-shrink: 0;
    box-shadow: none !important;
    border: none;
}

.client:hover img {
    box-shadow: none !important;
}

.client div {
    text-align: center;
    font-weight: 600;
    font-size: 0.85rem;
    line-height: 1.2;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-height: 42px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

.card {
    display: inline-block;
    max-width: 20vw;
    margin-bottom: 20px;
    background-color: var(--card-bg, #ffffff);
    border-radius: 8px;
    box-shadow: var(--shadow-md, 0 4px 8px rgba(0, 0, 0, 0.1));
    overflow: hidden;
    padding: 16px;
    word-wrap: break-word; /* Allow word wrapping */
    text-align: left;
}

.card h5, .card p {
    margin: 0;
    padding-bottom: 8px;
}

/* Responsive settings to allow card wrap */
.list-group {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
}

.list-group-item {
    display: inline-block;
    max-width: 20vw;
    margin-bottom: 10px;
    padding: 10px;
    white-space: initial;
}

/* Ensure checkbox aligns with h2 font */
.form-check-input {
    transform: scale(1.5);
    margin-left: 10px;
    vertical-align: middle;
}

/* -------------------------------------
   Page Tiles (Core Page Grid)
------------------------------------- */
.page-tile {
    background-color: var(--card-bg, #ffffff);
    border: 1px solid var(--card-border, #e9ecef);
    border-radius: 8px;
    box-shadow: var(--shadow-sm, 0 2px 6px rgba(0, 0, 0, 0.08));
    transition: all 0.2s ease;
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.page-tile:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 16px rgba(0, 102, 204, 0.15);
    border-color: var(--link-color, #0066cc);
    text-decoration: none;
}

.page-tile .card-body {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.page-tile .card-title {
    color: var(--link-color, #0066cc);
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
    min-height: 2.6em;
    max-height: 2.6em;
}

.page-tile:hover .card-title {
    color: var(--link-hover, #0052a3);
}

.page-tile .card-text {
    color: var(--text-secondary, #6c757d);
    font-size: 0.875rem;
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
    min-height: 0;
}

/* Responsive grid gutters */
.row.g-3 {
    --bs-gutter-x: 1rem;
    --bs-gutter-y: 1rem;
}

/* -------------------------------------
   Page Editor
------------------------------------- */
.page-editor-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5vw;
    flex-direction: column;
}

.page-editor-header {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 30px;
    color: var(--text-primary, #333);
    text-align: left;
}

.page-editor-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    width: 100%;
}

.page-editor-col {
    background-color: var(--bg-secondary, #ffffff);
    border-radius: 8px;
    box-shadow: var(--shadow-sm, 0 2px 8px rgba(0, 0, 0, 0.08));
    padding: 30px;
}

.page-editor-form-section {
    margin-bottom: 20px;
}

.page-editor-form-section:last-child {
    margin-bottom: 0;
}

.page-editor-section-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--text-primary, #444);
    border-bottom: 2px solid var(--border-color, #e9ecef);
    padding-bottom: 10px;
}

.page-editor-assignments-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.page-editor-assignment-section {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.page-editor-list-container {
    background-color: var(--editor-list-bg, #f8f9fa);
    border-radius: 6px;
    padding: 15px;
}

.page-editor-list-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-tertiary, #495057);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.page-editor-connection-list {
    max-height: 180px;
    min-height: 120px;
    overflow-y: auto;
    border: 1px solid var(--border-color-secondary, #dee2e6);
    border-radius: 4px;
    padding: 0;
    list-style: none;
    background-color: var(--bg-secondary, #ffffff);
}

.page-editor-connection-list li {
    padding: 10px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid var(--editor-list-border, #f1f3f5);
    font-size: 0.9rem;
}

.page-editor-connection-list li:last-child {
    border-bottom: none;
}

.page-editor-connection-list li:hover {
    background-color: var(--highlight-bg, #e7f3ff);
    color: var(--link-color, #0066cc);
}

.page-editor-button-group {
    display: flex;
    gap: 10px;
    margin-top: 25px;
}

.page-editor-button-group .btn {
    padding: 10px 20px;
    font-weight: 500;
}

@media (max-width: 1024px) {
    .page-editor-row {
        grid-template-columns: 1fr;
    }

    .page-editor-assignments-grid {
        grid-template-columns: 1fr;
    }
}

/* -------------------------------------
   Front page options
------------------------------------- */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5vw;
    padding: 3vw;
    background-color: var(--bg-secondary, #ffffff);
    border-radius: 8px;
    box-shadow: var(--shadow-lg, 0 4px 12px rgba(0, 0, 0, 0.15));
}

.grid-item {
    display: flex;
    justify-content: center;
    align-items: center;
}

.grid-item a {
    width: 100%;
    transition: transform 0.2s ease;
}

.grid-item a:hover {
    transform: translateY(-4px);
}

.grid-item .card {
    max-width: 100%;
    border: 1px solid var(--border-color, #e9ecef);
    transition: all 0.2s ease;
}

.grid-item .card:hover {
    border-color: var(--link-color, #0066cc);
    box-shadow: 0 8px 16px rgba(0, 102, 204, 0.2);
}

.grid-item .card-body {
    padding: 24px;
}

.grid-item .card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary, #333);
    margin-top: 12px;
}

.icon {
    width: 50px;
    height: 50px;
}

/* -------------------------------------
   Login Container
------------------------------------- */
.login-container {
    background-color: var(--bg-secondary, white);
    padding: 40px;
    border-radius: 8px;
    box-shadow: var(--shadow-md, 0 4px 6px rgba(0, 0, 0, 0.1));
    text-align: center;
    max-width: 350px;
}
.login-container h1 {
    margin-bottom: 30px;
    font-size: 24px;
    color: var(--text-primary, #333);
}
.login-button {
    display: inline-block;
    padding: 12px 25px;
    font-size: 16px;
    color: white;
    background-color: #4285F4;
    border: none;
    border-radius: 4px;
    transition: background-color 0.3s ease;
    text-decoration: none;
}
.login-button:hover {
    background-color: #357ae8;
}

/* -------------------------------------
   Login Page Body
------------------------------------- */
.login-page-body {
    background-color: var(--login-bg, #f5f7fa);
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
}

/* -------------------------------------
   Logo Sizes
------------------------------------- */
.logo-medium {
    height: 48px;
}

/* -------------------------------------
   Form Field Widths
------------------------------------- */
.form-field-wide {
    max-width: 500px;
}

.form-field-medium {
    max-width: 400px;
}

.form-field-standard {
    max-width: 300px;
}

.form-field-narrow {
    max-width: 250px;
}

/* -------------------------------------
   Form Inputs
------------------------------------- */
input::placeholder,
textarea::placeholder,
select::placeholder {
    color: var(--placeholder-color, #bcc4cc);
    opacity: 1;
}

input::-webkit-input-placeholder,
textarea::-webkit-input-placeholder,
select::-webkit-input-placeholder {
    color: var(--placeholder-color, #bcc4cc);
    opacity: 1;
}

input::-moz-placeholder,
textarea::-moz-placeholder,
select::-moz-placeholder {
    color: var(--placeholder-color, #bcc4cc);
    opacity: 1;
}

input:-ms-input-placeholder,
textarea:-ms-input-placeholder,
select:-ms-input-placeholder {
    color: var(--placeholder-color, #bcc4cc);
    opacity: 1;
}

/* -------------------------------------
   Form Utilities
------------------------------------- */
.inline-header {
    display: inline;
}

.checkbox-spaced {
    margin-left: 10px;
}

/* -------------------------------------
   Button States
------------------------------------- */
.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.btn-loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 3px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spinner 0.6s linear infinite;
}

@keyframes spinner {
    to {
        transform: rotate(360deg);
    }
}

.btn-disabled-grey {
    background-color: #ccc !important;
    border-color: #ccc !important;
    cursor: not-allowed;
}

/* -------------------------------------
   Tables
------------------------------------- */
.table-responsive {
    overflow-x: auto;
    margin-top: 20px;
}

.table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 40px;
}

.table thead {
    background-color: var(--table-header-bg, #34495e);
    color: var(--table-header-text, white);
}

.table th,
.table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color-secondary, #ddd);
    color: var(--text-primary, #333);
}

.table tbody tr:hover {
    background-color: var(--table-row-hover, #f5f5f5);
}

.action button {
    padding: 8px 16px;
    cursor: pointer;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    font-weight: bold;
}

.action.retry button {
    background-color: #3498db;
    color: white;
}

.action.retry button:hover {
    background-color: #2980b9;
}

.action.reset button {
    background-color: #e67e22;
    color: white;
}

.action.reset button:hover {
    background-color: #d35400;
}

/* -------------------------------------
   Alerts & Messages
------------------------------------- */
.message {
    padding: 15px;
    background-color: var(--bg-tertiary, #ecf0f1);
    border-left: 4px solid #95a5a6;
    margin: 20px 0;
    color: var(--text-primary, #333);
}

/* -------------------------------------
   Hidden Elements (for JavaScript toggling)
------------------------------------- */
.hidden {
    display: none;
}

/* -------------------------------------
   Navbar Brand Colors
------------------------------------- */
.navbar-brand-ops {
    color: #5D6163;
}

.navbar-brand-dashboard {
    color: #F59D0F;
}

/* -------------------------------------
   Error Message Display
------------------------------------- */
.error-message-pre {
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* -------------------------------------
   ChangeAgency Page Styles
------------------------------------- */
.change-agency-spinner {
    width: 3rem;
    height: 3rem;
    margin: 2rem auto;
}

.change-agency-table th {
    background-color: var(--bg-tertiary, #f8f9fa);
    font-weight: 600;
}

.change-agency-table td {
    vertical-align: middle;
}

.use-agency-btn {
    white-space: nowrap;
}

.change-agency-form-text {
    font-size: 0.9rem;
    margin-top: 0.25rem;
    margin-bottom: 0.5rem;
}

#statusMessage .alert {
    margin-top: 1rem;
    position: relative;
    padding-right: 3rem;
}

.status-close-btn {
    position: absolute;
    top: 50%;
    right: 1rem;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    color: inherit;
    opacity: 0.5;
    cursor: pointer;
    padding: 0;
    width: 1.5rem;
    height: 1.5rem;
    transition: opacity 0.2s;
}

.status-close-btn:hover {
    opacity: 0.75;
}

.status-close-btn:focus {
    outline: none;
    opacity: 1;
}

.status-close-btn span {
    display: block;
    line-height: 1;
}

/* -------------------------------------
   UserStatus Page Styles
------------------------------------- */
.email-table-container {
    border: 1px solid var(--border-color-secondary, #dee2e6);
    border-radius: 0.25rem;
    padding: 1rem;
    background-color: var(--bg-tertiary, #f8f9fa);
}

.email-header {
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #007bff;
    color: var(--text-primary, #333);
}

.email-header .badge {
    font-size: 0.875rem;
    padding: 0.35em 0.65em;
    margin-left: 0.5rem;
}

.email-header .badge-dark {
    background-color: #343a40 !important;
    color: #fff !important;
}

.email-table-container .table {
    margin-bottom: 0;
    background-color: var(--bg-secondary, #fff);
}

.email-table-container .table thead th {
    background-color: var(--bg-tertiary, #e9ecef);
    font-weight: 600;
    border-bottom: 2px solid var(--border-color-secondary, #dee2e6);
}

.email-table-container .table tbody tr:hover {
    background-color: var(--table-row-hover, #f1f3f5);
}

.badge {
    font-size: 0.75rem;
    padding: 0.25em 0.5em;
}

.badge-danger {
    background-color: #dc3545 !important;
    color: #fff !important;
}

.badge-success {
    background-color: #28a745 !important;
    color: #fff !important;
}

.badge-secondary {
    background-color: #6c757d !important;
    color: #fff !important;
}

/* -------------------------------------
   TransitionBriefAudit Page Styles
------------------------------------- */
.brief-table-container {
    border: 1px solid var(--border-color-secondary, #dee2e6);
    border-radius: 0.25rem;
    padding: 1rem;
    background-color: var(--bg-tertiary, #f8f9fa);
}

.brief-header {
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #007bff;
    color: var(--text-primary, #333);
}

.brief-header .badge {
    font-size: 0.875rem;
    padding: 0.35em 0.65em;
    margin-left: 0.5rem;
}

.brief-header .badge-dark {
    background-color: #343a40 !important;
    color: #fff !important;
}

.brief-table-container .table {
    margin-bottom: 0;
    background-color: var(--bg-secondary, #fff);
}

.brief-table-container .table thead th {
    background-color: var(--bg-tertiary, #e9ecef);
    font-weight: 600;
    border-bottom: 2px solid var(--border-color-secondary, #dee2e6);
}

.brief-table-container .table tbody tr:hover {
    background-color: var(--table-row-hover, #f1f3f5);
}

/* -------------------------------------
   Unauthorized Page Styles
------------------------------------- */
.unauthorized-page {
    background-color: var(--login-bg, #f5f7fa);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.unauthorized-container {
    background-color: var(--bg-secondary, white);
    padding: 50px 40px;
    border-radius: 12px;
    box-shadow: var(--shadow-lg, 0 4px 12px rgba(0, 0, 0, 0.15));
    text-align: center;
    max-width: 600px;
    width: 100%;
}

.unauthorized-icon {
    font-size: 80px;
    color: #dc3545;
    margin-bottom: 20px;
}

.unauthorized-title {
    font-size: 32px;
    font-weight: 600;
    color: var(--text-primary, #333);
    margin-bottom: 15px;
}

.unauthorized-subtitle {
    font-size: 18px;
    color: var(--text-secondary, #666);
    margin-bottom: 25px;
}

.unauthorized-message {
    background-color: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 15px 20px;
    margin-bottom: 25px;
    text-align: left;
    border-radius: 4px;
}

.unauthorized-message strong {
    color: #856404;
}

.unauthorized-message p {
    margin: 8px 0;
    color: var(--text-primary, #856404);
}

.user-email {
    background-color: var(--bg-tertiary, #f8f9fa);
    padding: 10px 15px;
    border-radius: 4px;
    margin: 20px 0;
    font-family: monospace;
    color: var(--text-tertiary, #495057);
}

.action-buttons {
    margin-top: 30px;
}

.btn-retry {
    background-color: #4285F4;
    color: white;
    padding: 12px 30px;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    text-decoration: none;
    display: inline-block;
    margin: 5px;
}

.btn-retry:hover {
    background-color: #357ae8;
    color: white;
}

.btn-logout {
    background-color: #6c757d;
    color: white;
    padding: 12px 30px;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    text-decoration: none;
    display: inline-block;
    margin: 5px;
}

.btn-logout:hover {
    background-color: #5a6268;
    color: white;
}

/* -------------------------------------
   UpdateBriefSupplier Page Styles
------------------------------------- */
.update-brief-spinner {
    width: 3rem;
    height: 3rem;
    margin: 2rem auto;
}

.update-brief-table th {
    background-color: var(--bg-tertiary, #f8f9fa);
    font-weight: 600;
}

.update-brief-table td {
    vertical-align: middle;
}

.update-brief-form-text {
    font-size: 0.9rem;
    margin-top: 0.25rem;
    margin-bottom: 0.5rem;
}

#resultSection .alert {
    margin-top: 1rem;
    position: relative;
    padding-right: 3rem;
}

.alert-warning {
    border-left: 4px solid #ffc107;
}

.alert-info {
    border-left: 4px solid #17a2b8;
}