/* Reset default browser styles */
body,
h2,
p,
ul,
li {
    margin: 0;
    padding: 0;
}

h2.title {
    color: #007BFF;
}

body {
    padding-top: 60px;
    font-family: Arial, sans-serif;
    background-color: #f4f4f4;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 20px;
}

.register-container {
    background: #fff;
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
    max-width: 400px;
    /* Adjust the maximum width */
    width: 100%;
    text-align: center;
    display: flex;
    flex-direction: column;
    margin: 20px;
    /* Add some spacing around the container */
}

.register-container h2 {
    margin-top: 40px;
    margin-bottom: 20px;
    font-size: 24px;
    /* Increase the font size */
}

.login-container {
    background: #fff;
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.2);
    width: 300px;
    text-align: center;
}

.login-container h2 {
    margin-bottom: 20px;
}

.register-container {
    background: #fff;
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.2);
    width: 300px;
    text-align: center;
}

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

.form-group label {
    display: block;
    text-align: left;
    margin-bottom: 5px;
    font-weight: bold;
    /* Make labels bold */
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 3px;
    box-sizing: border-box;
    /* Include padding and border in the width */
}

.form-group input:focus {
    outline: none;
    border-color: #007BFF;
}

.btn {
    background-color: #007BFF;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 3px;
    cursor: pointer;
    font-weight: bold;
    /* Make the text bold */
}

.btn:hover {
    background-color: #0056b3;
}


.delete img,
.edit img {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.delete img:hover,
.edit img:hover {
    filter: brightness(85%);
    /* Add a hover effect */
}

.row-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-cancel {
    background-color: #6c757d;
    margin-left: 8px;
}

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

.field-hint {
    margin-top: 6px;
    font-size: 12px;
    color: #666;
    text-align: left;
}

body.modal-open {
    overflow: hidden;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}

.modal-overlay[hidden] {
    display: none;
}

.modal {
    background: #fff;
    border-radius: 5px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.25);
    width: 100%;
    max-width: 420px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    padding: 24px;
    text-align: center;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.modal-header h2 {
    margin: 0;
    font-size: 22px;
}

.modal-close {
    border: none;
    background: transparent;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    color: #555;
    padding: 0 4px;
}

.modal-close:hover {
    color: #000;
}

.modal-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.modal .error-message {
    margin-bottom: 12px;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    /* Add spacing between the form and the table */
}

th,
td {
    border: 1px solid #ccc;
    padding: 8px;
    text-align: center;
}

th {
    background-color: #007BFF;
    color: #fff;
}



td a {
    text-decoration: none;
}

td a:hover {
    text-decoration: underline;
    /* Add underline on hover */
}

td a:hover img {
    filter: brightness(85%);
    /* Adjust image brightness on hover */
}

tr:nth-child(even) {
    background-color: #f2f2f2;
}

tr:hover {
    background-color: #e0e0e0;
}

footer {
    color: #777;
    text-align: center;
    margin: 80px auto 20px;
}

.page-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}


.error-message {
    color: red;
    margin-top: 5px;
    /* Optional: Adds some space above the error message */
}

#password-match-message {
    color: red;
    margin-top: 10px;
}

.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: #007bff;
    padding: 10px;
    z-index: 1000;
    display: flex;
}

.navbar a {
    text-decoration: none;
    margin: 0 10px;
    color: #ffffff;
}

@media only screen and (max-width: 600px) {
    body {
        padding-top: 20px;
        /* Adjust top padding */
        margin: 10px;
        /* Adjust margin */
    }

    .register-container,
    .login-container {
        width: 100%;
        /* Make containers full width */
        max-width: none;
        /* Remove max-width constraint */
    }

    .register-container h2,
    .login-container h2 {
        font-size: 20px;
        /* Decrease font size */
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 8px;
        /* Adjust input padding */
    }

    .btn {
        padding: 8px 16px;
        /* Adjust button padding */
    }

    .navbar {
        padding: 5px;
        /* Adjust padding */
    }

    .navbar a {
        margin: 0 5px;
        /* Adjust link margin */
    }

    .modal {
        padding: 16px;
    }

    .modal-header h2 {
        font-size: 18px;
    }
}
/* Client management table: keep API controls separate from table actions. */
.clients-page {
    width: 100%;
    max-width: 1200px;
    min-width: 0;
}

.clients-table-scroll {
    width: 100%;
    overflow-x: auto;
    margin: 20px 0;
    border: 1px solid #dde4ed;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 4px 18px rgba(25, 45, 75, 0.06);
}

.clients-table {
    min-width: 780px;
    margin: 0;
    border-collapse: separate;
    border-spacing: 0;
}

.clients-table th,
.clients-table td {
    padding: 16px;
    border: 0;
    border-bottom: 1px solid #e8edf3;
    vertical-align: middle;
    font-size: 14px;
}

.clients-table th {
    background: #f0f5fc;
    color: #354b68;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.clients-table tbody tr:nth-child(even) { background: #fafbfd; }
.clients-table tbody tr:hover { background: #f4f8ff; }
.clients-table tbody tr:last-child td { border-bottom: 0; }
.clients-table th:nth-child(2),
.clients-table td:nth-child(2),
.clients-table th:nth-child(6) { text-align: left; }
.clients-table td:nth-child(2) { min-width: 130px; max-width: 220px; overflow-wrap: anywhere; }
.client-name { display: block; font-weight: 700; color: #263a52; line-height: 1.5; }
.client-role { display: inline-block; margin-top: 5px; padding: 3px 8px; border-radius: 20px; background: #e9eff7; color: #526782; font-size: 11px; }

.clients-table .client-api-cell { min-width: 300px; text-align: left; }
.client-api-list { display: flex; flex-direction: column; gap: 10px; }
.client-api-key { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 12px; border: 1px solid #dfe7f1; border-radius: 8px; background: #fff; }
.api-key-details { flex: 1 1 155px; min-width: 0; }
.api-key-prefix { display: inline-block; max-width: 100%; box-sizing: border-box; overflow-wrap: anywhere; padding: 5px 8px; border-radius: 5px; background: #f0f4f9; color: #354b68; font-size: 12px; line-height: 1.4; }
.api-key-used { margin-top: 7px; color: #65758b; font-size: 11px; line-height: 1.6; }
.api-empty { color: #738197; font-size: 12px; line-height: 1.6; }
.api-key-form { margin: 0; flex-shrink: 0; }
.api-generate-form { margin-top: 12px; }
.api-button { display: inline-flex; align-items: center; justify-content: center; padding: 8px 12px; border: 1px solid transparent; border-radius: 6px; font: inherit; font-size: 12px; font-weight: 600; line-height: 1.4; white-space: nowrap; cursor: pointer; transition: background-color 0.15s; }
.api-button-generate { color: #0964c1; background: #eaf3ff; border-color: #cce0fb; }
.api-button-generate:hover { background: #dcecff; }
.api-button-revoke { color: #b33636; background: #fff5f5; border-color: #f0d2d2; }
.api-button-revoke:hover { background: #ffe6e6; }
.api-button:focus-visible, .clients-table .row-actions a:focus-visible { outline: 2px solid #007bff; outline-offset: 3px; }
.clients-table .row-actions { display: table-cell; white-space: nowrap; min-width: 80px; }
.clients-table .row-actions a { display: inline-flex; align-items: center; justify-content: center; padding: 8px; border: 1px solid #dfe7f1; border-radius: 6px; background: #fff; }
.clients-table .row-actions a + a { margin-left: 6px; }
.clients-table .row-actions a:hover { background: #eaf3ff; }

@media (max-width: 600px) {
    .clients-table th, .clients-table td { padding: 12px; }
    .clients-page > .register-container { box-sizing: border-box; margin: 16px 0; }
}

/* Registration uses the same card, border and color treatment as the client list. */
.clients-page .client-register-card {
    box-sizing: border-box;
    width: 100%;
    max-width: 760px;
    margin: 20px 0 8px;
    padding: 0;
    overflow: hidden;
    border: 1px solid #dde4ed;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 4px 18px rgba(25, 45, 75, 0.06);
    text-align: left;
}
.client-register-header { padding: 22px 26px; background: #f0f5fc; border-bottom: 1px solid #dde4ed; }
.client-register-card .client-register-header h2 { margin: 0; color: #263a52; font-size: 21px; line-height: 1.4; }
.client-register-header p { margin-top: 6px; color: #65758b; font-size: 13px; line-height: 1.6; }
.client-register-card > .error-message { margin: 20px 26px 0; }
.client-register-card #user-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; padding: 26px; }
.client-register-card .form-group { margin: 0; min-width: 0; }
.client-register-card .form-group:first-child { grid-column: 1 / -1; }
.client-register-card .form-group label,
.client-section-label { margin-bottom: 8px; color: #354b68; font-size: 13px; font-weight: 600; }
.client-register-card .form-group input,
.client-register-card .form-group select { min-height: 42px; padding: 11px 12px; border: 1px solid #d6e0ec; border-radius: 6px; background: #fafbfd; color: #263a52; font: inherit; font-size: 14px; transition: border-color 0.15s, box-shadow 0.15s; }
.client-register-card .form-group input:focus,
.client-register-card .form-group select:focus { outline: none; border-color: #6da7e9; box-shadow: 0 0 0 3px #eaf3ff; background: #fff; }
.client-register-card .client-postage { grid-column: 1 / -1; padding: 16px; border: 1px solid #e2e9f2; border-radius: 8px; background: #f8fafd; }
.client-postage-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.client-register-card .client-postage-item label { color: #65758b; font-size: 12px; }
.client-register-card .client-role-field { grid-column: 1 / -1; }
.client-register-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; padding-top: 18px; border-top: 1px solid #e8edf3; }
.client-register-actions .btn { padding: 11px 20px; border-radius: 6px; font-size: 13px; }

@media (max-width: 600px) {
    .client-register-header { padding: 18px; }
    .client-register-card #user-form { grid-template-columns: minmax(0, 1fr); gap: 18px; padding: 18px; }
    .client-postage-grid { gap: 8px; }
    .client-register-card .client-postage { padding: 12px; }
    .client-register-card .client-postage-item input { padding: 9px 8px; }
    .client-register-actions .btn { width: 100%; }
}

.modal.api-key-dialog {
    box-sizing: border-box;
    width: 100%;
    max-width: 530px;
    padding: 0;
    border: 1px solid #dde4ed;
    border-radius: 12px;
    box-shadow: 0 20px 70px rgba(20, 40, 70, 0.22);
    text-align: left;
}
.api-key-dialog .modal-header { align-items: flex-start; gap: 16px; padding: 22px 26px; margin: 0; background: #f0f5fc; border-bottom: 1px solid #dde4ed; }
.api-modal-eyebrow { display: block; margin-bottom: 6px; color: #526f94; font-size: 10px; font-weight: 700; letter-spacing: 1.5px; }
.api-key-dialog .modal-header h2 { color: #263a52; font-size: 23px; line-height: 1.3; }
.api-key-dialog .modal-close { padding: 2px 6px; border-radius: 5px; }
.api-key-dialog .modal-close:hover { background: #e0eaf7; }
.api-modal-content { padding: 24px 26px 0; }
.api-modal-client { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 15px; color: #65758b; font-size: 12px; }
.api-modal-client strong { color: #263a52; font-size: 14px; overflow-wrap: anywhere; min-width: 0; }
.api-active-badge { padding: 4px 8px; border-radius: 20px; background: #eaf7ef; color: #29734b; font-size: 11px; }
#api-key-description { color: #65758b; font-size: 13px; line-height: 1.7; margin-bottom: 20px; }
.api-key-dialog .api-secret-field { margin-bottom: 16px; }
.api-secret-field label { color: #354b68; font-size: 12px; margin-bottom: 8px; }
.api-secret-field textarea { display: block; resize: none; padding: 14px; border: 1px solid #ccdced; border-radius: 8px; background: #f7faff; color: #263f61; font: 13px/1.7 ui-monospace, SFMono-Regular, Consolas, monospace; overflow-wrap: anywhere; }
.api-secret-field textarea:focus { outline: 2px solid #6da7e9; outline-offset: 2px; }
.api-key-notice { display: flex; align-items: flex-start; gap: 10px; padding: 13px; border: 1px solid #f0dfb4; border-radius: 8px; background: #fffaf0; }
.api-key-notice > span { display: inline-flex; flex: 0 0 19px; height: 19px; justify-content: center; align-items: center; border-radius: 50%; background: #f9eac4; color: #8c641b; font-size: 12px; font-weight: 700; }
.api-key-notice p { color: #80652d; font-size: 12px; line-height: 1.7; }
.api-key-notice strong { display: block; margin-bottom: 3px; }
#api-key-copy-status { min-height: 38px; box-sizing: border-box; padding-top: 12px; color: #65758b; font-size: 12px; line-height: 1.6; }
#api-key-copy-status.is-success { color: #29734b; }
.api-key-dialog .modal-actions { justify-content: flex-end; padding: 16px 26px 22px; gap: 10px; }
.api-key-dialog .modal-actions .btn { border-radius: 6px; padding: 11px 16px; font-size: 13px; }
.api-key-dialog .btn-cancel { margin: 0; border: 1px solid #d6e0ec; background: #fff; color: #526782; }
.api-key-dialog .btn-cancel:hover { background: #f0f5fc; }
@media (max-width: 600px) {
    .api-key-dialog .modal-header, .api-modal-content { padding: 18px; }
    .api-modal-content { padding-bottom: 0; }
    .api-key-dialog .modal-actions { padding: 14px 18px 18px; }
    .api-key-dialog .modal-actions .btn { flex: 1; }
}

#edit-user-modal .modal { max-width: 540px; }
#edit-adresnica-field select { font-size: 12px; color: #354b68; background: #f8fafd; border-color: #d6e0ec; border-radius: 6px; }
