/* =====================================================================
   CimViewWebApi site styling
   Ported from CimViewWebLogin (Kadence-inspired look).
   Loads AFTER bootstrap.min.css and kadence-theme.css so these rules win.
   ===================================================================== */

html {
    font-size: 16px;
    height: 100%;
    position: relative;
    min-height: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--global-palette2);
    background: var(--global-palette9);
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

.site {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ================================
   Header
   ================================ */
.site-header {
    background: linear-gradient(135deg, #132243 0%, #1e4a7a 100%);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.site-header-row {
    padding: 1rem 0;
}

.site-branding a.brand {
    color: #ffffff;
    text-decoration: none;
}

/* ================================
   Navigation
   ================================ */
.header-navigation {
    font-size: 1rem;
}

.header-navigation .menu {
    display: flex;
    flex-wrap: wrap;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 0.25rem;
    align-items: center;
    justify-content: center;
}

/* Both plain links and form-wrapped buttons look identical in the header */
.header-navigation .menu-item > a,
.header-navigation .menu-item .link-button-nav {
    color: rgba(255, 255, 255, 0.9);
    padding: 0.6em 1em;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 0.95rem;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    line-height: 1.5;
}

.header-navigation .menu-item > a:hover,
.header-navigation .menu-item .link-button-nav:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

.header-navigation .menu-item > a i,
.header-navigation .menu-item .link-button-nav i {
    color: var(--cimview-accent);
}

.header-navigation .menu-item > a:hover i,
.header-navigation .menu-item .link-button-nav:hover i {
    color: #ffffff;
}

/* The forms that wrap some nav buttons must not break the flex row */
.header-navigation .menu-item form.nav-form {
    display: inline-flex;
    align-items: center;
    margin: 0;
    padding: 0;
}

/* ================================
   Content Area
   ================================ */
#inner-wrap {
    flex: 1;
    padding: 3rem 0;
}

.content-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* White panel that wraps all API view content so text/tables stay readable
   on the dark navy body (the API views are not individually card-wrapped). */
.content-card {
    background: #ffffff;
    color: var(--global-palette-text);
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 2.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
    overflow-x: auto;
}

.content-card h1,
.content-card h2,
.content-card h3,
.content-card h4 {
    color: var(--global-palette-text);
    font-weight: 700;
    line-height: 1.3;
    margin-top: 0;
}

.content-card h1 { font-size: 2rem; }
.content-card h2 { font-size: 1.75rem; }
.content-card h3 { font-size: 1.4rem; }

.content-card a {
    color: #2b6cb0;
}

.content-card a:hover {
    color: #2c5282;
}

/* ================================
   Card Styles (for views that use .card explicitly)
   ================================ */
.card {
    background: #ffffff;
    border: 1px solid var(--global-palette7);
    border-radius: 8px;
    padding: 2.5rem;
    margin: 2rem auto;
    max-width: 600px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.3s ease;
    color: var(--global-palette-text);
}

.card:hover {
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.15);
}

.card h1,
.card h2 {
    color: var(--global-palette1);
    margin-bottom: 1rem;
    font-weight: 700;
}

.card h1 { font-size: 2rem; }
.card h2 { font-size: 1.75rem; }

.card p {
    color: var(--global-palette-text);
    line-height: 1.7;
    margin-bottom: 1.5rem;
}

/* ================================
   Form Styles
   ================================ */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label,
.content-card form label {
    display: block;
    margin-bottom: 0.5rem;
    color: #4a5568;
    font-weight: 600;
}

/* Style both .form-control and bare inputs/selects/textareas so every view
   looks consistent even where markup omits the Bootstrap class. */
.content-card .form-control,
.content-card input:not([type]),
.content-card input[type="text"],
.content-card input[type="email"],
.content-card input[type="password"],
.content-card input[type="number"],
.content-card input[type="search"],
.content-card input[type="tel"],
.content-card input[type="url"],
.content-card input[type="date"],
.content-card select,
.content-card textarea {
    width: 100%;
    max-width: 500px;
    padding: 0.65rem 0.9rem;
    border: 1px solid #cbd5e0;
    border-radius: 6px;
    font-size: 1rem;
    color: var(--global-palette-text);
    background-color: #ffffff;
    transition: all 0.2s ease;
    box-sizing: border-box;
    margin-bottom: 0.5rem;
}

.content-card .form-control:focus,
.content-card input:focus,
.content-card select:focus,
.content-card textarea:focus {
    outline: none;
    border-color: #3182ce;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.15);
}

.content-card input:disabled,
.content-card .form-control:disabled {
    background-color: #f3f4f6;
    color: #9ca3af;
    border-color: #d1d5db;
    cursor: not-allowed;
}

/* Bootstrap checkbox/radio inputs must not stretch full width */
.content-card input[type="checkbox"],
.content-card input[type="radio"] {
    width: auto;
    max-width: none;
    margin-right: 0.4rem;
}

.content-card input::placeholder,
.content-card textarea::placeholder {
    color: #a0aec0;
}

/* Long free-text areas (e.g. email bodies) may run wider than inputs. */
.content-card textarea {
    max-width: 800px;
}

/* File inputs: keep Bootstrap's padding so the "Choose file" button
   sits flush with the field edges. */
.content-card input[type="file"].form-control {
    padding: 0.375rem 0.75rem;
}

/* Every field row in a view form gets the same vertical rhythm. */
.content-card form > div {
    margin-bottom: 1rem;
}

/* Label + control stack. Views are inconsistent about whether the <label>
   comes before or after its input, so always render the label on top. */
.content-card .form-field {
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.content-card .form-field > label {
    order: -1;
}

/* Inline checkbox + label row */
.content-card .form-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.content-card .form-checkbox label,
.content-card .form-checkbox input[type="checkbox"] {
    margin: 0;
}

/* ================================
   Button Styles
   ================================ */
.btn {
    display: inline-block;
    padding: 0.65rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
}

.btn-primary {
    background: var(--global-palette-btn-bg);
    color: var(--global-palette-btn);
    box-shadow: 0 2px 8px rgba(236, 122, 35, 0.35);
}

.btn-primary:hover:not(:disabled) {
    background: var(--global-palette-btn-bg-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(236, 122, 35, 0.5);
    color: var(--global-palette-btn-hover);
    text-decoration: none;
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.btn-primary:disabled {
    background: #d1d5db;
    color: #9ca3af;
    cursor: not-allowed;
    box-shadow: none;
    opacity: 0.6;
}

.btn-secondary {
    background: #ffffff;
    color: var(--global-palette-text);
    border: 1px solid #cbd5e0;
}

.btn-secondary:hover {
    background: #f7fafc;
    border-color: #a0aec0;
    text-decoration: none;
}

/* ================================
   Alerts
   ================================ */
.alert {
    padding: 1rem 1.25rem;
    border-radius: 6px;
    margin: 1.5rem 0;
    border: 1px solid transparent;
}

.alert-info    { background: #dbeafe; border-color: #93c5fd; color: #1e40af; }
.alert-success { background: #d1fae5; border-color: #6ee7b7; color: #065f46; }
.alert-danger  { background: #fee2e2; border-color: #fca5a5; color: #991b1b; }
.alert-warning { background: #fef3c7; border-color: #fcd34d; color: #92400e; }

/* Validation messages */
.text-danger {
    color: #dc3545;
    font-size: 0.875rem;
    display: block;
    margin-top: 0.25rem;
    font-weight: 500;
}

/* ================================
   Footer
   ================================ */
.footer-links a {
    color: var(--cimview-accent);
    text-decoration: none;
    margin: 0 0.25rem;
}

.footer-links a:hover {
    color: var(--cimview-accent-hover);
    text-decoration: underline;
}

/* =====================================================================
   API-specific utility classes (preserved from the original API styling)
   ===================================================================== */

/* Home page link list */
ul.centerlist {
    display: inline-block;
    text-align: left;
}

/* Inline text-link buttons used inside forms (e.g. internal nav, home page) */
.link-button {
    background: none;
    border: none;
    color: #2b6cb0;
    text-decoration: none;
    cursor: pointer;
    padding: 0;
    font: inherit;
}

.link-button:hover {
    text-decoration: underline;
}

.link-button:focus {
    outline: none;
}

/* Forms rendered inline (home page app links) */
form.inline,
.internal_nav form {
    display: inline;
    padding: 0;
    margin: 0;
}

/* Sub-navigation bar shown at the top of many admin/app views */
.internal_nav ul {
    background-color: #eef2f7;
    list-style: none;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    margin-bottom: 1.5rem;
}

.internal_nav li {
    list-style: none;
    padding-right: 15px;
    display: inline;
}

.internal_nav span {
    background-color: transparent;
}

.result_list {
    padding-left: 25px;
    padding-top: 25px;
}

/* Bordered key/value and listing tables on the admin detail pages */
.data-table {
    border-collapse: collapse;
    margin-bottom: 1.5rem;
}

.data-table th,
.data-table td {
    border: 1px solid #e2e8f0;
    padding: 0.5rem 0.9rem;
    text-align: left;
    vertical-align: middle;
}

.data-table th {
    background: #f7fafc;
    color: #4a5568;
    font-weight: 600;
}

.box-shadow {
    box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05);
}

/* =====================================================================
   Hero landing pages (Home, Account index).
   The photo backdrop shows through instead of the white .content-card,
   and link lists render as orange, icon-bearing rows to match the
   CimViewWebLogin landing look. Opt in per view with:
       ViewData["BodyClass"] = "hero-page";
   ===================================================================== */
.hero-page .content-card {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    overflow: visible;
    color: var(--cimview-text);
}

/* Links inside the hero card are orange (not the blue used elsewhere). */
.hero-page .content-card a {
    color: var(--cimview-accent);
}

.hero-page .content-card a:hover {
    color: var(--cimview-accent-hover);
}

.hero-wrap {
    max-width: var(--global-content-narrow-width, 800px);
    color: var(--cimview-text);
}

.hero-wrap h1 {
    color: var(--cimview-text);
    font-size: 2.25rem;
    font-weight: 700;
    margin: 0 0 0.75rem;
}

.hero-wrap .hero-lead {
    color: var(--global-palette4);
    font-size: 1.05rem;
    margin: 0 0 2rem;
}

.hero-wrap .hero-links-title {
    color: var(--cimview-text);
    font-size: 1.15rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid rgba(236, 122, 35, 0.4);
    padding-bottom: 0.5rem;
    margin: 0 0 1rem;
}

.account-links {
    list-style: none;
    margin: 0 0 2rem;
    padding: 0;
    display: grid;
    gap: 0.2rem;
}

.account-links li {
    margin: 0;
}

/* Form-wrapped nav buttons must occupy a full row like the plain links. */
.account-links form.inline,
.account-links form.nav-form {
    display: block;
    margin: 0;
    padding: 0;
}

/* Both plain links and form-wrapped buttons render as identical
   orange, icon-bearing rows. */
.account-links a,
.account-links .link-button {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    width: 100%;
    padding: 0.7rem 1rem;
    color: var(--cimview-accent);
    font-family: inherit;
    font-weight: 600;
    font-size: 1.05rem;
    text-align: left;
    text-decoration: none;
    background: none;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.account-links a i,
.account-links .link-button i {
    color: var(--cimview-accent);
    font-size: 1.1rem;
    width: 1.5rem;
    text-align: center;
    flex: 0 0 auto;
    transition: transform 0.2s ease;
}

.account-links a:hover,
.account-links .link-button:hover {
    background: rgba(236, 122, 35, 0.12);
    color: var(--cimview-accent-hover);
    text-decoration: none;
}

.account-links a:hover i,
.account-links .link-button:hover i {
    color: var(--cimview-accent-hover);
    transform: translateX(3px);
}

/* Same hero look on the plain navy body, without the photo backdrop
   (the app index pages). Opt in with:
       ViewData["BodyClass"] = "hero-page hero-plain";               */
body.hero-plain::before {
    display: none;
}

/* Wide variant for content that needs more than the narrow hero column. */
.hero-wrap.hero-wide {
    max-width: none;
}

/* ---- Downloads page (hero-styled) ---- */
.download-scroll {
    overflow-x: auto;
}

.download-table {
    table-layout: fixed;
    border-bottom: 1px solid rgba(240, 240, 240, 0.15);
    margin: 0 0 1.25rem;
}

.download-table th {
    color: var(--cimview-text);
    font-weight: 600;
    font-size: 1.05rem;
    padding: 0.5rem 0.5rem 0;
}

.download-table td {
    padding: 0.5rem;
}

.download-table tr.download-row {
    border-bottom: 1px solid rgba(240, 240, 240, 0.15);
}

.download-table td.download-version {
    color: var(--global-palette4);
    font-weight: 600;
    padding-right: 1rem;
    white-space: nowrap;
}

/* Download buttons: orange outline rows instead of the white secondary button. */
.hero-page .download-table .btn-secondary {
    background: transparent;
    color: var(--cimview-accent);
    border: 1px solid rgba(236, 122, 35, 0.6);
    margin: 0;
}

.hero-page .download-table .btn-secondary:hover {
    background: rgba(236, 122, 35, 0.12);
    border-color: var(--cimview-accent-hover);
    color: var(--cimview-accent-hover);
}

.download-older {
    margin-top: 1.5rem;
}

.download-older summary {
    color: var(--cimview-accent);
    font-weight: 600;
    font-size: 1.05rem;
    cursor: pointer;
    margin-bottom: 1rem;
}

.download-older summary:hover {
    color: var(--cimview-accent-hover);
}

@media (max-width: 768px) {
    .content-card {
        padding: 1.5rem;
    }

    #inner-wrap {
        padding: 1.5rem 0;
    }
}
