:root {
    --bg-dark: #121212;
    --bg-light: #1e1e1e;
    --text-color: #e0e0e0;
    --text-muted: #888;
    --primary-red: #e50914;
    --green: #1db954;
    --blue: #007bff;
    --border-color: #2d2d2d;
    --navbar-height: 60px;
    /* Mobil navbar yüksekliği */
}

@keyframes fadeInSlideUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-color);
    line-height: 1.6;
    font-size: 16px;
}

body.noscroll {
    overflow: hidden;
}

/* Genel Link Stilleri */
a,
a:visited {
    color: var(--blue);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--primary-red);
}

.container {
    width: 95%;
    max-width: 1600px;
    margin: 0 auto;
}

/* Header & Nav */
.header {
    background-color: var(--bg-light);
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo a {
    color: #fff;
    font-size: 1.5rem;
    font-weight: 700;
    text-decoration: none;
    display: flex;
    align-items: center;
}

.logo img {
    max-height: 40px;
    margin-right: 10px;
}

.desktop-nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.desktop-nav .nav-link {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.desktop-nav .nav-link:hover,
.desktop-nav .nav-link.active {
    color: #fff;
}


/* Main Content */
.main-content {
    padding: 2.5rem 0;
    animation: fadeInSlideUp 0.6s ease-out forwards;
}

.page-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.page-header h1 {
    font-size: 1.75rem;
}

/* Kartlar */
.card {
    background-color: var(--bg-light);
    padding: 1.5rem;
    border-radius: 8px;
    opacity: 0;
    animation: fadeInSlideUp 0.5s ease-out forwards;
}

.card a.card {
    transition: all 0.3s ease;
}

.card a.card:hover {
    transform: translateY(-5px);
    background-color: #252525;
}

.card-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.25rem;
}

.card.card-green {
    border-left: 5px solid var(--green);
}

.card.card-blue {
    border-left: 5px solid var(--blue);
}

.card.card-red {
    border-left: 5px solid var(--primary-red);
}

.card:nth-child(1) {
    animation-delay: 0.1s;
}

.card:nth-child(2) {
    animation-delay: 0.2s;
}

.card:nth-child(3) {
    animation-delay: 0.3s;
}

.card:nth-child(4) {
    animation-delay: 0.4s;
}

.card:nth-child(5) {
    animation-delay: 0.5s;
}

.card h3 {
    margin-bottom: 0.5rem;
    font-size: 1.125rem;
    color: #ccc;
}

.card .amount {
    font-size: 2rem;
    font-weight: 700;
    word-wrap: break-word;
}

.card .amount.positive {
    color: var(--green);
}

.card .amount.negative {
    color: var(--primary-red);
}

/* Butonlar */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: 1px solid transparent;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 700;
    text-align: center;
    cursor: pointer;
    text-decoration: none !important;
    transition: all 0.3s ease;
    margin: 0.125rem;
}

.btn-red {
    background-color: var(--primary-red);
    border-color: var(--primary-red);
    color: #fff !important;
}

.btn-blue {
    background-color: var(--blue);
    border-color: var(--blue);
    color: #fff !important;
}

.btn-green {
    background-color: var(--green);
    border-color: var(--green);
    color: #fff !important;
}

.btn-danger {
    background-color: transparent;
    border-color: var(--primary-red);
    color: var(--primary-red) !important;
}

.btn-danger:hover {
    background-color: var(--primary-red);
    color: #fff !important;
}

.btn-secondary {
    background-color: transparent;
    border-color: #888;
    color: #888 !important;
}

.btn-secondary:hover {
    background-color: #555;
    border-color: #555;
    color: #fff !important;
}

/* Formlar */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
}

input,
textarea,
select {
    width: 100%;
    padding: 0.75rem;
    background-color: #333;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-color);
    font-size: 1rem;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--primary-red);
    box-shadow: 0 0 5px rgba(229, 9, 20, 0.5);
    outline: none;
}

input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type=number] {
    -moz-appearance: textfield;
}

select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    padding-right: 2.5rem;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24" fill="none" stroke="%23e0e0e0" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"></polyline></svg>');
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1.2em;
}

/* Raporlama Stilleri */
.date-range-form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 1rem;
}

.date-range-form .form-group {
    margin-bottom: 0;
}

.quick-ranges {
    margin-top: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.quick-ranges a {
    color: var(--text-muted);
    background-color: #333;
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-size: 0.8em;
    font-weight: 500;
    transition: all 0.3s ease;
    text-decoration: none;
}

.quick-ranges a:hover {
    background-color: var(--primary-red);
    color: #fff;
}

/* Toplamlar Özeti (Fatura/Teklif Formu) */
.totals-summary {
    text-align: right;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    max-width: 350px;
    margin-left: auto;
}

.totals-summary .total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.totals-summary .total-label {
    color: var(--text-muted);
}

.totals-summary .total-value {
    font-weight: bold;
}

.totals-summary .grand-total {
    font-size: 1.5rem;
    font-weight: bold;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.totals-summary .final-due .total-value {
    color: var(--green);
}

.form-group-tax {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.form-group-tax label {
    margin-bottom: 0;
    white-space: nowrap;
}

.form-group-tax input {
    width: 80px;
    text-align: right;
}

.form-group-tax span {
    min-width: 120px;
    text-align: right;
    font-weight: bold;
}

/* Tablolar */
.table-wrapper {
    width: 100%;
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1.25rem;
}

.table th,
.table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.table th {
    background-color: #333;
    white-space: nowrap;
}

.table tr:hover {
    background-color: #2a2a2a;
}

.table a {
    color: var(--blue);
}

.status-badge {
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: bold;
    color: #fff;
    white-space: nowrap;
}

.status-ödendi,
.status-onaylandı {
    background-color: var(--green);
}

.status-kısmi-ödendi {
    background-color: var(--blue);
}

.status-ödenmedi,
.status-reddedildi {
    background-color: var(--primary-red);
}

.status-iptal,
.status-taslak {
    background-color: #6c757d;
}

.status-gönderildi {
    background-color: #fd7e14;
}

.status-faturalaştı {
    background-color: #6610f2;
}


.split-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2.5rem;
}

.message {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1.25rem;
}

.message.success {
    background-color: #28a745;
}

.message.error {
    background-color: #dc3545;
}

.mobile-navbar {
    display: none;
}

.desktop-nav {
    display: flex;
}

.footer {
    margin-top: 2.5rem;
    padding: 1.25rem 0;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    text-align: center;
}

/* Fatura/Teklif Formu Tablosu Özel Stilleri */
#invoice-items {
    table-layout: fixed;
    width: 100%;
}

#invoice-items th,
#invoice-items td {
    padding: 8px;
    vertical-align: top;
}

#invoice-items th:nth-child(1),
#invoice-items td:nth-child(1) {
    width: 45%;
}

/* Ürün/Hizmet */
#invoice-items th:nth-child(2),
#invoice-items td:nth-child(2) {
    width: 10%;
}

/* Miktar */
#invoice-items th:nth-child(3),
#invoice-items td:nth-child(3) {
    width: 15%;
}

/* Birim Fiyat */
#invoice-items th:nth-child(4),
#invoice-items td:nth-child(4) {
    width: 10%;
}

/* KDV */
#invoice-items th:nth-child(5),
#invoice-items td:nth-child(5) {
    width: 15%;
    text-align: right;
}

/* Toplam */
#invoice-items th:nth-child(6),
#invoice-items td:nth-child(6) {
    width: 5%;
    text-align: center;
}

/* İşlem */

#invoice-items td .product-select {
    margin-bottom: 0.5rem;
}

/* Fatura Görüntüleme tfoot stilleri */
.table tfoot.totals-summary-footer {
    font-weight: bold;
}

.table tfoot.totals-summary-footer tr {
    border-top: 2px solid var(--border-color);
}

.table tfoot.totals-summary-footer td {
    text-align: right;
    border-bottom: none;
}

.table tfoot.totals-summary-footer td[colspan="4"] {
    text-align: right;
    font-weight: normal;
    color: var(--text-muted);
}

.table tfoot.totals-summary-footer .grand-total-row td,
.table tfoot.totals-summary-footer .final-due td {
    font-size: 1.3rem;
    color: #fff;
}

.table tfoot.totals-summary-footer .final-due td {
    color: var(--green);
}

/* =========================================== */
/* MOBİL UYUMLULUK (MEDIA QUERIES)             */
/* =========================================== */
@media (max-width: 992px) {
    .desktop-nav {
        display: none;
    }

    .split-layout {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

@media (max-width: 768px) {
    body {
        padding-bottom: var(--navbar-height) !important;
    }

    .container {
        width: 90%;
    }

    .main-content {
        padding: 1.5rem 0;
    }

    .mobile-navbar {
        display: flex;
        justify-content: space-around;
        align-items: stretch;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: var(--navbar-height);
        background-color: var(--bg-light);
        border-top: 1px solid var(--border-color);
        z-index: 1000;
    }

    .mobile-navbar .nav-link {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        color: var(--text-muted);
        text-decoration: none;
        font-size: 0.7rem;
        transition: color 0.3s ease;
        flex-grow: 1;
        padding: 5px 0;
    }

    .mobile-navbar .nav-link svg {
        width: 24px;
        height: 24px;
        margin-bottom: 2px;
    }

    .mobile-navbar .nav-link.active {
        color: var(--primary-red);
    }

    /* Mobil Tablo Stilleri */
    .table thead {
        display: none;
    }

    .table,
    .table tbody,
    .table tr,
    .table td {
        display: block;
        width: 100% !important;
    }

    .table tr {
        border: 1px solid var(--border-color);
        border-radius: 5px;
        margin-bottom: 1rem;
        padding: 0.75rem;
    }

    #invoice-items tr {
        display: block;
        border: none;
        padding: 0;
        margin: 0 0 1rem 0;
        border-bottom: 1px solid var(--border-color);
    }

    .table td {
        display: block;
        text-align: right;
        padding: 0.5rem 0.25rem;
        border-bottom: 1px dotted #444;
        width: 100% !important;
    }

    .table td::before {
        content: attr(data-label);
        display: block;
        font-weight: bold;
        text-align: left;
        color: var(--text-muted);
        font-size: 0.8em;
        margin-bottom: 0.25rem;
    }

    .table td:last-child {
        border-bottom: 0;
    }

    .table td a {
        color: var(--blue);
    }

    .table td select,
    .table td input,
    .table td span {
        text-align: left;
        width: 100%;
        display: block;
    }

    .table td .product-select {
        margin-bottom: 0.5rem;
    }

    .actions-cell {
        padding-top: 1rem !important;
        display: flex !important;
        flex-direction: row;
        gap: 0.5rem;
    }

    .actions-cell .btn {
        flex: 1;
    }

    .actions-cell::before {
        display: none;
    }

    .page-header h1 {
        font-size: 1.5rem;
    }

    .card .amount {
        font-size: 1.75rem;
    }

    .totals-summary {
        max-width: none;
        margin-left: 0;
    }

    .table .totals-summary-footer {
        border: none;
        padding: 0;
        margin: 0;
    }

    .table .totals-summary-footer tr {
        border: none;
        padding: 0;
        margin: 0;
    }

    .table .totals-summary-footer td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        font-size: 1rem !important;
    }

    .table .totals-summary-footer td::before {
        content: attr(data-label);
        font-weight: normal;
        color: var(--text-muted);
    }

    .table tfoot.totals-summary-footer .grand-total-row td,
    .table tfoot.totals-summary-footer .final-due td {
        color: #fff !important;
        font-size: 1.1rem !important;
    }

    .table tfoot.totals-summary-footer .final-due td {
        color: var(--green) !important;
    }
}