/* General Styles */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #1a1a2e;
    /* Dark background */
    color: #e0e0e0;
    /* Light text */
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 20px auto;
    padding: 20px;
    background-color: #2a2a4a;
    /* Slightly lighter dark background for content */
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    flex-grow: 1;
}

h1,
h2,
h3 {
    color: #87CEEB;
    /* Sky blue for headings */
    text-align: center;
    margin-bottom: 20px;
}

hr {
    border: none;
    border-top: 1px solid #4a4a6a;
    margin: 20px 0;
}

/* Header & Navigation */
.main-header {
    background-color: #0f0f1d;
    padding: 15px 0;
    border-bottom: 1px solid #3a3a5a;
}

.main-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    justify-content: space-around;
    align-items: center;
}

.main-nav ul li a {
    color: #e0e0e0;
    text-decoration: none;
    padding: 10px 15px;
    display: block;
    transition: background-color 0.3s ease, color 0.3s ease;
    border-radius: 5px;
}

.main-nav ul li a:hover {
    background-color: #4a4a6a;
    color: #fff;
}

.main-nav .right-align {
    margin-left: auto;
    /* Push to the right */
    display: flex;
    align-items: center;
}

.main-nav .right-align li {
    margin-left: 15px;
}

.main-nav .right-align li:first-child {
    color: #87CEEB;
    font-weight: bold;
    padding-right: 10px;
}

/* Forms */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #87CEEB;
    font-weight: bold;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group input[type="email"],
.form-group select {
    width: calc(100% - 20px);
    padding: 10px;
    margin-top: 5px;
    border: 1px solid #4a4a6a;
    border-radius: 5px;
    background-color: #1a1a2e;
    color: #e0e0e0;
    font-size: 1em;
    box-sizing: border-box;
    /* Include padding in width */
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 20px;
    background-color: #87CEEB;
    color: #1a1a2e;
    text-decoration: none;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.3s ease, transform 0.2s ease;
    text-align: center;
}

.btn:hover {
    background-color: #6fb5e3;
    transform: translateY(-2px);
}

.btn-danger {
    background-color: #e74c3c;
    color: #fff;
}

.btn-danger:hover {
    background-color: #c0392b;
}

.btn-edit {
    background-color: #f39c12;
    color: #fff;
}

.btn-edit:hover {
    background-color: #e67e22;
}

.btn-logout {
    background-color: #f39c12;
    /* Pomarańczowy dla wylogowania */
    color: #1a1a2e;
}

.btn-logout:hover {
    background-color: #e67e22;
}

/* Messages */
.message-box {
    padding: 10px;
    border-radius: 5px;
    margin-top: 15px;
    font-weight: bold;
    text-align: center;
}

.success-message {
    background-color: #27ae60;
    color: #fff;
}

.error-message {
    background-color: #e74c3c;
    color: #fff;
}

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background-color: #3a3a5a;
    border-radius: 8px;
    overflow: hidden;
    /* For rounded corners */
}

.data-table th,
.data-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #4a4a6a;
}

.data-table th {
    background-color: #4a4a6a;
    color: #fff;
    font-weight: bold;
    text-transform: uppercase;
}

.data-table tbody tr:nth-child(even) {
    background-color: #333355;
}

.data-table tbody tr:hover {
    background-color: #45456b;
}

/* Status cells in tables */
.status-cell {
    font-weight: bold;
}

.status-green {
    color: #2ecc71;
    /* Green for "na stanie" */
}

.status-red {
    color: #e74c3c;
    /* Red for "sprzedano" */
}


/* Login Page Specific */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: #1a1a2e;
}

.login-container {
    background-color: #2a2a4a;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-container h2 {
    color: #87CEEB;
    margin-bottom: 25px;
}

.login-container .form-group input {
    width: calc(100% - 22px);
    /* Adjust for padding and border */
    padding: 12px;
    margin-top: 8px;
    border: 1px solid #555;
    border-radius: 6px;
    background-color: #1e1e3e;
    color: #e0e0e0;
}

.login-container .btn {
    width: 100%;
    margin-top: 20px;
    padding: 12px;
}

/* Dashboard Page Specific */
.dashboard-page .summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.dashboard-page .summary-card {
    background-color: #3a3a5a;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.dashboard-page .summary-card h3 {
    color: #87CEEB;
    margin-top: 0;
    font-size: 1.5em;
}

.dashboard-page .summary-card p {
    font-size: 2em;
    font-weight: bold;
    color: #e0e0e0;
}

.dashboard-page .update-gold-section {
    background-color: #3a3a5a;
    padding: 25px;
    border-radius: 8px;
    margin-top: 30px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.dashboard-page .update-gold-section form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: flex-end;
}

.dashboard-page .update-gold-section .form-group {
    margin-bottom: 0;
    /* Override default margin */
}

.dashboard-page .update-gold-section button {
    grid-column: 1 / -1;
    /* Make button span full width */
    margin-top: 15px;
}

/* Magazyn Page Specific */
.add-item-section,
.item-list-section {
    background-color: #3a3a5a;
    padding: 25px;
    border-radius: 8px;
    margin-top: 30px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.add-item-section form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    align-items: flex-end;
}

.add-item-section .form-group {
    margin-bottom: 0;
}

.add-item-section button {
    grid-column: 1 / -1;
    margin-top: 15px;
}

.item-actions {
    display: flex;
    gap: 5px;
    justify-content: center;
}

.item-actions .btn {
    padding: 8px 12px;
    font-size: 0.9em;
}

/* Modal Styles */
.modal {
    display: none;
    /* Hidden by default */
    position: fixed;
    /* Stay in place */
    z-index: 1000;
    /* Sit on top */
    left: 0;
    top: 0;
    width: 100%;
    /* Full width */
    height: 100%;
    /* Full height */
    overflow: auto;
    /* Enable scroll if needed */
    background-color: rgba(0, 0, 0, 0.7);
    /* Black w/ opacity */
    justify-content: center;
    /* Center horizontally */
    align-items: center;
    /* Center vertically */
}

.modal-content {
    background-color: #2a2a4a;
    margin: auto;
    padding: 30px;
    border-radius: 10px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    position: relative;
}

.close-button {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    position: absolute;
    top: 10px;
    right: 20px;
}

.close-button:hover,
.close-button:focus {
    color: #e0e0e0;
    text-decoration: none;
    cursor: pointer;
}

.modal-content h2 {
    margin-top: 0;
    color: #87CEEB;
}

.modal-content form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.modal-content .form-group {
    margin-bottom: 0;
    /* Remove bottom margin as grid provides gap */
}

.modal-content button[type="submit"] {
    grid-column: 1 / -1;
    /* Make submit button span full width */
    margin-top: 20px;
}

/* Historia Page Specific */
.filter-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}

.filter-buttons .btn {
    flex-grow: 1;
    max-width: 200px;
    background-color: #4a4a6a;
    color: #e0e0e0;
}

.filter-buttons .btn.active-filter {
    background-color: #87CEEB;
    color: #1a1a2e;
    font-weight: bold;
}

.transactions-list {
    margin-top: 20px;
}

.transaction-item {
    background-color: #3a3a5a;
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
}

.transaction-timestamp {
    font-size: 0.9em;
    color: #bbb;
    margin-bottom: 5px;
}

.transaction-description {
    font-size: 1.1em;
    color: #e0e0e0;
}

.transaction-description strong {
    color: #87CEEB;
    /* Highlight bold text */
}

/* Responsive Design */
@media (max-width: 768px) {
    .main-nav ul {
        flex-direction: column;
        align-items: flex-start;
    }

    .main-nav ul li {
        margin: 10px 0;
        width: 100%;
        text-align: center;
    }

    .main-nav .right-align {
        margin-left: 0;
        width: 100%;
        text-align: center;
        margin-top: 10px;
    }

    .login-container {
        padding: 20px;
    }

    .data-table th,
    .data-table td {
        padding: 8px;
        font-size: 0.9em;
    }

    /* Make table stack on small screens */
    .data-table,
    .data-table tbody,
    .data-table tr,
    .data-table td {
        display: block;
        width: 100%;
    }

    .data-table thead {
        display: none;
        /* Hide header */
    }

    .data-table tr {
        margin-bottom: 15px;
        border: 1px solid #4a4a6a;
        border-radius: 8px;
        overflow: hidden;
    }

    .data-table td {
        text-align: right;
        padding-left: 50%;
        position: relative;
    }

    .data-table td::before {
        content: attr(data-label);
        /* Use data-label for content */
        position: absolute;
        left: 0;
        width: 50%;
        padding-left: 15px;
        font-weight: bold;
        text-align: left;
        color: #87CEEB;
    }

    .modal-content form {
        grid-template-columns: 1fr;
        /* Single column for forms in modal */
    }

    .dashboard-page .update-gold-section form,
    .add-item-section form {
        grid-template-columns: 1fr;
    }
}