/* =========================================================
   GLOBAL
   ========================================================= */

* {
    box-sizing: border-box;
}

html {
    margin: 0;
    padding: 0;
    width: 100%;
}

body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f4f4;
    color: #333;
    width: 100%;
}

a {
    color: inherit;
}

button,
input,
select,
textarea {
    font-family: inherit;
}

.edit-c2-container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 10px 0 30px;
    box-sizing: border-box;
}


/* =========================================================
   EDIT C2 HEADER
   ========================================================= */

.edit-c2-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;

    margin-bottom: 20px;
    padding: 22px 25px;

    background: #fff;
    border-radius: 10px;

    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);

    border-left: 4px solid #77aaff;
}

.edit-c2-header h2 {
    margin: 0 0 6px;
    color: #333;
    font-size: 25px;
}

.edit-c2-header p {
    margin: 0;
    color: #777;
    font-size: 14px;
}


/* =========================================================
   EDIT C2 CARDS
   ========================================================= */

.edit-c2-card {
    width: 100%;
    margin-bottom: 20px;
    padding: 25px;

    background: #fff;
    border-radius: 10px;

    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);

    box-sizing: border-box;
}

.edit-c2-card h3 {
    margin: 0 0 20px;

    padding-bottom: 12px;

    border-bottom: 1px solid #eee;

    color: #333;
    font-size: 18px;
}


/* =========================================================
   LICENSE INFORMATION
   ========================================================= */

.license-info-grid {
    display: grid;

    grid-template-columns:
        repeat(4, minmax(0, 1fr));

    gap: 15px;
}

.info-item {
    min-width: 0;

    padding: 15px;

    background: #f8f9fa;

    border: 1px solid #e9ecef;

    border-radius: 7px;
}

.info-label {
    display: block;

    margin-bottom: 6px;

    color: #777;

    font-size: 12px;

    font-weight: bold;

    text-transform: uppercase;

    letter-spacing: 0.3px;
}

.info-item strong {
    display: block;

    color: #333;

    font-size: 14px;

    word-break: break-word;
}


/* =========================================================
   CREDIT SUMMARY
   ========================================================= */

.credit-summary {
    display: grid;

    grid-template-columns:
        repeat(4, minmax(0, 1fr));

    gap: 15px;
}

.credit-box {
    padding: 20px;

    background: #f8f9fa;

    border: 1px solid #e5e7eb;

    border-radius: 8px;

    text-align: center;
}

.credit-box span {
    display: block;

    margin-bottom: 8px;

    color: #666;

    font-size: 13px;
}

.credit-box strong {
    display: block;

    color: #333;

    font-size: 27px;
}


/* Extra credits */

.credit-box-extra {
    background: #eef5ff;

    border-color: #cfe0ff;
}

.credit-box-extra strong {
    color: #007bff;
}


/* Total credits */

.credit-box-total {
    background: #e8f5e9;

    border-color: #c8e6c9;
}

.credit-box-total strong {
    color: #198754;
}


/* =========================================================
   CREDIT FORMULA
   ========================================================= */

.credit-formula {
    margin-top: 18px;

    padding: 14px 16px;

    background: #f8f9fa;

    border: 1px dashed #ccc;

    border-radius: 6px;

    color: #666;

    font-size: 14px;

    text-align: center;
}

.credit-formula strong {
    color: #333;
}


/* =========================================================
   CREDIT EDIT FORM
   ========================================================= */

.credit-edit-form {
    max-width: 700px;
}

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

.form-group label {
    display: block;

    margin-bottom: 8px;

    color: #333;

    font-weight: bold;

    font-size: 14px;
}

.form-group input[type="number"] {
    width: 100%;

    height: 46px;

    padding: 10px 13px;

    border: 1px solid #ccc;

    border-radius: 6px;

    background: #fff;

    color: #333;

    font-size: 16px;

    box-sizing: border-box;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.form-group input[type="number"]:focus {
    outline: none;

    border-color: #77aaff;

    box-shadow:
        0 0 0 3px
        rgba(119, 170, 255, 0.15);
}

.form-group small {
    display: block;

    margin-top: 7px;

    color: #777;

    font-size: 12px;
}


/* =========================================================
   FORM ACTIONS
   ========================================================= */

.form-actions {
    display: flex;

    align-items: center;

    gap: 10px;

    padding-top: 5px;
}

.form-actions .btn {
    min-width: 140px;
}


/* =========================================================
   ERROR MESSAGE
   ========================================================= */

.edit-c2-container .error-message {
    margin-bottom: 20px;

    box-shadow:
        0 2px 6px
        rgba(0, 0, 0, 0.05);
}


/* =========================================================
   MOBILE / TABLET
   ========================================================= */

@media (max-width: 900px) {

    .license-info-grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }

    .credit-summary {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }
}


@media (max-width: 768px) {

    .edit-c2-container {
        padding: 5px 0 20px;
    }

    .edit-c2-header {
        flex-direction: column;

        align-items: stretch;

        padding: 20px;

        text-align: center;
    }

    .edit-c2-header .btn {
        width: 100%;
    }

    .edit-c2-card {
        padding: 20px;
    }

    .license-info-grid {
        grid-template-columns: 1fr;
    }

    .credit-summary {
        grid-template-columns: 1fr 1fr;
    }

    .form-actions {
        flex-direction: column;

        align-items: stretch;
    }

    .form-actions .btn {
        width: 100%;
    }
}


@media (max-width: 480px) {

    .edit-c2-header h2 {
        font-size: 21px;
    }

    .edit-c2-card {
        padding: 15px;
    }

    .credit-summary {
        grid-template-columns: 1fr;
    }

    .credit-box {
        padding: 17px;
    }

    .credit-box strong {
        font-size: 24px;
    }

    .info-item {
        padding: 13px;
    }
}
/* =========================================================
   GENERAL CONTAINER
   ========================================================= */

.container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    box-sizing: border-box;

    /*
     * IMPORTANT:
     * Do not use overflow:hidden here.
     * The dashboard contains a horizontally scrollable table.
     */
    overflow: visible;
}


/* =========================================================
   HEADER
   ========================================================= */

header {
    background: #333;
    color: #fff;
    padding-top: 20px;
    min-height: 70px;
    border-bottom: #77aaff 3px solid;
}

header .container {
    min-height: 50px;
}

header h1 {
    float: left;
    margin-top: 0;
    margin-bottom: 0;
}

header nav {
    float: right;
    margin-top: 10px;
}

header nav ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

header nav ul li {
    display: inline;
    padding: 0 20px;
}

header a {
    color: #fff;
    text-decoration: none;
    text-transform: uppercase;
    font-size: 16px;
}

header a:hover {
    color: #77aaff;
}


/* Clear header floats */

header::after {
    content: "";
    display: table;
    clear: both;
}


/* =========================================================
   MAIN CONTENT
   ========================================================= */

main.container {
    width: 100%;
    max-width: 1400px;
    padding-top: 20px;
    padding-bottom: 20px;
    overflow: visible;
}


/*
 * Dashboard deliberately uses the complete viewport width.
 */

main.main-content {
    width: 100%;
    max-width: 100%;
    padding: 20px;
    box-sizing: border-box;
    overflow: visible;
}


/* =========================================================
   LOGIN
   ========================================================= */

.login-container {
    background: #fff;
    padding: 20px;
    margin: 30px auto 0;
    max-width: 600px;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

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

.login-container div {
    margin-bottom: 15px;
}

.login-container label {
    display: block;
    margin-bottom: 5px;
}

.login-container input[type="text"],
.login-container input[type="password"] {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 3px;
    box-sizing: border-box;
}

.login-container button {
    background: #333;
    color: #fff;
    border: 0;
    padding: 10px 15px;
    border-radius: 3px;
    cursor: pointer;
    width: 100%;
}

.login-container button:hover {
    background: #555;
}


/* =========================================================
   MESSAGES
   ========================================================= */

.error-message {
    color: #842029;
    background: #f8d7da;
    border: 1px solid #f5c2c7;
    padding: 10px;
    margin-bottom: 15px;
    border-radius: 5px;
}

.success-message {
    color: #0f5132;
    background: #d1e7dd;
    border: 1px solid #badbcc;
    padding: 10px;
    margin-bottom: 15px;
    border-radius: 5px;
}


/* =========================================================
   FOOTER
   ========================================================= */

footer {
    margin-top: 30px;
    text-align: center;
    padding: 20px;
    background: #333;
    color: #fff;
}


/* =========================================================
   BUTTONS
   ========================================================= */

.btn {
    display: inline-block;
    padding: 10px 16px;
    border: 0;
    border-radius: 5px;
    cursor: pointer;
    text-decoration: none;
    font-size: 14px;
    line-height: 20px;
    text-align: center;
}

.btn-primary {
    background: #333;
    color: #fff;
}

.btn-primary:hover {
    background: #555;
}

.btn-secondary {
    background: #777;
    color: #fff;
}

.btn-secondary:hover {
    background: #555;
}

.btn-edit {
    background: #007bff;
    color: #fff;
    white-space: nowrap;
}

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


/* =========================================================
   DASHBOARD
   ========================================================= */

.dashboard-container {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    overflow: visible;
}


/* =========================================================
   DASHBOARD HEADER
   ========================================================= */

.dashboard-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    box-sizing: border-box;
}

.dashboard-header h2 {
    margin: 0 0 8px 0;
    color: #333;
}

.dashboard-header p {
    margin: 0;
    text-align: left;
    font-size: 1.1em;
    color: #666;
}

.dashboard-total {
    min-width: 160px;
    padding: 15px 20px;
    background: #f5f7fa;
    border-radius: 8px;
    text-align: center;
}

.dashboard-total strong {
    display: block;
    font-size: 28px;
    color: #333;
}

.dashboard-total span {
    display: block;
    margin-top: 5px;
    font-size: 13px;
    color: #666;
}


/* =========================================================
   LICENSE SEARCH
   ========================================================= */

.license-search {
    width: 100%;
    margin-bottom: 20px;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    box-sizing: border-box;
}

.search-row {
    display: flex;
    align-items: flex-end;
    gap: 15px;
    width: 100%;
}

.search-input {
    flex: 1;
}

.search-input label {
    display: block;
    margin-bottom: 7px;
    font-weight: bold;
    color: #333;
}

.search-input input {
    width: 100%;
    height: 42px;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-sizing: border-box;
    font-size: 14px;
}

.search-input input:focus {
    outline: none;
    border-color: #77aaff;
    box-shadow: 0 0 0 2px rgba(119, 170, 255, 0.15);
}

.search-buttons {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}


/* =========================================================
   LICENSE TABLE WRAPPER
   ========================================================= */

/*
 * IMPORTANT:
 *
 * The table has 22 columns.
 *
 * The table itself is intentionally wide.
 * This wrapper creates the horizontal scrollbar.
 */

.license-table-wrapper {
    width: 100%;
    max-width: 100%;
    display: block;

    overflow-x: auto;
    overflow-y: visible;

    box-sizing: border-box;

    margin: 20px 0;
    padding-bottom: 12px;

    -webkit-overflow-scrolling: touch;
}


/* =========================================================
   LICENSE TABLE
   ========================================================= */

.license-table {
    /*
     * Do NOT use width: 80%.
     */

    width: max-content !important;

    /*
     * Ensures all 22 columns have enough room.
     */

    min-width: 2200px !important;

    margin: 0 !important;

    border-collapse: collapse;

    background: #fff;

    box-shadow:
        0 2px 10px rgba(0, 0, 0, 0.08);
}


/* =========================================================
   LICENSE TABLE CELLS
   ========================================================= */

.license-table th,
.license-table td {
    border: 1px solid #ddd;

    padding: 10px 12px;

    text-align: left;

    vertical-align: middle;

    /*
     * Prevent normal columns from collapsing.
     */

    white-space: nowrap;

    font-size: 13px;
}


/* =========================================================
   TABLE HEADER
   ========================================================= */

.license-table th {
    background: #333;
    color: #fff;
    font-weight: bold;

    /*
     * Keeps header visible when vertically scrolling.
     */

    position: sticky;
    top: 0;
    z-index: 5;
}


/* =========================================================
   TABLE ROWS
   ========================================================= */

.license-table tbody tr:nth-child(even) td {
    background: #f8f9fa;
}

.license-table tbody tr:hover td {
    background: #eef5ff;
}


/* =========================================================
   TABLE COLUMN WIDTHS
   ========================================================= */

/* ID */

.license-table th:nth-child(1),
.license-table td:nth-child(1) {
    min-width: 60px;
}


/* License Type */

.license-table th:nth-child(2),
.license-table td:nth-child(2) {
    min-width: 110px;
}


/* Username */

.license-table th:nth-child(3),
.license-table td:nth-child(3) {
    min-width: 150px;
}


/* Mobile */

.license-table th:nth-child(4),
.license-table td:nth-child(4) {
    min-width: 130px;
}


/* Email */

.license-table th:nth-child(5),
.license-table td:nth-child(5) {
    min-width: 200px;
}


/* Office */

.license-table th:nth-child(6),
.license-table td:nth-child(6) {
    min-width: 160px;
}


/* Request Date */

.license-table th:nth-child(7),
.license-table td:nth-child(7) {
    min-width: 160px;
}


/* Activated Date */

.license-table th:nth-child(8),
.license-table td:nth-child(8) {
    min-width: 160px;
}


/* Expiry Date */

.license-table th:nth-child(9),
.license-table td:nth-child(9) {
    min-width: 120px;
}


/* Expiry Status */

.license-table th:nth-child(10),
.license-table td:nth-child(10) {
    min-width: 140px;
}


/* Install Type */

.license-table th:nth-child(11),
.license-table td:nth-child(11) {
    min-width: 130px;
}


/* District */

.license-table th:nth-child(12),
.license-table td:nth-child(12) {
    min-width: 130px;
}


/* State */

.license-table th:nth-child(13),
.license-table td:nth-child(13) {
    min-width: 130px;
}


/* System Info 1 */

.license-table th:nth-child(14),
.license-table td:nth-child(14) {
    min-width: 250px;
}


/* System Info 2 */

.license-table th:nth-child(15),
.license-table td:nth-child(15) {
    min-width: 250px;
}


/* System Info 3 */

.license-table th:nth-child(16),
.license-table td:nth-child(16) {
    min-width: 250px;
}


/* Service Type */

.license-table th:nth-child(17),
.license-table td:nth-child(17) {
    min-width: 100px;
}


/* IP Address */

.license-table th:nth-child(18),
.license-table td:nth-child(18) {
    min-width: 150px;
}


/* Install Reference */

.license-table th:nth-child(19),
.license-table td:nth-child(19) {
    min-width: 180px;
}


/* Credits */

.license-table th:nth-child(20),
.license-table td:nth-child(20) {
    min-width: 100px;
    text-align: center;
}


/* Record Status */

.license-table th:nth-child(21),
.license-table td:nth-child(21) {
    min-width: 120px;
    text-align: center;
}


/* Action */

.license-table th:nth-child(22),
.license-table td:nth-child(22) {
    min-width: 140px;
    text-align: center;
}


/* =========================================================
   SYSTEM INFORMATION CELLS
   ========================================================= */

.license-table td:nth-child(14),
.license-table td:nth-child(15),
.license-table td:nth-child(16) {
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
}


/* =========================================================
   CREDITS
   ========================================================= */

.credits-value {
    display: inline-block;

    min-width: 45px;

    padding: 5px 8px;

    background: #e8f5e9;

    color: #198754;

    border-radius: 4px;

    text-align: center;

    font-weight: bold;
}


/* =========================================================
   EXPIRY STATUS
   ========================================================= */

.expiry-active {
    display: inline-block;

    padding: 5px 8px;

    background: #dff5e4;

    color: #198754;

    border-radius: 4px;

    font-weight: bold;
}

.expiry-warning {
    display: inline-block;

    padding: 5px 8px;

    background: #fff3cd;

    color: #856404;

    border-radius: 4px;

    font-weight: bold;
}

.expiry-today {
    display: inline-block;

    padding: 5px 8px;

    background: #ffe5b4;

    color: #b45309;

    border-radius: 4px;

    font-weight: bold;
}

.expiry-expired {
    display: inline-block;

    padding: 5px 8px;

    background: #f8d7da;

    color: #842029;

    border-radius: 4px;

    font-weight: bold;
}


/* =========================================================
   RECORD STATUS
   ========================================================= */

.status-active {
    display: inline-block;

    padding: 5px 9px;

    background: #d1e7dd;

    color: #0f5132;

    border-radius: 4px;

    font-weight: bold;
}

.status-inactive {
    display: inline-block;

    padding: 5px 9px;

    background: #f8d7da;

    color: #842029;

    border-radius: 4px;

    font-weight: bold;
}


/* =========================================================
   LICENSE ACTIONS
   ========================================================= */

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


/* =========================================================
   NO RESULTS
   ========================================================= */

.no-results {
    width: 100%;

    padding: 50px 20px;

    background: #fff;

    border-radius: 8px;

    text-align: center;

    box-sizing: border-box;

    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.08);
}

.no-results h3 {
    margin-top: 0;
    color: #333;
}

.no-results p {
    color: #666;
}


/* =========================================================
   PAGINATION
   ========================================================= */

.pagination {
    display: flex;

    flex-wrap: wrap;

    justify-content: center;

    align-items: center;

    gap: 5px;

    margin: 25px 0 10px;
}

.pagination a,
.pagination span {
    display: inline-block;

    min-width: 38px;

    padding: 8px 10px;

    box-sizing: border-box;

    border: 1px solid #ddd;

    border-radius: 4px;

    background: #fff;

    color: #333;

    text-decoration: none;

    text-align: center;
}

.pagination a:hover {
    background: #333;

    color: #fff;

    border-color: #333;
}

.pagination .current {
    background: #333;

    color: #fff;

    border-color: #333;

    font-weight: bold;
}

.pagination-info {
    margin: 10px 0 25px;

    text-align: center;

    color: #666;

    font-size: 14px;
}


/* =========================================================
   LOGS
   ========================================================= */

.logs-container h2,
.logs-container h3 {
    text-align: center;
    margin-bottom: 20px;
}

.logs-container p {
    text-align: center;
}

.filter-form {
    text-align: center;

    margin-bottom: 20px;

    padding: 15px;

    background-color: #f9f9f9;

    border-radius: 5px;
}

.filter-form label {
    font-weight: bold;
    margin-right: 10px;
}

.filter-form select {
    padding: 8px;

    border-radius: 3px;

    border: 1px solid #ddd;

    min-width: 150px;
}

.export-button {
    display: inline-block;

    margin-left: 15px;

    padding: 8px 15px;

    background-color: #5cb85c;

    color: white;

    text-decoration: none;

    border-radius: 3px;

    border: none;

    cursor: pointer;
}

.export-button:hover {
    background-color: #4cae4c;
}

.logs-container table {
    width: 100%;

    margin: 20px auto;

    border-collapse: collapse;

    box-shadow:
        0 0 10px rgba(0, 0, 0, 0.1);
}

.logs-container th,
.logs-container td {
    border: 1px solid #ddd;

    padding: 10px;

    text-align: left;

    font-size: 0.9em;
}

.logs-container th {
    background-color: #f0f0f0;

    font-weight: bold;

    color: #333;
}

.logs-container tr:nth-child(even) {
    background-color: #f9f9f9;
}

.logs-container tr:hover {
    background-color: #e9e9e9;
}

.table-responsive {
    width: 100%;

    margin-top: 20px;

    overflow-x: auto;

    -webkit-overflow-scrolling: touch;
}


/* =========================================================
   PER MONTH DATA
   ========================================================= */

.per-month-data-container h2,
.per-month-data-container h3,
.per-month-data-container h4 {
    text-align: center;

    margin-bottom: 15px;
}

.per-month-data-container h4 {
    margin-top: 25px;

    border-bottom: 1px solid #eee;

    padding-bottom: 10px;
}

.per-month-data-container p {
    text-align: center;

    margin-bottom: 10px;
}

.per-month-data-container ul {
    list-style-type: none;

    padding-left: 0;

    max-width: 600px;

    margin: 10px auto;
}

.per-month-data-container ul li {
    background: #f9f9f9;

    border: 1px solid #eee;

    padding: 8px 12px;

    margin-bottom: 5px;

    border-radius: 3px;
}


/* =========================================================
   GENERIC TABLE RESPONSIVE
   ========================================================= */

.table-responsive {
    width: 100%;

    overflow-x: auto;

    overflow-y: visible;

    -webkit-overflow-scrolling: touch;
}


/* =========================================================
   MOBILE / TABLET
   ========================================================= */

@media (max-width: 768px) {

    .container {
        width: 100%;
        padding-left: 10px;
        padding-right: 10px;
    }

    main.container {
        padding-top: 10px;
        padding-bottom: 10px;
    }

    main.main-content {
        padding: 10px;
    }


    /* Header */

    header {
        padding-top: 15px;
        padding-bottom: 15px;
    }

    header h1 {
        float: none;

        text-align: center;

        margin-bottom: 15px;
    }

    header nav {
        float: none;

        margin-top: 0;

        text-align: center;
    }

    header nav ul li {
        padding: 0 8px;
    }

    header a {
        font-size: 13px;
    }


    /* Dashboard */

    .dashboard-header {
        flex-direction: column;

        align-items: stretch;

        text-align: center;
    }

    .dashboard-header p {
        text-align: center;
    }

    .dashboard-total {
        width: 100%;

        box-sizing: border-box;
    }


    /* Search */

    .search-row {
        flex-direction: column;

        align-items: stretch;
    }

    .search-buttons {
        width: 100%;
    }

    .search-buttons .btn {
        flex: 1;
    }


    /* Table */

    .license-table-wrapper {
        width: 100%;

        overflow-x: auto;

        overflow-y: visible;
    }

    .license-table {
        min-width: 2200px !important;
    }

    .license-table th,
    .license-table td {
        font-size: 12px;

        padding: 8px 10px;
    }


    /* Login */

    .login-container {
        margin-top: 15px;

        padding: 15px;
    }
}


/* =========================================================
   SMALL MOBILE
   ========================================================= */

@media (max-width: 480px) {

    header h1 {
        font-size: 22px;
    }

    header nav ul li {
        padding: 0 5px;
    }

    header a {
        font-size: 12px;
    }

    .dashboard-header {
        padding: 15px;
    }

    .license-search {
        padding: 15px;
    }

    .dashboard-total strong {
        font-size: 24px;
    }

    .pagination a,
    .pagination span {
        min-width: 32px;

        padding: 7px 8px;

        font-size: 13px;
    }
}
