:root {
    --primary: #502ACD;
    --bg-card: #ffffff;
    --text-main: #111827;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --radius: 12px;
    --shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
        0 4px 6px -2px rgba(0, 0, 0, 0.05);

    /* Pilne (Czerwony) */
    --badge-urgent-bg: #fef2f2;
    --badge-urgent-text: #dc2626;
    --badge-urgent-border: #fee2e2;

    /* Rekrutacyjne (Niebieski) */
    --badge-recruit-bg: #eff6ff;
    --badge-recruit-text: #2563eb;
    --badge-recruit-border: #dbeafe;

    /* NOWE (Zielony) */
    --badge-new-bg: #ecfdf5;
    --badge-new-text: #059669;
    --badge-new-border: #d1fae5;
}

/* WYSZUKIWARKA */

.zadanie-search-form {
    margin-bottom: 2rem;
}

.zadanie-search {
    position: relative;
}

.zadanie-search__input {
    width: 100%;
    padding: 10px 40px !important;
    border-radius: 999px;
    border: 1px solid var(--border);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.zadanie-search__input::placeholder {
    color: #9ca3af;
}

.zadanie-search__input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(85, 51, 204, 0.1);
}

.zadanie-search__icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.zadanie-search__svg {
    width: 16px;
    height: 16px;
    fill: #9ca3af;
}

/* LISTA ZADAŃ */

.zadanie-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.zadanie-item {
    list-style: none;
}

/* KARTA ZADANIA */

.zadanie-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 0.9rem 1.3rem;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 1rem;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    cursor: pointer;
}

.zadanie-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-hover);
    border-color: #d1d5db;
}

.zadanie-card__main {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Header: tytuł + badge obok siebie */
.zadanie-card__header {
    display: flex;
    justify-content: flex-start;
    /* zamiast space-between */
    align-items: center;
    gap: 8px;
    /* odstęp między tytułem a badge’ami */
    flex-wrap: wrap;
    margin-bottom: 8px;
}

/* Tytuł niech nie rozpycha się na całą szerokość */
.zadanie-card__title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--primary);
    flex: 0 1 auto;
    /* było 1 1 auto – wtedy ciągnął się jak guma */
}

.zadanie-card__title a {
    color: inherit;
    text-decoration: none;
}

.zadanie-card__title a:hover {
    text-decoration: underline;
}

.zadanie-card__dziedzina-top {
    font-size: 0.9rem;
    color: var(--text-main);
    font-weight: 400;
    /* niepogrubione */
}

/* Firma + dziedzina */

.zadanie-card__subrow {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    font-size: 0.9rem;
    color: var(--text-main);
}

.zadanie-card__firma {
    font-weight: 500;
}

.zadanie-card__separator {
    color: var(--text-muted);
}

.zadanie-card__dziedzina {
    font-weight: 500;
}

/* BADGE (NOWE / PILNE / REKRUTACYJNE) */

.zadanie-card__badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 0;
    flex-shrink: 0;
}

.zadanie-badge {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
    border: 1px solid transparent;
}

/* NOWE */
.zadanie-badge--new {
    background-color: var(--badge-new-bg);
    color: var(--badge-new-text);
    border-color: var(--badge-new-border);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.zadanie-badge--new::before {
    content: '';
    display: block;
    width: 6px;
    height: 6px;
    background-color: currentColor;
    border-radius: 50%;
}

/* PILNE */
.zadanie-badge--urgent {
    background-color: var(--badge-urgent-bg);
    color: var(--badge-urgent-text);
    border-color: var(--badge-urgent-border);
}

/* REKRUTACYJNE */
.zadanie-badge--recruitment {
    background-color: var(--badge-recruit-bg);
    color: var(--badge-recruit-text);
    border-color: var(--badge-recruit-border);
}

/* TERMIN WYKONANIA (prawa część karty) */

.zadanie-card__deadline {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    text-align: right;
    min-width: 140px;
    border-left: 1px solid #f3f4f6;
    padding-left: 1.2rem;
}

.zadanie-card__deadline-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 3px;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.04em;
}

.zadanie-card__deadline-date {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
}

/* Brak zadań */

.brak-zadan {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Style dla modala (popupu) */
.tipaweb-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    /* Półprzezroczyste tło */
    z-index: 9999;
    align-items: center;
    justify-content: center;
    /* Domyślnie display: none - ustawiane inline w HTML */
}

.tipaweb-modal-content {
    background-color: #fff;
    padding: 30px;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    position: relative;
    text-align: center;
}

.tipaweb-modal h3 {
    margin-top: 0;
    margin-bottom: 15px;
}

.tipaweb-modal-text {
    margin-bottom: 25px;
    font-size: 15px;
    color: #333;
    line-height: 1.5;
    text-align: left;
    background: #f7f7f7;
    padding: 15px;
    border-radius: 4px;
}

.tipaweb-modal-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

/* Dostosowanie przycisków w modalu */
.tipaweb-modal-actions .button {
    min-width: 100px;
}



/* RWD */

@media (max-width: 768px) {
    .zadanie-card {
        grid-template-columns: 1fr;
        gap: 0.75rem;
        border-radius: 18px;
    }

    .zadanie-card__deadline {
        align-items: flex-start;
        text-align: left;
        border-left: none;
        padding-left: 0;
        border-top: 1px solid #f3f4f6;
        padding-top: 0.75rem;
    }
}

/* === STAR RATING === */
.star-rating {
    display: flex;
    flex-direction: row-reverse;
    justify-content: flex-end;
    gap: 2px;
}

.star-rating input {
    display: none;
}

.star-rating label {
    cursor: pointer;
    color: #ddd;
    font-size: 24px;
    padding: 0 2px;
    transition: color 0.2s;
}

.star-rating label:before {
    content: '★';
}

.star-rating label:hover,
.star-rating label:hover~label,
.star-rating input:checked~label {
    color: #FFD700;
}

/* === BUTTON STYLES === */
/* === BUTTON STYLES === */
.button-primary {
    background-color: #502ACD !important;
    color: #fff !important;
    border: 1px solid #502ACD !important;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
    transition: all 0.2s;
}

.button-primary:hover {
    background-color: #3b1db8 !important;
    /* Darker blue */
    border-color: #3b1db8 !important;
    color: #fff !important;
}

.button-secondary {
    background-color: #fff !important;
    color: #502ACD !important;
    /* Blue text */
    border: 1px solid #502ACD !important;
    /* Blue border */
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    text-decoration: none;
    display: inline-block;
    transition: all 0.2s;
}

.button-secondary:hover {
    background-color: #502ACD !important;
    /* Transforms to Primary */
    border-color: #502ACD !important;
    color: #fff !important;
    /* White text on hover */
}

.button-secondary.button-small {
    padding: 6px 12px !important;
    font-size: 0.85rem;
    /* Reverting to standard secondary styles but keeping font size/padding small if needed, or just let it inherit */
    background-color: #fff !important;
    color: #502ACD !important;
    border-color: #502ACD !important;
}

.button-secondary.button-small:hover {
    background-color: #502ACD !important;
    color: #fff !important;
    border-color: #502ACD !important;
}

/* === RATING FORM CONTAINER === */
.zadanie-rating-form,
.opracowanie-actions-container {
    background: #fff;
    border-radius: 12px;
    margin-top: 20px;
}

.zadanie-rating-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding: 5px 0;
}

.zadanie-rating-label {
    font-weight: 500;
    color: #374151;
}

/* === PAGINATION === */
.tipaweb-pagination {
    margin-top: 40px !important;
    display: flex;
    justify-content: center;
    gap: 8px;
}

.tipaweb-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 15px;
    border-radius: 999px;
    background-color: #fff;
    border: 1px solid #e5e7eb;
    color: #374151;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
    font-size: 0.95rem;
}

.tipaweb-pagination .page-numbers:hover {
    border-color: #502ACD;
    color: #502ACD;
    background-color: #f9f9ff;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.tipaweb-pagination .page-numbers.current {
    background-color: #502ACD;
    border-color: #502ACD;
    color: #fff;
    pointer-events: none;
}

.tipaweb-pagination .page-numbers.dots {
    border: none;
    background: transparent;
    pointer-events: none;
    cursor: default;
    color: #9ca3af;
}

.tipaweb-pagination .prev,
.tipaweb-pagination .next {
    padding: 0 20px;
    font-weight: 600;
}

/* === SEARCH CLEAR BUTTON === */
.zadanie-search {
    position: relative;
    /* Ensure relative positioning for absolute child */
}

.zadanie-search__clear {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    text-decoration: none;
    color: #9ca3af;
    font-size: 1.5rem;
    line-height: 0;
    font-weight: normal;
    padding: 0;
    margin: 2px 0 0 0;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    cursor: pointer;
}

.zadanie-search__clear:hover {
    color: #ef4444;
    /* Red on hover */
    background-color: rgba(239, 68, 68, 0.1);
    border-radius: 50%;
}

/* === FORM ACTIONS === */
.zadanie-form__actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.zadanie-form__actions input[type="submit"] {
    margin: 0 !important;
}

/* === MODERN FORM STYLING === */

/* Form container */
form.tipaweb-opracowania-form,
form[method="POST"][enctype="multipart/form-data"] {
    background: #ffffff;
    border-radius: 16px;
    max-width: 800px;
    margin: 0 auto;
}

/* Form paragraphs */
form p {
    margin-bottom: 24px;
}

/* Labels */
form label {
    display: block;
    font-size: 0.95rem;
    font-weight: 600;
    color: #374151;
    letter-spacing: 0.01em;
    margin-bottom: 8px;
}

/* Text inputs and date inputs */
form input[type="text"],
form input[type="date"] {
    width: 100%;
    padding: 12px 16px;
    font-size: 1rem;
    color: #1f2937;
    background-color: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    transition: all 0.2s ease;
    outline: none;
    box-sizing: border-box;
}

form input[type="text"]:focus,
form input[type="date"]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(80, 42, 205, 0.1);
    background-color: #faf9ff;
}

form input[type="text"]:hover,
form input[type="date"]:hover {
    border-color: #d1d5db;
}

/* Textarea */
form textarea {
    width: 100%;
    padding: 12px 16px;
    font-size: 1rem;
    color: #1f2937;
    background-color: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    transition: all 0.2s ease;
    outline: none;
    resize: vertical;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    box-sizing: border-box;
}

form textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(80, 42, 205, 0.1);
    background-color: #faf9ff;
}

form textarea:hover {
    border-color: #d1d5db;
}

/* File input */
form input[type="file"] {
    width: 100%;
    padding: 12px 16px;
    font-size: 0.95rem;
    color: #4b5563;
    background-color: #f9fafb;
    border: 2px dashed #d1d5db;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

form input[type="file"]:hover {
    border-color: var(--primary);
    background-color: #f3f0ff;
}

form input[type="file"]::file-selector-button {
    padding: 8px 16px;
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    margin-right: 12px;
    transition: background-color 0.2s ease;
}

form input[type="file"]::file-selector-button:hover {
    background-color: #3b1db8;
}

/* Checkboxes */
form input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary);
}

form p[style*="display:flex"] label {
    margin-bottom: 0;
    cursor: pointer;
}

/* Submit button styling (exclude rating forms and simple action forms) */
form:not(.zadanie-rating-form):not(.simple-action-form) input[type="submit"],
form:not(.zadanie-rating-form):not(.simple-action-form) button[type="submit"] {
    background: linear-gradient(135deg, var(--primary) 0%, #3b1db8 100%);
    color: white;
    padding: 14px 32px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 6px -1px rgba(80, 42, 205, 0.3);
}

form:not(.zadanie-rating-form):not(.simple-action-form) input[type="submit"]:hover,
form:not(.zadanie-rating-form):not(.simple-action-form) button[type="submit"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(80, 42, 205, 0.4);
}

form:not(.zadanie-rating-form):not(.simple-action-form) input[type="submit"]:active,
form:not(.zadanie-rating-form):not(.simple-action-form) button[type="submit"]:active {
    transform: translateY(0);
}

/* Cancel link styling */
.zadanie-form__actions a {
    color: #6b7280;
    text-decoration: none;
    padding: 14px 24px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 10px;
    transition: all 0.2s ease;
    display: inline-block;
}

.zadanie-form__actions a:hover {
    color: #374151;
    background-color: #f3f4f6;
}

/* Assigned student info */
.zadanie-form__assigned-info {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    padding: 16px 20px;
    border-radius: 10px;
    border-left: 4px solid #3b82f6;
    color: #1e40af;
    font-size: 0.95rem;
}

.zadanie-form__assigned-info strong {
    color: #1e3a8a;
    font-weight: 700;
}

.solution-title {
    font-size: 28px;
    font-weight: 600;
}

/* Responsive */
@media (max-width: 768px) {

    form.tipaweb-opracowania-form,
    form[method="POST"][enctype="multipart/form-data"] {
        border-radius: 12px;
    }

    .zadanie-form__actions {
        justify-content: center;

    }

    .solution-title {
        font-size: 22px;
    }
}