body {
    font-family: sans-serif;
    margin: 0;
    padding: 20px;
    background: #f4f4f4;
    color: #333;
    transition: background 0.3s, color 0.3s;
}

nav {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 12px 24px;
    margin-bottom: 30px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: sticky;
    top: 15px;
    z-index: 1000;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
}

nav h1 {
    color: #1a1a1a;
    margin: 0;
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

nav a {
    color: #444;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    padding: 8px 12px;
    border-radius: 8px;
    position: relative;
}

nav a:hover {
    color: #007bff;
    background: rgba(0, 123, 255, 0.08);
}

.nav-link-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #ff4757;
    color: inherit;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 700;
    min-width: 14px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(255, 71, 87, 0.3);
    border: 2px solid white;
}

body.dark .nav-link-badge {
    border-color: #1e1e1e;
}

.btn-register {
    background: #007bff;
    color: white !important;
}

.btn-register:hover {
    background: #0056b3 !important;
    transform: translateY(-1px);
}

.btn-logout {
    background: transparent;
    border: 1px solid #ddd;
    color: #666;
    font-size: 0.9rem;
    padding: 6px 12px;
}

body.dark .btn-logout {
    border-color: #444;
    color: #bbb;
}

.btn-logout:hover {
    background: #f8f9fa;
    color: #333;
}

body.dark .btn-logout:hover {
    background: #2a2a2a;
    color: #fff;
}

.hidden {
    display: none;
}

.card {
    background: white;
    padding: 20px;
    border-radius: 5px;
    margin-bottom: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: background 0.3s, color 0.3s;
}

input,
textarea {
    width: 100%;
    padding: 10px;
    margin: 5px 0;
    box-sizing: border-box;
}

button {
    background: #007bff;
    color: inherit;
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

button:hover {
    background: #0056b3;
    transform: translateY(-1px);
}

button.btn-secondary {
    background: #6c757d;
}

button.btn-secondary:hover {
    background: #5a6268;
}

button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

button.danger {
    background: #dc3545;
}

/* --- AVATARS AND PROFILE --- */
.nav-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    vertical-align: middle;
    border: 2px solid #fff;
}

.author-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #eee;
}

.large-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid #fff;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
}

.nav-profile-link {
    display: flex;
    align-items: center;
    gap: 8px;
    color: inherit;
    text-decoration: none;
}

.text-muted {
    color: #6c757d;
    font-size: 0.85em;
}

.offer-footer {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    justify-content: space-between;
}

.offer-footer-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* --- COMMENTS UI --- */
.comment-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    color: #007bff;
    font-weight: bold;
}

.comment-indicator:hover {
    text-decoration: underline;
}

.comment-modal-content {
    max-width: 600px;
    width: 90%;
    background: white;
    border-radius: 10px;
    padding: 20px;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h2 {
    margin: 0;
}

.btn-close-modal {
    padding: 8px 16px;
}

body.dark .comment-modal-content {
    background: #1e1e1e;
}

.comment-item {
    border-bottom: 1px solid #eee;
    padding: 10px 0;
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

body.dark .comment-item {
    border-color: #333;
}

.comment-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
}

.comment-body {
    flex: 1;
}

.comment-meta {
    font-size: 0.8em;
    color: #888;
    margin-bottom: 3px;
}

.comment-text {
    font-size: 0.95em;
}

#comment-list-container {
    margin-top: 20px;
}

#offer-detail-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1050; /* Lower than lightbox */
    justify-content: center;
    align-items: center;
}

#offer-detail-modal.active {
    display: flex;
}

.btn-comment {
    width: 100%;
    margin-top: 10px;
}

/* --- LIGHTBOX Å TÃLY --- */
#lightbox-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 2000; /* Higher than detail modal */
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#lightbox-overlay.active {
    display: flex;
    opacity: 1;
}

#lightbox-img {
    max-width: 90%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

#lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    background: none;
    border: none;
    color: inherit;
    font-size: 40px;
    cursor: pointer;
    transition: transform 0.2s;
    padding: 0;
}

#lightbox-close:hover {
    transform: scale(1.2);
}

#chat-messages {
    height: 300px;
    overflow-y: scroll;
    border: 1px solid #ccc;
    padding: 10px;
    margin-bottom: 10px;
    background: #fff;
    transition: background 0.3s, border-color 0.3s;
}

.message {
    margin-bottom: 5px;
    padding: 5px;
    background: #e9ecef;
    border-radius: 3px;
    transition: background 0.3s;
}

.my-message {
    background: #d1ecf1;
    text-align: right;
}

#dark-mode-toggle {
    background: none;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    transition: transform 0.3s;
}

#dark-mode-toggle:hover {
    transform: scale(1.1);
}

/* Dark mode */
body.dark {
    background: #121212;
    color: #e0e0e0;
}

body.dark nav {
    background: rgba(30, 30, 30, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

body.dark nav h1 {
    color: #fff;
}

body.dark nav a {
    color: #ccc;
}

body.dark .card {
    background: #1e1e1e;
    color: #e0e0e0;
}

body.dark #chat-messages {
    background: #1e1e1e;
    border-color: #333;
}

body.dark .message {
    background: #2e2e2e;
}

body.dark .my-message {
    background: #3e3e3e;
}

#chat-messages {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px;
    height: 400px;
    overflow-y: auto;
    background: #f9f9f9;
}

.message {
    max-width: 70%;
    padding: 8px 12px;
    border-radius: 15px;
    margin-bottom: 5px;
    word-wrap: break-word;
}

/* Moje sprÃ¡vy (vpravo, modrÃ©) */
.my-message {
    align-self: flex-end;
    background-color: #007bff;
    color: inherit;
    border-bottom-right-radius: 2px;
}

/* SprÃ¡vy od druhÃ©ho (vÄ¾avo, Å¡edÃ©) */
.other-message {
    align-self: flex-start;
    background-color: #e9e9eb;
    color: black;
    border-bottom-left-radius: 2px;
}

.message-time {
    font-size: 0.7em;
    opacity: 0.7;
    display: block;
    text-align: right;
}

.msg-bubble {
    padding: 8px 12px;
    border-radius: 12px;
    background: #eee;
}

.my-message .msg-bubble {
    background: #007bff;
    color: inherit;
}

/* --- RESPONSIVE DESIGN PRE PONUKY --- */

/* Kontajner ponÃºk */
#offers-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
    padding: 0;
    max-width: 1400px;
    margin: 0 auto;
}

/* SpoloÄnÃ½ Å¡tÃ½l pre obrÃ¡zky ponÃºk - vylepÅ¡enÃ½ pre kvalitu */
.offer-img {
    width: 100%;
    height: 220px;
    /* PevnÃ¡ rovnakÃ¡ vÃ½Å¡ka */
    object-fit: contain;
    /* Fotka nebude orezanÃ¡ */
    background-color: #f8f9fa;
    /* JemnÃ© pozadie pre ne-vÃ½plÅˆovÃ© fotky */
    border-radius: 5px;
    margin: 10px 0;
    cursor: zoom-in;
    transition: transform 0.2s ease, opacity 0.2s;
}

/* MobilnÃ½ dizajn (do 768px) */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    nav {
        flex-direction: column;
        gap: 15px;
        padding: 15px 12px;
        align-items: center;
    }

    .nav-left-brand {
        display: flex;
        justify-content: center;
        width: 100%;
    }

    .nav-brand-h1 {
        justify-content: center;
    }

    .nav-right {
        flex-direction: row;
        flex-wrap: wrap;
        width: 100%;
        gap: 15px;
        justify-content: center;
        align-items: center;
    }

    #nav-logged-in, #nav-logged-out {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
        width: 100%;
    }

    nav a, #logout-btn {
        padding: 8px 12px;
        font-size: 0.9rem;
        flex: 1 1 auto;
        text-align: center;
        min-width: max-content;
        box-sizing: border-box;
    }

    .nav-profile-link {
        justify-content: center;
    }

    #google_translate_element {
        display: flex;
        justify-content: center;
        width: auto;
    }

    #offers-list {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .offer-card {
        padding: 12px;
        margin-bottom: 0;
        display: block;
        overflow: hidden;
    }

    .offer-card h3 {
        font-size: 1.1em;
        margin: 0 0 8px 0;
    }

    /* Na mobile chceme fotku trochu vÃ¤ÄÅ¡iu, aby vynikla kvalita */
    .offer-img {
        width: 100%;
        height: auto;
        aspect-ratio: 16/9;
        max-height: 250px;
        object-fit: cover;
        border-radius: 5px;
    }

    .offer-card p {
        font-size: 0.95em;
        margin: 8px 0;
    }

    .offer-footer {
        margin: 8px 0;
    }

    .offer-card button {
        width: calc(100% - 0px);
        padding: 12px;
        font-size: 1em;
        margin-top: 10px;
        min-height: 44px;
        box-sizing: border-box;
    }
}

/* Tablet (769px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    #offers-list {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .offer-card {
        padding: 15px;
        display: flex;
        flex-direction: column;
    }

    .offer-card h3 {
        font-size: 1.15em;
    }

    .offer-img {
        width: 100%;
        height: 160px;
        object-fit: cover;
        border-radius: 5px;
        margin: 10px 0;
    }

    .offer-card p {
        flex-grow: 1;
    }

    .offer-card button {
        width: 100%;
        padding: 12px;
        font-size: 1em;
        margin-top: auto;
    }
}

/* Desktop (nad 1025px) */
@media (min-width: 1025px) {
    #offers-list {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 20px;
    }

    .offer-card {
        padding: 15px;
        display: flex;
        flex-direction: column;
    }

    .offer-card h3 {
        font-size: 1.1em;
        margin-bottom: 8px;
    }

    .offer-img:hover {
        transform: scale(1.02);
        opacity: 0.95;
    }

    .offer-card:hover {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        transform: translateY(-2px);
        transition: all 0.3s ease;
    }

    .offer-card p {
        flex-grow: 1;
        font-size: 0.95em;
        margin: 5px 0;
    }

    .offer-card button {
        width: 100%;
        padding: 12px;
        margin-top: auto;
        font-size: 0.95em;
    }
}

/* MalÃ© mobily (do 480px) */
@media (max-width: 480px) {
    body {
        padding: 8px;
    }

    nav h1 {
        font-size: 1.2em;
    }

    #offers-list {
        gap: 10px;
    }

    .offer-card {
        padding: 10px;
        display: block;
        box-sizing: border-box;
    }

    .offer-img {
        width: 100%;
        height: auto;
        max-height: 200px;
        object-fit: cover;
    }

    .offer-card button {
        font-size: 1em;
        padding: 12px;
        min-height: 44px;
        width: calc(100% - 20px);
        box-sizing: content-box;
    }
}

/* Portrait orientÃ¡cia na mobiloch */
@media (max-width: 600px) and (orientation: portrait) {
    .offer-card {
        padding: 8px;
        box-sizing: border-box;
    }

    .offer-card button {
        width: 100%;
        padding: 10px;
        box-sizing: border-box;
        font-size: 0.95em;
        margin-top: 8px;
    }
}

/* --- CHAT HEADER --- */
.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.chat-header h2 {
    margin: 0;
/* MobilnÃ½ dizajn (do 768px) */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    #offers-list {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .offer-card {
        padding: 12px;
        margin-bottom: 0;
        display: block;
        overflow: hidden;
    }

    .offer-card h3 {
        font-size: 1.1em;
        margin: 0 0 8px 0;
    }

    /* Na mobile chceme fotku trochu vÃ¤ÄÅ¡iu, aby vynikla kvalita */
    .offer-img {
        width: 100%;
        height: auto;
        aspect-ratio: 16/9;
        max-height: 250px;
        object-fit: cover;
        border-radius: 5px;
    }

    .offer-card p {
        font-size: 0.95em;
        margin: 8px 0;
    }

    .offer-footer {
        margin: 8px 0;
    }

    .offer-card button {
        width: calc(100% - 0px);
        padding: 12px;
        font-size: 1em;
        margin-top: 10px;
        min-height: 44px;
        box-sizing: border-box;
    }
}

/* Tablet (769px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    #offers-list {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .offer-card {
        padding: 15px;
        display: flex;
        flex-direction: column;
    }

    .offer-card h3 {
        font-size: 1.15em;
    }

    .offer-img {
        width: 100%;
        height: 160px;
        object-fit: cover;
        border-radius: 5px;
        margin: 10px 0;
    }

    .offer-card p {
        flex-grow: 1;
    }

    .offer-card button {
        width: 100%;
        padding: 12px;
        font-size: 1em;
        margin-top: auto;
    }
}

/* Desktop (nad 1025px) */
@media (min-width: 1025px) {
    #offers-list {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 20px;
    }

    .offer-card {
        padding: 15px;
        display: flex;
        flex-direction: column;
    }

    .offer-card h3 {
        font-size: 1.1em;
        margin-bottom: 8px;
    }

    .offer-img:hover {
        transform: scale(1.02);
        opacity: 0.95;
    }

    .offer-card:hover {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        transform: translateY(-2px);
        transition: all 0.3s ease;
    }

    .offer-card p {
        flex-grow: 1;
        font-size: 0.95em;
        margin: 5px 0;
    }

    .offer-card button {
        width: 100%;
        padding: 12px;
        margin-top: auto;
        font-size: 0.95em;
    }
}

/* MalÃ© mobily (do 480px) */
@media (max-width: 480px) {
    body {
        padding: 8px;
    }

    nav h1 {
        font-size: 1.2em;
    }

    #offers-list {
        gap: 10px;
    }

    .offer-card {
        padding: 10px;
        display: block;
        box-sizing: border-box;
    }

    .offer-img {
        width: 100%;
        height: auto;
        max-height: 200px;
        object-fit: cover;
    }

    .offer-card button {
        font-size: 1em;
        padding: 12px;
        min-height: 44px;
        width: calc(100% - 20px);
        box-sizing: content-box;
    }
}

/* Portrait orientÃ¡cia na mobiloch */
@media (max-width: 600px) and (orientation: portrait) {
    .offer-card {
        padding: 8px;
        box-sizing: border-box;
    }

    .offer-card button {
        width: 100%;
        padding: 10px;
        box-sizing: border-box;
        font-size: 0.95em;
        margin-top: 8px;
    }
}

/* --- CHAT HEADER --- */
.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

}

/* --- USER PROFILE PAGE --- */
.profile-page-header {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 30px !important;
    background: linear-gradient(135deg, rgba(0, 123, 255, 0.05), rgba(0, 210, 255, 0.05)) !important;
    position: relative;
    border-radius: 16px;
    margin-bottom: 20px;
}

body.dark .profile-page-header {
    background: linear-gradient(135deg, rgba(0, 123, 255, 0.1), rgba(0, 210, 255, 0.1)) !important;
}

.profile-info-main {
    display: flex;
    align-items: center;
    gap: 25px;
}

.profile-details h2 {
    margin: 0 0 5px 0;
    font-size: 2rem;
}

.status-indicator {
    font-size: 0.9rem;
    color: #888;
    margin: 5px 0;
    display: flex;
    align-items: center;
    gap: 5px;
}

.status-indicator.active {
    color: #2ed573;
    font-weight: bold;
}

.btn-back-mini {
    position: absolute;
    top: 20px;
    left: 20px;
    padding: 5px 10px !important;
    font-size: 0.8rem !important;
}

.offers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.mini-offer {
    padding: 12px !important;
    font-size: 0.9rem;
}

.mini-offer h4 {
    margin: 0 0 10px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 1.1rem;
}

.mini-img {
    height: 150px !important;
}

.btn-sm {
    padding: 6px 12px !important;
    font-size: 0.85rem !important;
}

@media (max-width: 600px) {
    .profile-info-main {
        flex-direction: column;
        text-align: center;
    }
    
    .profile-page-header {
        padding-top: 60px !important;
    }

    .profile-details h2 {
        font-size: 1.5rem;
    }
}

.beta-badge { background: #ff4757; color: inherit; padding: 2px 8px; border-radius: 12px; font-size: 0.5em; vertical-align: middle; text-transform: uppercase; letter-spacing: 1px; }
.ai-offer-badge { background: #2ed573; color: inherit; padding: 3px 6px; border-radius: 4px; font-size: 0.7em; margin-left: 5px; text-transform: uppercase; font-weight: bold; display: inline-block; vertical-align: middle; }

.active-deal-card {
    border-left: 5px solid #2ed573;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 20px !important;
}

.active-deal-info h3 {
    margin: 0 0 10px 0;
}

.active-deal-info p {
    margin: 5px 0;
    font-size: 0.95rem;
}

.finish-deal-btn {
    background: #2ed573;
    white-space: nowrap;
}

.finish-deal-btn:hover {
    background: #26af5f;
}

@media (max-width: 600px) {
    .active-deal-card {
        flex-direction: column;
        align-items: flex-start;
    }
    .finish-deal-btn {
        width: 100%;
    }
}
/* --- CSP FIXES --- */
.nav-brand-h1 {
    display: flex;
    align-items: center;
    gap: 10px;
}

.detail-img-csp {
    height: auto;
    max-height: 400px;
}

.comment-input-csp {
    height: 60px;
}

.offer-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}

.btn-pin-toggle {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: background 0.2s, transform 0.2s;
    line-height: 1;
}

.btn-pin-toggle:hover {
    background: rgba(0, 0, 0, 0.05);
    transform: scale(1.1);
}

body.dark .btn-pin-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}
