:root {
    /* Default Theme (Silesia - Blue/Gray) */
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --bg-color: #f9f9f9;
    --card-bg: #ffffff;
    --text-color: #333333;
    --text-muted: #7f8c8d;
    --border-color: #dddddd;
    --success-color: #27ae60;
    --error-color: #c0392b;
    --header-bg: #ffffff;
    --footer-bg: #2c3e50;
    --footer-text: #ffffff;
    --input-bg: #ffffff;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --border-radius: 4px;
    --container-width: 1200px;
}

/* Theme 2: Modern Minimal (Black/White) */
body.theme-minimal {
    --primary-color: #000000;
    --secondary-color: #333333;
    --accent-color: #000000;
    --bg-color: #ffffff;
    --card-bg: #f8f9fa;
    --text-color: #000000;
    --text-muted: #666666;
    --border-color: #e0e0e0;
    --success-color: #000000;
    --error-color: #ff0000;
    --header-bg: #ffffff;
    --footer-bg: #000000;
    --footer-text: #ffffff;
    --input-bg: #ffffff;
    --shadow-color: rgba(0, 0, 0, 0.05);
    --border-radius: 0px;
}

/* Theme 3: Eco Green (Nature) */
body.theme-eco {
    --primary-color: #2d6a4f;
    --secondary-color: #40916c;
    --accent-color: #d8f3dc;
    --bg-color: #f4f9f4;
    --card-bg: #ffffff;
    --text-color: #1b4332;
    --text-muted: #52b788;
    --border-color: #b7e4c7;
    --success-color: #2d6a4f;
    --error-color: #bc4749;
    --header-bg: #ffffff;
    --footer-bg: #1b4332;
    --footer-text: #d8f3dc;
    --input-bg: #ffffff;
    --shadow-color: rgba(45, 106, 79, 0.1);
    --border-radius: 12px;
}

/* Theme 4: Dark Mode */
body.theme-dark {
    --primary-color: #ecf0f1;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --bg-color: #1a1a1a;
    --card-bg: #2c2c2c;
    --text-color: #ecf0f1;
    --text-muted: #bdc3c7;
    --border-color: #444444;
    --success-color: #2ecc71;
    --error-color: #e74c3c;
    --header-bg: #2c2c2c;
    --footer-bg: #000000;
    --footer-text: #ecf0f1;
    --input-bg: #333333;
    --shadow-color: rgba(0, 0, 0, 0.5);
    --border-radius: 4px;
}

/* Theme 5: Vibrant (Gradients/Bold) */
body.theme-vibrant {
    --primary-color: #6c5ce7;
    --secondary-color: #a29bfe;
    --accent-color: #fd79a8;
    --bg-color: #dfe6e9;
    --card-bg: #ffffff;
    --text-color: #2d3436;
    --text-muted: #636e72;
    --border-color: #b2bec3;
    --success-color: #00b894;
    --error-color: #d63031;
    --header-bg: #ffffff;
    --footer-bg: #6c5ce7;
    --footer-text: #ffffff;
    --input-bg: #ffffff;
    --shadow-color: rgba(108, 92, 231, 0.2);
    --border-radius: 8px;
}

/* Theme 6: Warm Community (Orange/Yellow) */
body.theme-warm {
    --primary-color: #d35400;
    --secondary-color: #e67e22;
    --accent-color: #f1c40f;
    --bg-color: #fdf5e6;
    --card-bg: #ffffff;
    --text-color: #5d4037;
    --text-muted: #8d6e63;
    --border-color: #ffcc80;
    --success-color: #27ae60;
    --error-color: #c0392b;
    --header-bg: #fff8e1;
    --footer-bg: #d35400;
    --footer-text: #ffffff;
    --input-bg: #ffffff;
    --shadow-color: rgba(211, 84, 0, 0.1);
    --border-radius: 6px;
}

/* Theme 7: Corporate (Navy/Serif) */
body.theme-corporate {
    --primary-color: #0c2461;
    --secondary-color: #1e3799;
    --accent-color: #b71540;
    --bg-color: #f1f2f6;
    --card-bg: #ffffff;
    --text-color: #0c2461;
    --text-muted: #57606f;
    --border-color: #ced6e0;
    --success-color: #079992;
    --error-color: #b71540;
    --header-bg: #ffffff;
    --footer-bg: #0c2461;
    --footer-text: #ffffff;
    --input-bg: #ffffff;
    --shadow-color: rgba(12, 36, 97, 0.15);
    --font-family: "Georgia", "Times New Roman", serif;
    --border-radius: 2px;
}

/* Theme 8: Glass (Translucent) */
body.theme-glass {
    --primary-color: #2f3542;
    --secondary-color: #57606f;
    --accent-color: #ff4757;
    --bg-color: #eccc68;
    /* Fallback or base */
    --card-bg: rgba(255, 255, 255, 0.7);
    --text-color: #2f3542;
    --text-muted: #57606f;
    --border-color: rgba(255, 255, 255, 0.5);
    --success-color: #2ed573;
    --error-color: #ff4757;
    --header-bg: rgba(255, 255, 255, 0.8);
    --footer-bg: rgba(47, 53, 66, 0.9);
    --footer-text: #ffffff;
    --input-bg: rgba(255, 255, 255, 0.9);
    --shadow-color: rgba(0, 0, 0, 0.1);
    --border-radius: 16px;
}

/* Glass background special */
body.theme-glass {
    background: linear-gradient(135deg, #70a1ff, #7bed9f);
    background-attachment: fixed;
}

body.theme-glass .card,
body.theme-glass header {
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Theme 9: Pastel (Soft) */
body.theme-pastel {
    --primary-color: #8854d0;
    --secondary-color: #a55eea;
    --accent-color: #ff7675;
    --bg-color: #f3e5f5;
    --card-bg: #ffffff;
    --text-color: #4b4b4b;
    --text-muted: #a29bfe;
    --border-color: #dfe6e9;
    --success-color: #55efc4;
    --error-color: #ff7675;
    --header-bg: #ffffff;
    --footer-bg: #a55eea;
    --footer-text: #ffffff;
    --input-bg: #fdfdfd;
    --shadow-color: rgba(136, 84, 208, 0.1);
    --border-radius: 20px;
}

/* Theme 10: High Contrast (Accessibility) */
body.theme-contrast {
    --primary-color: #000000;
    --secondary-color: #0000ee;
    --accent-color: #ffff00;
    --bg-color: #ffffff;
    --card-bg: #ffffff;
    --text-color: #000000;
    --text-muted: #000000;
    --border-color: #000000;
    --success-color: #006600;
    --error-color: #cc0000;
    --header-bg: #ffffff;
    --footer-bg: #000000;
    --footer-text: #ffff00;
    --input-bg: #ffffff;
    --shadow-color: none;
    --border-radius: 0px;
}

body.theme-contrast .card {
    border: 2px solid #000;
    box-shadow: none;
}

body.theme-contrast a {
    text-decoration: underline;
}

/* --- Base Styles using Variables --- */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
    transition: background-color 0.3s, color 0.3s;
    overflow-x: hidden; /* zapobiega poziomemu przewijaniu na wąskich ekranach */
}

/* Layout */
.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 20px;
}

main {
    padding: 40px 0;
    min-height: calc(100vh - 200px);
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    margin-bottom: 1rem;
    color: var(--primary-color);
}

h1 {
    font-size: 2.5rem;
}

h2 {
    font-size: 2rem;
    border-bottom: 2px solid var(--secondary-color);
    padding-bottom: 10px;
    margin-top: 30px;
}

h3 {
    font-size: 1.5rem;
    margin-top: 20px;
}

p {
    margin-bottom: 1rem;
}

a {
    color: var(--secondary-color);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Navigation */
header {
    background-color: var(--header-bg);
    box-shadow: 0 2px 5px var(--shadow-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: background-color 0.3s;
    margin-bottom: 20px;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 20px;
    align-items: center;
    /* Align items vertically */
}

.nav-links a {
    color: var(--primary-color);
    font-weight: 500;
    padding: 5px 10px;
    border-radius: var(--border-radius);
    transition: background-color 0.3s, color 0.3s;
}

.nav-links a:hover,
.nav-links a.active {
    background-color: var(--light-bg);
    /* Fallback if var not defined in all themes, using opacity logic better */
    background-color: rgba(0, 0, 0, 0.05);
    color: var(--secondary-color);
    text-decoration: none;
}

/* Theme Switcher in Nav */
.theme-switcher {
    margin-left: 15px;
}

.theme-select {
    padding: 5px 10px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    background-color: var(--input-bg);
    color: var(--text-color);
    font-family: inherit;
    cursor: pointer;
}

.hamburger {
    display: none;
    cursor: pointer;
    font-size: 1.5rem;
    color: var(--primary-color);
}

/* Footer */
footer {
    background-color: var(--footer-bg);
    color: var(--footer-text);
    padding: 40px 0;
    margin-top: auto;
    transition: background-color 0.3s;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
}

.footer-section h4 {
    color: var(--footer-text);
    margin-bottom: 15px;
}

.footer-bottom {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.project-info-footer {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #ddd;
    text-align: center;
    font-size: 14px;
    line-height: 1.6;
    color: #000;
    background-color: #fff;
    width: 100vw;
    margin-left: calc(50% - 50vw);
    padding-left: 20px;
    padding-right: 20px;
}

.project-description {
    max-width: 1100px;
    margin: 0 auto 20px auto;
}

.project-logos {
    display: flex;
    justify-content: center;
}

.project-logos img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 20px;
    background-color: var(--secondary-color);
    color: #fff;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s, transform 0.1s;
    text-align: center;
}

.btn:hover {
    filter: brightness(110%);
    text-decoration: none;
}

.btn-primary {
    background-color: var(--secondary-color);
}

.btn-secondary {
    background-color: var(--secondary-color);
}

/* Keep static or map to muted? */
.btn-danger {
    background-color: var(--error-color);
}

.btn-success {
    background-color: var(--success-color);
}

.btn-large {
    padding: 15px 30px;
    font-size: 1.2rem;
}

/* Forms */
.form-section {
    background: var(--card-bg);
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 10px var(--shadow-color);
    margin-bottom: 30px;
    border: 1px solid var(--border-color);
}

fieldset {
    border: 1px solid var(--border-color);
    padding: 20px;
    margin-bottom: 20px;
    border-radius: var(--border-radius);
}

legend {
    padding: 0 10px;
    font-weight: bold;
    color: var(--primary-color);
}

.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-family: inherit;
    background-color: var(--input-bg);
    color: var(--text-color);
}

textarea {
    resize: vertical;
    min-height: 100px;
}

.checkbox-group,
.radio-group {
    display: flex;
    gap: 15px;
    align-items: center;
}

.checkbox-item,
.radio-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.input-error {
    border-color: var(--error-color) !important;
}

.error-message {
    color: var(--error-color);
    font-size: 0.85rem;
    margin-top: 5px;
    display: none;
}

.char-counter {
    text-align: right;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 5px;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    background: var(--card-bg);
    color: var(--text-color);
}

th,
td {
    padding: 12px;
    border: 1px solid var(--border-color);
    text-align: left;
}

th {
    background-color: rgba(0, 0, 0, 0.05);
    font-weight: 600;
    color: var(--primary-color);
}

.budget-table input {
    width: 100%;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-color);
}

.budget-table input:focus {
    border-color: var(--secondary-color);
    background: var(--input-bg);
}

.budget-summary {
    background-color: rgba(0, 0, 0, 0.05);
    padding: 20px;
    border-radius: var(--border-radius);
    margin-top: 20px;
    text-align: right;
}

.budget-summary p {
    font-size: 1.1rem;
    margin-bottom: 10px;
}

.total-amount {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

/* Cards */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin: 40px 0;
}

.card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 30px;
    box-shadow: 0 4px 15px var(--shadow-color);
    transition: transform 0.3s, background-color 0.3s;
    border: 1px solid transparent;
    /* For high contrast border */
}

.card:hover {
    transform: translateY(-5px);
}

.card h3 {
    margin-top: 0;
    color: var(--secondary-color);
}

/* Utilities */
.text-center {
    text-align: center;
}

.mt-20 {
    margin-top: 20px;
}

.mb-20 {
    margin-bottom: 20px;
}

.hidden {
    display: none;
}

/* Responsive */
@media (max-width: 768px) {
    .hamburger {
        display: block;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 70px;
        left: 0;
        width: 100%;
        background-color: var(--header-bg);
        flex-direction: column;
        padding: 20px;
        box-shadow: 0 5px 10px var(--shadow-color);
        text-align: center;
        border-bottom: 1px solid var(--border-color);
    }

    .nav-links.active {
        display: flex;
    }

    .theme-switcher {
        margin: 15px 0 0 0;
    }

    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.5rem;
    }
}
