/* --- FUNDAMENTY --- */
* {
    box-sizing: border-box;
}

/* Zmienne kolorów dla jasnego i ciemnego trybu */
:root {
    --bg-primary: #f4f4f9;
    --bg-secondary: #fff;
    --text-primary: #333;
    --text-secondary: #666;
    --border-color: #e0e0e0;
    --shadow-color: rgba(0, 0, 0, 0.08);
    --hover-bg: #f0f0f5;
    --icon-fill: #333;
    --icon-fill-hover: #1976d2;
}

/* Ciemny tryb */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #1e1e1e;
        --bg-secondary: #2d2d2d;
        --text-primary: #e0e0e0;
        --text-secondary: #b0b0b0;
        --border-color: #444;
        --shadow-color: rgba(0, 0, 0, 0.3);
        --hover-bg: #3a3a3a;
        --icon-fill: #e0e0e0;
        --icon-fill-hover: #64b5f6;
    }
}

html[data-theme="dark"] {
    --bg-primary: #1e1e1e;
    --bg-secondary: #2d2d2d;
    --text-primary: #e0e0e0;
    --text-secondary: #b0b0b0;
    --border-color: #444;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --hover-bg: #3a3a3a;
    --icon-fill: #e0e0e0;
    --icon-fill-hover: #64b5f6;
}

html[data-theme="light"] {
    --bg-primary: #f4f4f9;
    --bg-secondary: #fff;
    --text-primary: #333;
    --text-secondary: #666;
    --border-color: #e0e0e0;
    --shadow-color: rgba(0, 0, 0, 0.08);
    --hover-bg: #f0f0f5;
    --icon-fill: #333;
    --icon-fill-hover: #1976d2;
}

body {
    font-family: 'Segoe UI', Arial, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 100vh;
    margin: 0;
    padding: 20px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

h1 { display: none; }

/* --- KONTENER GŁÓWNY (GRID) --- */
.container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 25px;
    width: 100%;
    max-width: 1600px;
    margin: 20px auto;
}

/* --- KAFELEK GENERATORA --- */
.generator-tile {
    background-color: var(--bg-secondary);
    border-radius: 12px;
    box-shadow: 0 4px 12px var(--shadow-color);
    border: 1px solid var(--border-color);
    padding: 24px;
    display: flex;
    flex-direction: column;
    height: auto;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

h2 {
    color: var(--text-primary);
    margin: 0 0 20px 0;
    font-size: 1.4rem;
    font-weight: 600;
    transition: color 0.3s ease;
}

/* --- SEKCJA WYNIKÓW I IKONA KOPIOWANIA --- */
.output-label {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.generated-output {
    font-size: clamp(1.5rem, 5vw, 2.2rem); 
    font-weight: bold;
    line-height: 1.2;
    margin: 12px 0 12px 0;
    padding: 20px 10px;
    width: 100%;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80px;
    transition: background-color 0.2s;
    position: relative; /* Potrzebne do ikony */
}

.output-info {
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-align: center;
    margin: 0 0 20px 0;
    padding: 8px;
    font-weight: 500;
    transition: color 0.3s ease;
}

/* Ikona schowka (📋) */
.generated-output::after {
    content: " 📋";
    font-size: 1.2rem;
    opacity: 0.3;
    margin-left: 10px;
    transition: opacity 0.3s ease;
}

.generated-output:hover::after {
    opacity: 1;
}

/* Kolory wyników */
#peselOutput { color: #2e7d32; background-color: #edf7ed; }
#idOutput { color: #1565c0; background-color: #e3f2fd; }
#nrbOutput { color: #e65100; background-color: #fff3e0; }
#nameOutput { color: #7b1fa2; background-color: #f3e5f5; }
#surnameOutput { color: #7b1fa2; background-color: #f3e5f5; }
#regonOutput { color: #37474f; background-color: #eceff1; font-size: 1.8rem; }

.generated-output:hover { filter: brightness(0.95); }

/* --- PRZYCISKI --- */
button {
    padding: 14px 20px;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    width: 100%;
    margin: 8px 0;
}

button:last-of-type { margin-top: auto; }

#generateBtn, #openPeselOptionsBtn { background-color: #2e7d32; }
#generateIdBtn { background-color: #1976d2; }
#generateNrbBtn { background-color: #ef6c00; }
#generateNameBtn { background-color: #8e24aa; }
#generateRegonBtn { background-color: #546e7a; }

button:hover { filter: brightness(0.9); }

/* --- MODAL (POPUP USTAWIEŃ) --- */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    background-color: #fff;
    margin: 10% auto;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 450px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    animation: animatetop 0.4s;
    position: relative;
}

@keyframes animatetop {
    from { top: -200px; opacity: 0; }
    to { top: 0; opacity: 1; }
}

.close-btn {
    position: absolute;
    right: 20px;
    top: 15px;
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close-btn:hover { color: #000; }

/* --- KOMUNIKAT O SKOPIOWANIU (TOAST) --- */
.copy-message {
    visibility: hidden;
    min-width: 250px;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 50px; /* Zaokrąglony kształt pigułki */
    padding: 16px;
    position: fixed;
    z-index: 2000;
    left: 50%;
    bottom: 30px;
    transform: translateX(-50%);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: opacity 0.4s, visibility 0.4s;
}

.copy-message.show {
    visibility: visible;
    opacity: 1;
}

/* --- RESPONSYWNOŚĆ --- */
@media (min-width: 768px) {
    .container { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
    .container { grid-template-columns: repeat(3, 1fr); }
}

/* --- STOPKA --- */
footer {
    width: 100%;
    text-align: center;
    padding: 30px 20px;
    margin-top: 50px;
    border-top: 1px solid #e0e0e0;
    color: #666;
    font-size: 0.9rem;
}

footer a {
    color: #1976d2;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: 10px;
    transition: color 0.3s;
}

footer a:hover {
    color: #1565c0;
}

footer a svg {
    width: 18px;
    height: 18px;
}

/* Style dla rozdzielonych pól imienia i nazwiska */
.name-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin: 15px 0;
}

.name-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.field-label {
    margin: 0;
    font-size: 0.85rem;
    font-weight: 600;
    color: #666;
    text-align: left;
}

.name-field .generated-output {
    margin: 0;
    padding: 12px 10px;
    font-size: 1.8rem;
}

/* Opcje formularzy */
.generator-options { display: flex; flex-direction: column; gap: 15px; text-align: left; }
.option-group { display: flex; flex-direction: column; margin-bottom: 10px; }
.option-group label { 
    font-weight: 600; 
    margin-bottom: 8px; 
    font-size: 0.9rem;
    color: var(--text-primary);
    transition: color 0.3s ease;
}
select, input { 
    padding: 12px; 
    margin-bottom: 8px;
    border: 1px solid var(--border-color); 
    border-radius: 6px;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    transition: border-color 0.3s ease, background-color 0.3s ease, color 0.3s ease;
}

select:focus, input:focus {
    outline: none;
    border-color: #1976d2;
}

/* Specyficzny układ dla NRB */
.nrb-tile .generated-output {
    font-size: clamp(1rem, 3vw, 1.5rem);
    overflow-x: auto;
    white-space: nowrap;
}

/* --- WALIDATOR --- */
.validator-input-group {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.validator-input-group input {
    flex: 1;
    min-width: 200px;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.validator-input-group input:focus {
    outline: none;
    border-color: #1976d2;
}

.validator-input-group button {
    padding: 12px 24px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #fff;
    background-color: #1976d2;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
    width: auto;
    margin: 8px 0;
    flex-shrink: 0;
    transition: background-color 0.3s;
}

.validator-input-group button:hover {
    background-color: #1565c0;
}

.validator-result {
    padding: 16px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    min-height: 60px;
    display: block;
    text-align: center;
    line-height: 1.8;
    white-space: pre-line;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.validator-result.valid {
    background-color: #edf7ed;
    color: #2e7d32;
    border: 2px solid #2e7d32;
}

.validator-result.invalid {
    background-color: #ffebee;
    color: #c62828;
    border: 2px solid #c62828;
}

/* --- THEME SWITCH --- */
.theme-switch {
    display: flex;
    align-items: center;
}

.theme-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    position: relative;
}

.theme-checkbox {
    display: none;
}

.theme-toggle-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    font-size: 1.5rem;
    padding: 8px;
    background-color: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.3s ease, background-color 0.3s ease, border-color 0.3s ease;
}

.theme-toggle-button:hover {
    background-color: var(--hover-bg);
    transform: scale(1.1);
}

.theme-checkbox:checked + .theme-toggle-button {
    transform: rotate(20deg) scale(1.1);
}

.theme-checkbox:checked + .theme-toggle-button::after {
    content: ' ☀️';
}

.button-group {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 30px 0;
    width: 100%;
    max-width: 1600px;
    flex-wrap: wrap;
    justify-content: space-between;
}

.nav-button {
    display: inline-block;
    padding: 14px 28px;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    background-color: #666;
    border-radius: 6px;
    text-decoration: none;
    transition: background-color 0.3s;
}

.nav-button:hover {
    background-color: #555;
}

/* --- GENERATOR ZBIORÓW DANYCH --- */
.dataset-generator-tile {
    background-color: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 25px;
}

.dataset-generator-tile h2 {
    color: var(--text-primary);
    font-size: 1.4rem;
    margin-bottom: 20px;
    margin-top: 0;
}

.dataset-generator-tile h3 {
    color: var(--text-primary);
    font-size: 1.1rem;
    margin-top: 16px;
    margin-bottom: 12px;
}

/* Panel kontrolny na górze */
.control-panel {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 24px;
}

.control-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.control-field {
    display: flex;
    flex-direction: column;
}

.control-field label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.95rem;
}

.control-field input[type="number"] {
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 1rem;
}

.format-selection,
.separator-selection {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.format-option,
.separator-option {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.format-option input[type="radio"],
.separator-option input[type="radio"] {
    cursor: pointer;
}

.control-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.btn-primary,
.btn-secondary {
    padding: 12px 20px;
    font-size: 1rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.3s ease, opacity 0.3s ease;
    font-weight: 600;
}

.btn-primary {
    background-color: #1976d2;
    color: white;
}

.btn-primary:hover {
    background-color: #1565c0;
}

.btn-secondary {
    background-color: #4caf50;
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background-color: #45a049;
}

.btn-secondary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.config-section {
    margin-bottom: 20px;
}

.config-section label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-weight: 600;
}

.data-selection {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.draggable-item {
    display: flex;
    align-items: center;
    padding: 12px;
    background-color: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: 6px;
    cursor: grab;
    user-select: none;
    transition: background-color 0.2s, border-color 0.2s;
}

.draggable-item:active {
    cursor: grabbing;
    background-color: var(--hover-bg);
}

.draggable-item:hover {
    background-color: var(--hover-bg);
}

.draggable-item input[type="checkbox"] {
    margin-right: 12px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.drag-handle {
    color: var(--text-secondary);
    margin-right: 8px;
    font-size: 0.9rem;
}

.format-selection,
.separator-selection {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.format-selection label,
.separator-selection label {
    display: flex;
    align-items: center;
    padding: 8px 0;
    cursor: pointer;
}

.format-selection input[type="radio"],
.separator-selection input[type="radio"] {
    margin-right: 10px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.preview-tile {
    background-color: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    width: 100%;
}

.preview-tile h2 {
    color: var(--text-primary);
    font-size: 1.4rem;
    margin-bottom: 16px;
    margin-top: 0;
}

#previewContent {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 16px;
    color: var(--text-primary);
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    overflow-x: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 600px;
    overflow-y: auto;
    width: 100%;
    box-sizing: border-box;
}

@media (max-width: 1024px) {
    .control-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    body {
        padding: 12px;
    }

    .container {
        gap: 16px;
    }

    .dataset-generator-tile,
    .preview-tile {
        padding: 16px;
    }

    .control-panel {
        padding: 12px;
    }

    .control-row {
        grid-template-columns: 1fr;
        gap: 12px;
        margin-bottom: 12px;
    }

    .control-buttons {
        flex-direction: column;
    }

    .btn-primary,
    .btn-secondary {
        width: 100%;
        padding: 14px;
    }

    .format-selection,
    .separator-selection {
        flex-direction: column;
        gap: 8px;
    }

    .format-option,
    .separator-option {
        padding: 8px 0;
    }

    .data-selection {
        gap: 6px;
    }

    .draggable-item {
        padding: 10px;
        font-size: 0.95rem;
    }

    #previewContent {
        max-height: 400px;
        font-size: 0.85rem;
        padding: 12px;
    }

    .button-group {
        flex-wrap: wrap;
        gap: 10px;
    }

    .theme-switch {
        flex-basis: 100%;
    }
}

@media (max-width: 480px) {
    body {
        padding: 8px;
    }

    h1 { 
        display: none; 
    }

    .container {
        gap: 12px;
    }

    .dataset-generator-tile h2,
    .preview-tile h2 {
        font-size: 1.1rem;
        margin-bottom: 12px;
    }

    .control-field label,
    .config-section label {
        font-size: 0.9rem;
    }

    .btn-primary,
    .btn-secondary {
        font-size: 0.9rem;
        padding: 12px;
    }

    .format-option label,
    .separator-option label {
        font-size: 0.85rem;
    }

    #previewContent {
        max-height: 300px;
        font-size: 0.8rem;
    }

    .draggable-item {
        padding: 8px;
        font-size: 0.9rem;
    }
}

/* Drag & drop visual feedback */
.draggable-item.drag-over {
    background-color: var(--hover-bg);
    border-color: #1976d2;
    transform: scale(1.02);
}


        @import "https://unpkg.com/open-props/easings.min.css";

.sun-and-moon > :is(.moon, .sun, .sun-beams) {
  transform-origin: center;
}

.sun-and-moon > :is(.moon, .sun) {
  fill: var(--icon-fill);
}

.theme-toggle:is(:hover, :focus-visible) > .sun-and-moon > :is(.moon, .sun) {
  fill: var(--icon-fill-hover);
}

.sun-and-moon > .sun-beams {
  stroke: var(--icon-fill);
  stroke-width: 2px;
  stroke-linecap: round;
}

.sun-and-moon > .sun-beams {
  transform-origin: center;
  transform: rotateZ(0deg);
}

.theme-toggle:is(:hover, :focus-visible) .sun-and-moon > .sun-beams {
  stroke: var(--icon-fill-hover);
}

[data-theme="dark"] .sun-and-moon > .sun {
  transform: scale(1.75);
}

[data-theme="dark"] .sun-and-moon > .sun-beams {
  opacity: 0;
}

[data-theme="dark"] .sun-and-moon > .moon > circle {
  transform: translateX(-7px);
}

@supports (cx: 1) {
  [data-theme="dark"] .sun-and-moon > .moon > circle {
    cx: 17;
    transform: translateX(0);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .sun-and-moon > .sun {
    transition: transform .5s var(--ease-elastic-3);
  }

  .sun-and-moon > .sun-beams {
    transition: transform .5s var(--ease-elastic-4), opacity .5s var(--ease-3);
  }

  .sun-and-moon .moon > circle {
    transition: transform .25s var(--ease-out-5);
  }

  @supports (cx: 1) {
    .sun-and-moon .moon > circle {
      transition: cx .25s var(--ease-out-5);
    }
  }

  [data-theme="dark"] .sun-and-moon > .sun {
    transition-timing-function: var(--ease-3);
    transition-duration: .25s;
    transform: scale(1.75);
  }

  [data-theme="dark"] .sun-and-moon > .sun-beams {
    transition-duration: .15s;
    transform: rotateZ(-25deg);
  }

  [data-theme="dark"] .sun-and-moon > .moon > circle {
    transition-duration: .5s;
    transition-delay: .25s;
  }
}
        