html {
    font-size: 14px;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

html {
    position: relative;
    min-height: 100%;
}

body {
    margin: 0;
    background-color: #d4cfc4;
    font-family: Arial, Helvetica, sans-serif;
}

/* Navbar */
.fai-navbar {
    background-color: #e8941a;
    padding: 10px 0;
}

.fai-logo {
    height: 60px;
    background-color: white;
    padding: 5px 10px;
    border-radius: 4px;
}

.fai-nav-link {
    color: #1a3a5c !important;
    font-weight: bold;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
}

.fai-nav-link:hover {
    color: #fff !important;
}

/* Hamburger toggler */
.fai-navbar .navbar-toggler {
    border-color: #1a3a5c;
    padding: 4px 8px;
}

.fai-navbar .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='%231a3a5c' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* Mobile collapsed menu */
@media (max-width: 991.98px) {
    .fai-navbar .navbar-collapse {
        background-color: #e8941a;
        padding: 10px 0;
        border-top: 1px solid rgba(26, 58, 92, 0.2);
        margin-top: 10px;
    }

    .fai-navbar .navbar-nav .nav-item {
        border-bottom: 1px solid rgba(26, 58, 92, 0.15);
    }

    .fai-navbar .navbar-nav .nav-item:last-child {
        border-bottom: none;
    }

    .fai-navbar .fai-nav-link {
        padding: 10px 15px;
        font-size: 1rem;
    }
}

/* Login page */
.login-wrapper {
    display: flex;
    justify-content: center;
    padding: 60px 20px;
}

.login-card {
    background-color: #e8941a;
    border-radius: 16px;
    padding: 40px 50px;
    max-width: 500px;
    width: 100%;
}

.login-title {
    text-align: center;
    color: #1a3a5c;
    font-weight: bold;
    margin-bottom: 30px;
    font-size: 1.8rem;
}

.login-label {
    color: #1a3a5c;
    font-weight: bold;
    display: block;
    text-align: center;
    margin-bottom: 5px;
}

.login-input {
    background-color: #e8e0f0;
    border: none;
    border-radius: 6px;
    padding: 10px 15px;
    font-size: 1rem;
}

.login-input:focus {
    background-color: #fff;
    box-shadow: 0 0 0 0.2rem rgba(26, 58, 92, 0.25);
}

.btn-login {
    background-color: #1a3a5c;
    color: #fff;
    font-weight: bold;
    padding: 8px 40px;
    border-radius: 4px;
    font-size: 1rem;
}

.btn-login:hover {
    background-color: #15304d;
    color: #fff;
}

.btn-request-access {
    background-color: #fff;
    color: #1a6aad;
    font-weight: 600;
    padding: 10px 20px;
    border-radius: 6px;
    width: 100%;
    font-size: 0.95rem;
}

.btn-request-access:hover {
    background-color: #f0f0f0;
    color: #1a3a5c;
}

/* CAPTCHA */
.captcha-section {
    background-color: rgba(26, 58, 92, 0.12);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
}

.captcha-image {
    border: 1px solid #ccc;
    border-radius: 6px;
    user-select: none;
    -webkit-user-drag: none;
}

.captcha-refresh {
    color: #1a3a5c;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
}

.captcha-refresh:hover {
    text-decoration: underline;
}

/* Search clear button */
.btn-clear-search {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 1.4rem;
    color: #999;
    cursor: pointer;
    padding: 0 6px;
    line-height: 1;
}

.btn-clear-search:hover {
    color: #333;
}

/* User info box in navbar */
.fai-user-info {
    background-color: #fff;
    border: 2px solid #1a3a5c;
    border-radius: 4px;
    padding: 4px 12px;
    line-height: 1.3;
    text-align: right;
}

.fai-user-name {
    display: block;
    color: #1a3a5c;
    font-weight: bold;
    font-size: 0.85rem;
}

.fai-user-code {
    display: block;
    color: #1a3a5c;
    font-weight: bold;
    font-size: 0.85rem;
}

/* Invoice tables */
.invoice-section {
    margin-top: 15px;
}

.invoice-scroll {
    max-height: 45vh;
    overflow-y: auto;
    border: 1px solid #ccc;
    border-radius: 4px;
}

@media (min-width: 768px) {
    #catalogueScroll {
        max-height: calc(100vh - 230px);
    }
}

.invoice-table {
    background-color: #e8e0e0;
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
}

.invoice-table thead th {
    background-color: #d4cfc4;
    color: #1a3a5c;
    position: sticky;
    top: 0;
    z-index: 1;
    font-weight: bold;
    font-size: 0.85rem;
    padding: 10px 12px;
    border-bottom: 2px solid #bbb;
}

.invoice-table tbody td {
    padding: 8px 12px;
    font-size: 0.85rem;
    border-bottom: 1px solid #ccc;
}

.invoice-table tbody tr {
    cursor: pointer;
}

.invoice-table tbody td {
    --bs-table-bg: #fff;
}

.invoice-table tbody tr:nth-child(even) td {
    --bs-table-bg: #f5f5f5;
}

.invoice-table tbody tr:hover td {
    --bs-table-bg: #fce4c0;
}

.invoice-table tbody tr.selected td,
.invoice-table tbody tr.selected:hover td {
    --bs-table-bg: #ffb3b3;
}

/* Zero net price error rows */
.invoice-table tbody tr.zero-net td {
    --bs-table-bg: #fde8e8;
    color: #b00;
}

.invoice-table tbody tr.zero-net:hover td {
    --bs-table-bg: #fcd4d4;
}

.invoice-card.zero-net {
    background-color: #fde8e8 !important;
    border-color: #e88 !important;
}

.zero-net-badge {
    display: inline-block;
    background-color: #dc3545;
    color: #fff;
    font-size: 0.7rem;
    font-weight: bold;
    padding: 1px 6px;
    border-radius: 3px;
    margin-left: 6px;
}

/* Lines detail table - not clickable */
#linesTableDesktop tbody tr {
    cursor: default;
}

/* Mobile invoice cards */
.invoice-card {
    background-color: #fff;
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 10px;
    cursor: pointer;
}

.invoice-card:hover {
    background-color: #fce4c0;
}

.invoice-card.selected {
    background-color: #f8c8c8;
    border-color: #e88;
}

.invoice-card.line-card {
    cursor: default;
    background-color: #f9f9f9;
}

.invoice-card.line-card:hover {
    background-color: #f9f9f9;
}

.invoice-card-row {
    display: flex;
    justify-content: space-between;
    padding: 3px 0;
    font-size: 0.85rem;
}

.invoice-card-label {
    color: #666;
    font-weight: 600;
}

.invoice-card-value {
    color: #1a3a5c;
    font-weight: bold;
    text-align: right;
}

/* Loading overlay */
.fai-loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.fai-loading-content {
    background-color: #fff;
    padding: 30px 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 1.1rem;
    font-weight: 600;
    color: #1a3a5c;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

/* Create New Order */
.order-header {
    background-color: #f0ece4;
    border: 1px solid #ccc;
    border-radius: 6px;
    padding: 15px 20px;
    margin-top: 10px;
}

.order-label {
    font-weight: bold;
    font-size: 0.85rem;
    color: #1a3a5c;
    margin-bottom: 2px;
    display: block;
}

#cartTableDesktop tbody tr {
    cursor: default;
}

#cartTableDesktop .form-select-sm {
    font-size: 0.78rem;
    padding: 2px 4px;
}

#cartTableDesktop input[type="number"].form-control-sm {
    font-size: 0.8rem;
    padding: 2px 6px;
    width: 70px;
}

/* Searchable combobox */
.combo-wrap {
    position: relative;
}

.combo-input {
    width: 100% !important;
    font-size: 0.8rem !important;
    padding: 3px 6px !important;
}

.combo-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 200px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #ccc;
    border-top: none;
    border-radius: 0 0 4px 4px;
    z-index: 100;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.combo-option {
    padding: 4px 8px;
    font-size: 0.8rem;
    cursor: pointer;
}

.combo-option:hover {
    background-color: #fce4c0;
}

/* Order result modal */
.order-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.order-modal-content {
    background-color: #fff;
    padding: 30px 40px;
    border-radius: 10px;
    max-width: 450px;
    width: 90%;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.order-modal-content h5 {
    color: #1a3a5c;
    font-weight: bold;
    margin-bottom: 15px;
}

/* Content area */
.fai-content {
    min-height: calc(100vh - 100px);
    padding: 20px;
}
