/* ====== GLOBAL ====== */

body {
    margin: 0;
    padding: 0;
    background: #f5f6f8;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ====== LOGIN WRAPPER ====== */

.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

.login-box {
    background: #ffffff;
    padding: 30px;
    width: 90%;
    max-width: 380px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    box-sizing: border-box;
}

.login-box h1 {
    margin: 0 0 25px;
    font-size: 24px;
    text-align: center;
    color: #333;
}

label {
    display: block;
    margin-bottom: 6px;
    color: #444;
    font-size: 14px;
}

input[type="email"],
input[type="password"] {
    width: 100%;
    padding: 12px;
    margin-bottom: 18px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 15px;
    box-sizing: border-box;
}

input:focus {
    border-color: #3b82f6;
    outline: none;
}

button {
    width: 100%;
    padding: 12px;
    background: #3b82f6;
    border: none;
    border-radius: 6px;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
}

button:hover {
    background: #2563eb;
}

.error-box {
    background: #ffe5e5;
    color: #b30000;
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 15px;
    font-size: 14px;
}

/* ====== NAVBAR ====== */

.navbar {
    background: #ffffff;
    border-bottom: 1px solid #e5e5e5;
    width: 100%;
}

.navbar-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-left a {
    text-decoration: none;
    color: #333;
    font-size: 16px;
    transition: font-weight 0.15s ease, color 0.15s ease;
}

.nav-left a:hover {
    font-weight: 600;
    color: #2563eb;
}

.nav-left .divider {
    color: #999;
    font-size: 16px;
    line-height: 1;
    user-select: none;
}

.hamburger {
    display: none;
    font-size: 30px;
    cursor: pointer;
}

.mobile-menu {
    display: none;
    flex-direction: column;
    background: #ffffff;
    width: 100%;
    border-bottom: 1px solid #e5e5e5;
    padding: 10px 20px;
}

.mobile-menu.open {
    display: flex !important;
}

.mobile-menu a {
    padding: 12px 0;
    font-size: 18px;
    text-decoration: none;
    color: #333;
}

/* ====== RESPONSIVE ====== */

@media screen and (max-width: 900px) {
    .nav-left {
        display: none !important;
    }

    .hamburger {
        display: block !important;
    }

    body {
        font-size: 17px;
    }
}

/* ====== PAGE WRAPPER ====== */

.page-wrapper {
    max-width: 700px;
    margin: 30px auto;
    background: #fff;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
}

.page-wrapper h1 {
    margin-bottom: 20px;
    font-size: 24px;
}

label {
    display: block;
    margin-top: 15px;
    margin-bottom: 5px;
    font-weight: 500;
}

input, select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 15px;
    box-sizing: border-box;
}

/* ====== PARTNER AUTOCOMPLETE ====== */

.partner-wrapper {
    position: relative;
}

#partnerSuggestions {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: #ffffff;
    border: 1px solid #ddd;
    border-radius: 6px;
    margin-top: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    z-index: 1000;
    max-height: 220px;
    overflow-y: auto;
    display: none;
}

#partnerSuggestions div {
    padding: 10px 12px;
    cursor: pointer;
    font-size: 15px;
    color: #333;
    border-bottom: 1px solid #f2f2f2;
}

#partnerSuggestions div:last-child {
    border-bottom: none;
}

#partnerSuggestions div:hover {
    background: #f0f7ff;
}

#partnerSuggestions .add-new-partner {
    background: #f0f8ff;
    color: #2563eb;
    font-weight: 600;
}

#partnerSuggestions .add-new-partner:hover {
    background: #e0f0ff;
}

#partnerSuggestions .no-results {
    color: #777;
    background: #fafafa;
}

/* ====== FILE UPLOAD LIST ====== */

.file-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f3f3f3;
    padding: 6px 10px;
    margin-top: 6px;
    border-radius: 4px;
}

#addFileBtn {
    margin-top: 8px;
    padding: 8px 14px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

#addFileBtn:hover {
    background: #0056b3;
}

/* ====== SUBMIT BUTTON (GREEN) ====== */

button[type="submit"] {
    background-color: #28a745;
    color: white;
    padding: 14px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    margin-top: 25px;
}

button[type="submit"]:hover {
    background-color: #218838;
}

/* ====== TOPBAR ====== */

.topbar {
    background: #ffffff;
    padding: 15px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e5e5e5;
}

.topbar .left {
    font-size: 20px;
    font-weight: 600;
    color: #333;
}

.topbar .right {
    display: flex;
    align-items: center;
    gap: 20px;
    font-size: 14px;
    color: #444;
}

.logout-btn {
    background: #ef4444;
    color: #fff;
    padding: 8px 14px;
    border-radius: 6px;
    text-decoration: none;
}

.logout-btn:hover {
    background: #dc2626;
}

.content {
    padding: 30px;
    font-size: 16px;
    color: #333;
}

#newPartnerFields.hidden {
    display: none !important;
}

/* Mobilā tastatūra – novērš lēkāšanu */
html, body {
    height: 100%;
    min-height: 100%;
    overflow-x: hidden;
}

/* Forma mobilajā – ļauj saturam ritināties, nevis lēkt */
.page-wrapper {
    max-width: 900px;
    margin: 20px auto;
    padding: 20px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
    position: relative;
}

/* iOS fix – novērš “zoom in” uz input fokusa */
input, select {
    font-size: 16px !important;
}

.partners-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.partners-table th,
.partners-table td {
    padding: 12px;
    border-bottom: 1px solid #eee;
    text-align: left;
}

.partners-table th {
    background: #f8f9fa;
    font-weight: 600;
}

.partners-table tr:hover {
    background: #f3f7ff;
}

.edit-btn {
    padding: 6px 12px;
    background: #2563eb;
    color: white;
    border-radius: 4px;
    text-decoration: none;
    font-size: 14px;
}

.edit-btn:hover {
    background: #1e4fc7;
}

/* ===== PARTNERU TABULA ===== */

.partners-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 6px; /* atstarpes starp rindām */
    margin-top: 25px;
}

.partners-table thead th {
    text-align: left;
    padding: 12px 14px;
    font-weight: 600;
    font-size: 15px;
    color: #333;
    background: #f1f3f5;
    border-bottom: 2px solid #e2e5e8;
}

.partners-table tbody tr {
    background: #ffffff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
    border-radius: 8px;
}

.partners-table tbody tr td {
    padding: 14px;
    font-size: 15px;
    color: #333;
}

.partners-table tbody tr:hover {
    background: #f7faff;
    box-shadow: 0 3px 10px rgba(0,0,0,0.08);
}

/* Skaitļu kolonnas centrētas */
.partners-table td:nth-child(2),
.partners-table td:nth-child(3),
.partners-table td:nth-child(4) {
    text-align: center;
    font-weight: 600;
    color: #2563eb;
}

/* Labot poga */
.edit-btn {
    padding: 8px 14px;
    background: #2563eb;
    color: white;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
    display: inline-block;
    transition: background 0.15s ease;
}

.edit-btn:hover {
    background: #1e4fc7;
}

.partners-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.add-partner-btn {
    background: #2563eb;
    color: white;
    padding: 10px 16px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 15px;
    font-weight: 600;
}

.add-partner-btn:hover {
    background: #1e4fc7;
}

.hidden { display: none; }

.similar-box {
    background: #eef3ff;
    border: 1px solid #c7d4ff;
    padding: 10px;
    border-radius: 6px;
    margin-top: 8px;
    font-size: 14px;
}

.warning {
    background: #fff3cd;
    color: #856404;
    padding: 10px;
    border-radius: 6px;
    margin-top: 8px;
    font-size: 14px;
}

/* ===== PARTNERU TABULA — DESKTOP ===== */

.partners-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 6px;
    margin-top: 25px;
}

.partners-table thead th {
    text-align: center;
    padding: 12px 14px;
    font-weight: 600;
    font-size: 15px;
    color: #333;
    background: #f1f3f5;
    border-bottom: 2px solid #e2e5e8;
}

.partners-table tbody tr {
    background: #ffffff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
    border-radius: 8px;
}

.partners-table tbody tr td {
    padding: 14px;
    font-size: 15px;
    color: #333;
    text-align: center;
}

.partners-table tbody tr td:first-child {
    text-align: left;
}

.partners-table tbody tr:hover {
    background: #f7faff;
    box-shadow: 0 3px 10px rgba(0,0,0,0.08);
}

/* Labot poga */
.edit-btn {
    padding: 6px 12px;
    background: #2563eb;
    color: white;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
}

.icon {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 20px;
    height: 20px;
    border: none;        /* ← noņem aplīti */
    border-radius: 0;    /* ← noņem apaļumu */
}

/* Ienākošie */
.icon.incoming::after {
    content: "";
    width: 6px;
    height: 6px;
    border-right: 2px solid #2a7f2a;
    border-bottom: 2px solid #2a7f2a;
    transform: rotate(45deg);
}

/* Izejošie */
.icon.outgoing::after {
    content: "";
    width: 6px;
    height: 6px;
    border-left: 2px solid #1e73be;
    border-top: 2px solid #1e73be;
    transform: rotate(45deg);
}

/* Nesamaksātie */
.icon.unpaid::after {
    content: "€";
    font-size: 13px;
    color: #b30000;
    font-weight: bold;
}

/* Labot */
.icon.edit::after {
    content: "✏️";
    font-size: 14px;
}

@media (max-width: 768px) {

    .partners-table {
        table-layout: fixed;
        width: 100%;
    }

    .partners-table th,
    .partners-table td {
        padding: 6px 4px;
        font-size: 13px;
        white-space: normal;
        word-break: break-word;
        text-align: center;
    }

    .partners-table th:first-child,
    .partners-table td:first-child {
        text-align: left;
        width: 45%;
    }

    .col-in,
    .col-out,
    .col-unpaid,
    .col-edit {
        width: 12%;
    }

    .icon {
        width: 16px;
        height: 16px;
        border-width: 1px;
    }

    .icon.incoming::after,
    .icon.outgoing::after {
        width: 5px;
        height: 5px;
    }

    .icon.unpaid::after {
        font-size: 11px;
    }

    .edit-btn {
        font-size: 0;
        padding: 0;
        background: none;
        border: none;
    }

    .edit-btn::after {
        content: "✏️";
        font-size: 16px;
        color: #2563eb;
    }
}

/* Mobilajā – padarām date inputus tādus pašus kā pārējos */
@media (max-width: 768px) {
    input[type="date"] {
        width: 90% !important;
        box-sizing: border-box;
        padding: 12px;
        font-size: 16px;
    }
}


.invoice-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 6px;
    margin-top: 20px;
}

.invoice-table th {
    background: #f1f3f5;
    padding: 12px 14px;
    font-weight: 600;
    text-align: left;
    border-bottom: 2px solid #e2e5e8;
}

.invoice-table td {
    background: #fff;
    padding: 14px;
    font-size: 15px;
}

.invoice-table tr:hover td {
    background: #f7faff;
}

/* Statusi */
.status {
    padding: 6px 10px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 13px;
}

.status.paid {
    background: #e6f7e6;
    color: #1a7f1a;
}

.status.unpaid {
    background: #ffecec;
    color: #b30000;
}

@media (max-width: 768px) {

    .invoice-table {
        table-layout: fixed;
        width: 100%;
    }

    .invoice-table th,
    .invoice-table td {
        padding: 8px 6px;
        font-size: 13px;
        white-space: normal;
        word-break: break-word;
        text-align: center;
    }

    .invoice-table td:first-child,
    .invoice-table th:first-child {
        text-align: left;
        width: 45%;
    }

    .invoice-table td:nth-child(2),
    .invoice-table td:nth-child(3),
    .invoice-table td:nth-child(4) {
        width: 18%;
    }

    .status {
        padding: 4px 6px;
        font-size: 12px;
    }
}