/* Resetowanie i podstawowe style */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    font-family: Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f4f4f4;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.page-container {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.content-wrap {
    flex: 1;
    padding: 20px;
}

.container {
    width: 90%;
    margin: auto;
    overflow: hidden;
    padding: 0 10px;
}

/* Nagłówek i nawigacja */
header {
    background-color: #333;
    color: #fff;
    padding: 1rem 0;
    border-bottom: #0779e4 3px solid;
}

header nav ul {
    list-style-type: none;
    padding: 0;
    display: flex;
    justify-content: center;
}

header nav ul li {
    margin: 0 10px;
}

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

header a:hover {
    color: #0779e4;
}

/* Główna zawartość */
main {
    padding: 20px 0;
}

h1, h2, h3 {
    margin-bottom: 20px;
}

/* Dashboard */
.dashboard-stats {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    margin-bottom: 30px;
}

.stat-box {
    background: #fff;
    padding: 20px;
    text-align: center;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    flex-basis: calc(25% - 20px);
    margin-bottom: 20px;
}

.stat-box h3 {
    margin-top: 0;
    color: #333;
}

.stat-box p {
    font-size: 24px;
    font-weight: bold;
    color: #0779e4;
}

/* Formularze */
form {
    background: #fff;
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

input[type="text"], 
input[type="email"], 
input[type="password"], 
input[type="number"],
input[type="date"],
select, 
textarea {
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

/* Przyciski */
.btn {
    display: inline-block;
    padding: 10px 20px;
    background: #0779e4;
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    text-decoration: none;
    font-size: 16px;
}

.btn:hover {
    background: #0766b8;
}

.btn-secondary {
    background: #333;
}

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

/* Tabele */
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    background-color: #fff;
}

table, th, td {
    border: 1px solid #ddd;
}

th, td {
    text-align: left;
    padding: 12px;
}

th {
    background-color: #f4f4f4;
    font-weight: bold;
}

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

/* Przyciski akcji przy dzieciach w tabeli rodziców */
.children-actions { 
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    -webkit-flex-wrap: wrap;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
    margin: -3px;
}
.children-actions .btn { 
    margin: 3px; 
    padding: 6px 10px; 
    font-size: 14px; 
}

/* Nowy układ dla listy dzieci w panelu admina */
.children-list { 
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -webkit-flex-direction: column;
    -ms-flex-direction: column;
    flex-direction: column;
    margin: 0; 
    padding: 0; 
}
.children-list > * {
    margin-bottom: 4px;
}
.child-item { 
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -webkit-flex-direction: column;
  -ms-flex-direction: column;
  flex-direction: column;
  padding: 4px; 
  border: none; 
  border-radius: 4px; 
  background: transparent; 
}
.child-item > * {
  margin-bottom: 4px;
}
.child-name { 
  font-weight: 500; 
  color: #333; 
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  -ms-flex-align: center;
  align-items: center;
}
.child-name > * {
  margin-right: 8px;
}
.child-name > *:last-child {
  margin-right: 0;
}
.archived-badge { 
  color: #dc3545; 
  font-size: 12px; 
  font-weight: normal; 
  background: transparent; 
  padding: 2px 6px; 
  border-radius: 3px; 
  border: 1px solid #dc3545; 
}
.child-actions { 
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  -webkit-flex-wrap: wrap;
  -ms-flex-wrap: wrap;
  flex-wrap: wrap;
  -webkit-box-align: center;
  -webkit-align-items: center;
  -ms-flex-align: center;
  align-items: center; 
  margin: -1px;
  padding: 0;
}
.child-actions > * {
  margin: 1px;
}

/* Małe przyciski dla akcji przy dzieciach */
.btn-small { 
  padding: 2px 5px !important; 
  font-size: 10px !important; 
  min-width: auto !important; 
  white-space: nowrap !important;
  line-height: 1.2 !important;
  border: none !important;
  box-shadow: none !important;
}
.btn-primary { background: #0d6efd !important; }
.btn-secondary { background: #6c757d !important; }
.btn-danger { background: #dc3545 !important; }
.btn-success { background: #198754 !important; }

/* Responsywność dla tabeli rodziców */
@media (max-width: 1200px) {
  .child-actions {
    flex-direction: column;
    align-items: flex-start;
  }
  .child-actions .btn-small {
    width: 100%;
    text-align: center;
  }
}

/* Komunikaty */
.alert {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 5px;
}

.alert-success {
    background-color: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

.alert-danger {
    background-color: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

/* Stopka */
footer {
    background-color: #333;
    color: #fff;
    text-align: center;
    padding: 10px 0;
    margin-top: auto;
}

/* Styles for payment list */
.payment-list-form {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.payment-list-form select, 
.payment-list-form button {
    padding: 10px;
    margin-right: 10px;
}

.payment-list-table {
    width: 100%;
    border-collapse: collapse;
}

.payment-list-table th, 
.payment-list-table td {
    border: 1px solid #ddd;
    padding: 12px;
    text-align: left;
}

.payment-list-table th {
    background-color: #f2f2f2;
}

.payment-list-table input[type="checkbox"] {
    transform: scale(1.5);
    margin-right: 10px;
}

/* Responsywność */
@media (max-width: 768px) {
    .dashboard-stats {
        flex-direction: column;
    }

    .stat-box {
        flex-basis: 100%;
    }

    header nav ul {
        flex-direction: column;
    }

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

    .payment-list-form {
        flex-direction: column;
        align-items: stretch;
    }

    .payment-list-form select,
    .payment-list-form button {
        margin-bottom: 10px;
        width: 100%;
    }
}

/* --- Layout refinements for sidebar layout pages --- */
.content-wrap { padding: 24px; }

@media (max-width: 992px) {
  .content-wrap { padding-left: 20px; padding-right: 20px; }
}

.responsive-table { overflow-x: auto; }

.admin-form-grid {
  display: -ms-grid;
  display: grid;
  -ms-grid-columns: repeat(auto-fit, minmax(180px, 1fr));
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin: -5px;
}
.admin-form-grid > * {
  margin: 5px;
}

.admin-form-grid input,
.admin-form-grid select,
.admin-form-grid button {
  width: 100%;
}

/* Nowe style dla panelu admina rodziców */
.parent-admin-panel {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  padding: 24px;
  margin-bottom: 24px;
}

.parent-admin-panel h1, 
.parent-admin-panel h2 {
  color: #2c3e50;
  margin-bottom: 16px;
}

.parent-admin-form {
  display: -ms-grid;
  display: grid;
  -ms-grid-columns: repeat(auto-fill, minmax(200px, 1fr));
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  margin: -6px;
  margin-bottom: 24px;
}
.parent-admin-form > * {
  margin: 6px;
}

.parent-admin-form input {
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.parent-admin-table {
  width: 100%;
  border-collapse: collapse;
}

.parent-admin-table th {
  background: #f8f9fa;
  padding: 12px;
  text-align: left;
}

.parent-admin-table td {
  padding: 12px;
  border-bottom: 1px solid #eee;
}

/* Nowe style dla panelu rodzica */
.parent-panel {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  padding: 24px;
}

.parent-info-card {
  background: #f8f9fa;
  padding: 16px;
  border-radius: 6px;
  margin-bottom: 24px;
}

.children-list-card {
  margin-bottom: 24px;
}

.payment-card {
  background: #f8f9fa;
  padding: 16px;
  border-radius: 6px;
}

.payment-item {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid #eee;
}

.payment-status {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: bold;
}

.payment-status.pending {
  background: #fff3cd;
  color: #856404;
}

.payment-status.paid {
  background: #d4edda;
  color: #155724;
}

/* Responsywność */
@media (max-width: 768px) {
  .parent-admin-form {
    grid-template-columns: 1fr;
  }
  
  .parent-admin-table th, 
  .parent-admin-table td {
    padding: 8px;
  }
}