/* --- Resetowanie stylów --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

/* --- Kolory --- */
:root {
    --primary-bg: #1e1e2f;
    --secondary-bg: #252540;
    --text-color: #ffffff;
    --accent-color: #ff9800;
    --hover-color: #ffac33;
}

/* --- Body i główny kontener --- */
body {
    background-color: var(--primary-bg);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

/* --- Header --- */
header {
    width: 100%;
    background-color: var(--secondary-bg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

header h2 {
    font-size: 24px;
    font-weight: bold;
    color: var(--accent-color);
}

nav ul {
    list-style: none;
    display: flex;
    gap: 15px;
}

nav ul li a {
    text-decoration: none;
    color: var(--text-color);
    font-size: 16px;
    font-weight: 500;
    padding: 10px 15px;
    transition: 0.3s ease-in-out;
    border-radius: 8px;
}

nav ul li a:hover {
    background-color: var(--hover-color);
}

/* --- Główna zawartość --- */
main {
    width: 90%;
    max-width: 1200px;
    margin-top: 20px;
    background: var(--secondary-bg);
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

/* --- Tabela (ogólne style) --- */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0;
}

table th, table td {
    padding: 12px 20px;
    text-align: center;
    border: 1px solid #444;
    white-space: nowrap;
}

table th, table td {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
}

table th {
    background-color: var(--accent-color);
    color: var(--primary-bg);
    font-weight: bold;
}

table td:nth-child(odd) {
    background-color: rgba(255, 255, 255, 0.05);
}

table td {
    background-color: var(--secondary-bg);
}

/* --- Przyciski --- */
button {
    background-color: var(--accent-color);
    color: var(--primary-bg);
    padding: 10px 15px;
    font-size: 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: 0.3s;
}

button:hover {
    background-color: var(--hover-color);
}

/* --- Stopka --- */
footer {
    margin-top: auto;
    padding: 10px 0;
    text-align: center;
    font-size: 14px;
    color: var(--text-color);
}

/* --- Styl dla przycisku "Szczegóły" --- */
.btn-details {
    display: inline-block;
    padding: 6px 10px;
    background-color: var(--accent-color);
    color: var(--primary-bg);
    font-weight: bold;
    text-decoration: none;
    border-radius: 6px;
    transition: background-color 0.3s ease-in-out, transform 0.3s ease-in-out;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.btn-details:hover {
    background-color: var(--hover-color);
    transform: scale(1.05);
}

/* --- Kontener tabeli --- */
.table-container {
    width: 100%;
    max-width: 1200px; /* Zwiększono z 1000px, aby pomieścić szerszą tabelę */
    margin: 20px auto;
    background-color: var(--secondary-bg);
    padding: 15px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    overflow-x: auto;
}

/* --- Wykres --- */
.chart-container {
    width: 100%;
    max-width: 1000px;
    height: 400px;
    margin-bottom: 10px;
    position: relative;
}

.chart-container canvas {
    width: 100% !important;
    height: 100% !important;
}

/* --- Kontener dla przycisku "Odśwież pozycje" --- */
.refresh-container {
    display: flex;
    justify-content: flex-end;
    margin-top: 15px;
    width: 100%;
    max-width: 1200px; /* Dopasowano do szerokości tabeli */
}

/* --- Nagłówek projektu --- */
.project-header {
    text-align: center;
    margin-bottom: 20px;
}

.project-header h2 {
    font-size: 24px;
    font-weight: bold;
    color: var(--accent-color);
}

.project-header a {
    color: var(--text-color);
    text-decoration: none;
}

.project-header a:hover {
    text-decoration: underline;
}

.status {
    font-size: 18px;
    margin-top: 5px;
}

/* --- Sekcja wykresu --- */
.chart-section {
    text-align: center;
    margin-bottom: 5px;
}

.chart-section h3 {
    font-size: 22px;
    font-weight: bold;
    color: var(--text-color);
    margin-bottom: 5px;
}

/* --- Kontener wykresu i tabeli --- */
.content-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    width: 100%;
    max-width: 1200px; /* Zwiększono z 1000px */
    margin: auto;
}

/* --- Styl dla formularza --- */
.project-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
    max-width: 500px;
    margin: 20px auto;
    padding: 20px;
    background-color: var(--secondary-bg);
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

/* --- Grupa formularza (label + input) --- */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

/* --- Etykiety --- */
.project-form label {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-color);
}

/* --- Inputy --- */
.project-form input[type="text"] {
    width: 100%;
    padding: 10px 15px;
    font-size: 16px;
    color: var(--text-color);
    background-color: var(--primary-bg);
    border: 1px solid #444;
    border-radius: 6px;
    outline: none;
    transition: border-color 0.3s ease-in-out, box-shadow 0.3s ease-in-out;
}

.project-form input[type="text"]:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 5px rgba(255, 152, 0, 0.5);
}

/* --- Przycisk w formularzu --- */
.project-form button {
    background-color: var(--accent-color);
    color: var(--primary-bg);
    padding: 10px 15px;
    font-size: 16px;
    font-weight: bold;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.3s ease-in-out, transform 0.3s ease-in-out;
    align-self: flex-end;
}

.project-form button:hover {
    background-color: var(--hover-color);
    transform: scale(1.05);
}

/* --- Styl dla formularza fraz kluczowych --- */
.keyword-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
    max-width: 500px;
    margin: 20px auto;
    padding: 20px;
    background-color: var(--secondary-bg);
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

/* --- Etykiety --- */
.keyword-form label {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-color);
}

/* --- Select --- */
.keyword-form select {
    width: 100%;
    padding: 10px 15px;
    font-size: 16px;
    color: var(--text-color);
    background-color: var(--primary-bg);
    border: 1px solid #444;
    border-radius: 6px;
    outline: none;
    transition: border-color 0.3s ease-in-out, box-shadow 0.3s ease-in-out;
    appearance: none;
    background-image: url('data:image/svg+xml;utf8,<svg fill="%23ffffff" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
}

.keyword-form select:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 5px rgba(255, 152, 0, 0.5);
}

/* --- Textarea --- */
.keyword-form textarea {
    width: 100%;
    height: 150px;
    padding: 10px 15px;
    font-size: 16px;
    color: var(--text-color);
    background-color: var(--primary-bg);
    border: 1px solid #444;
    border-radius: 6px;
    outline: none;
    resize: vertical;
    transition: border-color 0.3s ease-in-out, box-shadow 0.3s ease-in-out;
}

.keyword-form textarea:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 5px rgba(255, 152, 0, 0.5);
}

.keyword-form textarea::placeholder {
    color: #888;
}

/* --- Przycisk --- */
.keyword-form button {
    background-color: var(--accent-color);
    color: var(--primary-bg);
    padding: 10px 15px;
    font-size: 16px;
    font-weight: bold;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.3s ease-in-out, transform 0.3s ease-in-out;
    align-self: flex-end;
}

.keyword-form button:hover {
    background-color: var(--hover-color);
    transform: scale(1.05);
}

/* --- Styl dla przycisku "Edytuj" --- */
.btn-edit {
    display: inline-block;
    padding: 6px 10px;
    background-color: #2196f3;
    color: #fff;
    font-weight: bold;
    text-decoration: none;
    border-radius: 6px;
    transition: background-color 0.3s ease-in-out, transform 0.3s ease-in-out;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.btn-edit:hover {
    background-color: #42a5f5;
    transform: scale(1.05);
}

/* --- Styl dla przycisku "Usuń" --- */
.btn-delete {
    display: inline-block;
    padding: 6px 10px;
    background-color: #f44336;
    color: #fff;
    font-weight: bold;
    text-decoration: none;
    border-radius: 6px;
    transition: background-color 0.3s ease-in-out, transform 0.3s ease-in-out;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.btn-delete:hover {
    background-color: #ef5350;
    transform: scale(1.05);
}

/* --- Styl dla tabeli w dashboardzie --- */
.dashboard-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0;
}

.dashboard-table th, .dashboard-table td {
    padding: 12px 20px;
    text-align: center;
    border: 1px solid #444;
    white-space: normal;
}

.dashboard-table th {
    background-color: var(--accent-color);
    color: var(--primary-bg);
    font-weight: bold;
}

.dashboard-table td {
    background-color: var(--secondary-bg);
}

.dashboard-table td:nth-child(odd) {
    background-color: rgba(255, 255, 255, 0.05);
}

.dashboard-table th:nth-child(1),
.dashboard-table td:nth-child(1) {
    width: 50px;
}

.dashboard-table th:nth-child(2),
.dashboard-table td:nth-child(2) {
    width: 200px;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dashboard-table th:nth-child(3),
.dashboard-table td:nth-child(3) {
    width: 400px;
    max-width: 400px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dashboard-table th:last-child,
.dashboard-table td:last-child {
    width: 350px;
    min-width: 350px;
    padding: 12px 10px;
}

.dashboard-table td:last-child {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    justify-content: center;
    align-items: center;
}

/* --- Styl dla tabeli w project_details --- */
.details-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0;
}

.details-table th, .details-table td {
    padding: 12px 15px; /* Mniejszy padding, aby zmieścić więcej kolumn */
    text-align: center;
    border: 1px solid #444;
    white-space: nowrap;
}

.details-table th {
    background-color: var(--accent-color);
    color: var(--primary-bg);
    font-weight: bold;
}

.details-table td {
    background-color: var(--secondary-bg);
}

.details-table td:nth-child(odd) {
    background-color: rgba(255, 255, 255, 0.05);
}

.details-table th:first-child,
.details-table td:first-child {
    width: 300px; /* Szersza kolumna dla "Fraza kluczowa" */
    max-width: 300px;
    white-space: normal; /* Pozwalamy na zawijanie fraz */
    overflow: hidden;
    text-overflow: ellipsis;
}

.details-table th:not(:first-child),
.details-table td:not(:first-child) {
    width: 50px; /* Kolumny z dniami – wystarczająco na liczby */
    min-width: 50px;
}

/* --- Styl dla formularza logowania --- */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
    max-width: 400px; /* Węższy formularz dla logowania */
    margin: 20px auto;
    padding: 20px;
    background-color: var(--secondary-bg);
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

/* --- Etykiety --- */
.login-form label {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-color);
}

/* --- Inputy --- */
.login-form input[type="text"],
.login-form input[type="password"] {
    width: 100%;
    padding: 10px 15px;
    font-size: 16px;
    color: var(--text-color);
    background-color: var(--primary-bg);
    border: 1px solid #444;
    border-radius: 6px;
    outline: none;
    transition: border-color 0.3s ease-in-out, box-shadow 0.3s ease-in-out;
}

.login-form input[type="text"]:focus,
.login-form input[type="password"]:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 5px rgba(255, 152, 0, 0.5);
}

/* --- Przycisk logowania --- */
.login-form button {
    background-color: var(--accent-color);
    color: var(--primary-bg);
    padding: 10px 15px;
    font-size: 16px;
    font-weight: bold;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.3s ease-in-out, transform 0.3s ease-in-out;
    align-self: flex-end;
}

.login-form button:hover {
    background-color: var(--hover-color);
    transform: scale(1.05);
}

/* --- Kontener dla filtrów --- */
.filter-container {
    width: 100%;
    max-width: 1200px;
    margin: 20px auto;
    padding: 15px;
    background-color: var(--secondary-bg);
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

/* --- Formularz filtrów --- */
.filter-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.filter-form label {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-color);
}

.filter-form select,
.filter-form input[type="date"] {
    width: 100%;
    max-width: 300px;
    padding: 10px 15px;
    font-size: 16px;
    color: var(--text-color);
    background-color: var(--primary-bg);
    border: 1px solid #444;
    border-radius: 6px;
    outline: none;
    transition: border-color 0.3s ease-in-out, box-shadow 0.3s ease-in-out;
}

.filter-form select:focus,
.filter-form input[type="date"]:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 5px rgba(255, 152, 0, 0.5);
}

/* --- Kontener dla niestandardowego zakresu dat --- */
.custom-date-range {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.custom-date-range label {
    margin-right: 10px;
    align-self: center;
}

/* --- Ikony danych w tabeli --- */
.data-icon {
    display: inline-block;
    margin-left: 5px;
}

.alt-icon, .url-icon {
    font-size: 16px;
    cursor: help;
    margin-left: 3px;
    vertical-align: middle;
}

.url-icon {
    color: blue;
}

/* Tooltip style */
.data-icon [title]:hover:after {
    content: attr(title);
    position: absolute;
    background-color: #333;
    color: #fff;
    padding: 5px 10px;
    border-radius: 4px;
    z-index: 1000;
    white-space: nowrap;
    margin-top: -30px;
    margin-left: -50px;
}

.refresh-container form {
    margin-right: 10px; /* Odstęp między formularzami */
}

.refresh-container form:last-child {
    margin-right: 0; /* Usuń margines dla ostatniego formularza */
}