body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    background-color: #f4f7f9;
    color: #333;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 5vw;
  background-color: #1a6fb0;
  color: white;
  box-sizing: border-box;
  width: 100%;
}

header img {
  height: clamp(60px, 15vw, 120px); 
  width: auto;
  background-color: white;
  padding: 10px;
}

header hgroup {
  flex: 1;
  min-width: 300px; 
  text-align: left;
}

header h1 {
  margin: 0;
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  line-height: 1.2;
}

header h2 {
  margin: 5px 0 0 0;
  font-size: clamp(1rem, 2.5vw, 1.5rem);
  font-weight: normal;
  opacity: 0.9;
}

main {
    max-width: 900px;
    width: 100%;
    padding: 2rem 1rem;
    box-sizing: border-box;
}

.info-box {
    background-color: #eaf2f8;
    border-left: 5px solid #3498db;
    padding: 1.5rem;
    margin-bottom: 2rem;
    font-size: 0.95rem;
    border-radius: 0 5px 5px 0;
}

.info-box a {
    color: #2980b9;
    text-decoration: none;
    font-weight: 500;
}

.info-box a:hover {
    text-decoration: underline;
}


.controls {
    text-align: center;
    margin-bottom: 20px;
}

.btn {
    display: inline-block;
    border: none;
    padding: 12px 25px;
    font-size: 1rem;
    font-weight: 500;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.15);
    text-decoration: none;
}
.btn:hover {
    transform: translateY(-2px);
}
.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

#modify-btn,
#generate-btn {
    background-color: #3498db;
    color: white;
}


#pdf-container {
    width: 100%;
    height: clamp(420px, 87vh, 860px);
    border: 1px solid #ccc;
    margin-top: 0;
    display: none;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

#download-link {
    background-color: #2ecc71;
    color: white;
}

#download-link:hover {
    background-color: #27ae60;
}

.btn--secondary {
    background-color: #1aa39a;
    color: white;
}

.btn--secondary:hover {
    background-color: #178f87;
}

.personal-data-section {
    margin: 2rem 0;
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.personal-data-section[hidden] {
    display: none;
}

#selection-section[hidden],
.result-section[hidden] {
    display: none;
}

.personal-data-intro {
    display: flex;
    gap: 1rem;
    align-items: stretch;
    flex-wrap: wrap;
    margin: 0 0 1.5rem 0;
}

.personal-data-intro .btn {
    align-self: stretch;
    white-space: nowrap;
    min-width: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.info-note {
    background-color: #f0f6fb;
    border-left: 4px solid #3498db;
    padding: 1rem;
    margin: 0;
    font-size: 0.95rem;
    border-radius: 0 5px 5px 0;
    display: flex;
    align-items: center;
    flex: 1;
}

.form-error {
    background-color: #fdecea;
    border-left: 4px solid #e74c3c;
    color: #8e2a20;
    padding: 0.9rem 1rem;
    margin: 0 0 1.5rem 0;
    border-radius: 0 5px 5px 0;
    font-weight: 600;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem 1.5rem;
    margin-bottom: 1.5rem;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-field--full {
    grid-column: 1 / -1;
}

.form-field label {
    font-size: 0.95rem;
    font-weight: 600;
    color: #2c3e50;
}

.form-field input {
    padding: 10px 12px;
    border: 1px solid #d6dce2;
    border-radius: 4px;
    font-size: 0.95rem;
}

.form-field input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52,152,219,0.2);
}

.form-field input.field-error {
    border-color: #e74c3c;
    box-shadow: 0 0 0 2px rgba(231,76,60,0.15);
}

fieldset.form-field {
    display: block;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 1rem;
    margin: 0 0 1.5rem 0;
}

fieldset.form-field.field-error {
    border-color: #e74c3c;
    box-shadow: 0 0 0 2px rgba(231,76,60,0.12);
}

fieldset.form-field legend {
    font-weight: 600;
    padding: 0 0.5rem;
    color: #2c3e50;
}

.radio-group {
    display: flex;
    gap: 1.5rem;
    margin-top: 0.5rem;
}

.radio-group label {
    font-weight: 500;
    color: #2c3e50;
}

.hint {
    margin: 0.5rem 0 0;
    font-size: 0.9rem;
    color: #566573;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: flex-start;
}

.optional {
    font-weight: 400;
    color: #7a8a99;
    font-size: 0.85rem;
}

.result-section {
    margin-top: 2rem;
    width: 100vw;
    margin-left: calc(50% - 50vw);
    padding: 0 5vw;
    box-sizing: border-box;
}

.result-layout {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 1fr);
    gap: 2rem;
    align-items: start;
    max-width: 1280px;
    margin: 0 auto;
}

.result-preview {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.result-side {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.result-manual {
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    font-size: smaller;
}

.result-manual ul {
    margin: 0.75rem 0 1rem;
    padding-left: 1.2rem;
}

.result-manual li {
    margin-bottom: 0.4rem;
}

.result-manual h3 {
    margin-top: 0;
}

.result-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1.5rem;
}

.result-actions .btn {
    flex: 1 1 220px;
    text-align: center;
}

@media (max-width: 900px) {
    .result-layout {
        grid-template-columns: 1fr;
    }

    #pdf-container {
        height: clamp(360px, 60vh, 640px);
    }
}

iframe {
    width: 100%;
    height: 100%;
    border: none;
}

#project-list {
    margin-bottom: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.project-item {
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.project-item:hover {
    border-color: #3498db;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.project-item.selected {
    border-color: #2980b9;
    background-color: #f8f9fa;
    box-shadow: 0 4px 15px rgba(41, 128, 185, 0.2);
}

.project-item>div>button {
    float: right;
    border: none;
    padding: 12px 25px;
    font-size: 1rem;   
    font-weight: 500;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.15);
}                      
.project-item>div>button:hover {
    transform: translateY(-2px);
}
.project-item>div>button:active {
    transform: translateY(0);
}


.project-header {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
    cursor: pointer;
}

.project-header input[type="checkbox"] {
    margin-right: 1rem;
    width: 18px;
    height: 18px;
    accent-color: #3498db;
}

.project-header label {
    font-size: 1.4rem;
    font-weight: 600;
    color: #2c3e50;
    cursor: pointer;
    flex-grow: 1;
}


.project-details {
    position: relative;
    margin-top: 1rem;
    overflow: hidden;
    max-height: 3em;
    transition: max-height 0.5s ease-in-out;
    -webkit-mask-image: linear-gradient(to bottom, black 70%, transparent 100%);
    mask-image: linear-gradient(to bottom, black 70%, transparent 100%);    
}

.project-details p {
    margin: 0 0 1rem 0;
    color: #555;
}

/* Expanded State */
.project-details.expanded {
    max-height: 500px; /* Large enough for content */
    overflow: auto;
    -webkit-mask-image: none;
    mask-image: none;    
}

.project-links {
    margin-top: 1rem;
}

.project-links a {
    color: #3498db;
    text-decoration: none;
    margin-right: 1rem;
    font-size: 0.9rem;
    transition: color 0.2s ease;
}

.project-links a:hover {
    color: #2980b9;
    text-decoration: underline;
}

.project-item.selected .project-header label::after {
    content: ' (Wybrano)';
    color: #2980b9;
    font-weight: 600;
    font-size: 1.2rem;
    margin-left: 8px;
}

.timeline-container {
  width: 100%;
  padding: 40px 0;
  margin-bottom: 20px;
  box-sizing: border-box;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* Firefox */
  user-select: none;
  touch-action: pan-x;
  -webkit-mask-image: linear-gradient(to right, transparent 0%, black 10%, black 90%, transparent 100%);
  mask-image: linear-gradient(to right, transparent 0%, black 10%, black 90%, transparent 100%);
}

.timeline-container::-webkit-scrollbar {
  display: none; /* Safari and Chrome */
}

ul.timeline {
  list-style: none;
  display: flex;
  padding: 0 20px;
  margin: 0;
  position: relative;
  min-width: 900px;
}

ul.timeline::before {
    content: '';
    position: absolute;
    top: 24px;
    left: 0;
    right: 0;
    height: 2px;
    background-color: #ccc;
    z-index: 0;
}


ul.timeline > li {
  flex: 1;
  text-align: center;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

ul.timeline > li .step-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  font-size: 1.2em;
  font-weight: bold;
  color: #333;
  background-color: #f4f7f9;
  border: 2px solid #ccc;
  border-radius: 50%;
  margin-bottom: 10px;
  z-index: 1;
}


ul.timeline > li .step-title {
  display: block;
  font-size: 0.8em;
  color: #666;
  margin-top: 10px;
  font-weight: bold;
  height: 40px;
}

ul.timeline > li .note {
  display: block;
  font-size: 0.8em;
  color: #000;
  margin-top: 5px;
  font-weight: bold;
}

ul.timeline > li:nth-child(5) .step-number {
    border-color: #007bff;
    color: #007bff;
}

footer {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 2.5vw 5vw 4vw;
  background-color: #1a6fb0;
  color: white;
  box-sizing: border-box;
  width: 100%;
  margin-top: 6rem;
  font-size: 0.9rem;
}

footer > div {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: flex-start;
    flex: 1;
    min-width: 250px;
    text-align: left;
}

.footer-links {
    justify-content: flex-end;
    text-align: right;
}

footer > div p {
    margin: 0;
}

footer a {
    color: white;
    text-decoration: none;
    font-size: 0.9rem;
}

footer a:hover {
    text-decoration: underline;
}
