/* Panel Inwestora — page-specific styles (extends design-system.css) */

/* ------------------------------------------------------------------ Page header */

.inwestora-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--sp-lg);
}

.inwestora-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--maptoo-navy);
}

/* ------------------------------------------------------------------ Filters bar */

.inwestora-filters {
    display: flex;
    align-items: center;
    gap: var(--sp-sm);
    flex-wrap: wrap;
    margin-bottom: var(--sp-lg);
}

.inwestora-filters .maptoo-input {
    width: 260px;
    flex-shrink: 0;
}

.inwestora-filters .maptoo-select {
    width: 180px;
    flex-shrink: 0;
}

/* ------------------------------------------------------------------ Watchlist grid */

.watchlist-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--sp-md);
}

/* ------------------------------------------------------------------ Watchlist card */

.watchlist-card {
    display: flex;
    flex-direction: column;
    gap: var(--sp-sm);
    background: white;
    border: 1px solid rgba(15, 27, 68, 0.08);
    border-radius: var(--radius-md);
    padding: var(--sp-md);
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s;
}

.watchlist-card:hover {
    box-shadow: var(--shadow-md);
}

.watchlist-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.watchlist-card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--maptoo-navy);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.watchlist-card-meta {
    display: flex;
    align-items: center;
    gap: var(--sp-sm);
    font-size: 13px;
    color: var(--maptoo-gray);
}

.watchlist-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
    padding-top: var(--sp-sm);
    border-top: 1px solid rgba(15, 27, 68, 0.06);
}

/* ------------------------------------------------------------------ Watch type badge */

.watch-type-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.watch-type-badge.municipality {
    background: rgba(39, 174, 96, 0.15);
    color: var(--maptoo-success);
}

.watch-type-badge.project_type {
    background: rgba(79, 108, 224, 0.15);
    color: var(--maptoo-blue);
}

/* ------------------------------------------------------------------ Email toggle (CSS-only) */

.email-toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.email-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.email-toggle-slider {
    position: absolute;
    inset: 0;
    background: rgba(15, 27, 68, 0.15);
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.25s;
}

.email-toggle-slider::before {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
    transition: transform 0.25s;
}

.email-toggle input:checked + .email-toggle-slider {
    background: var(--maptoo-blue);
}

.email-toggle input:checked + .email-toggle-slider::before {
    transform: translateX(20px);
}

.email-toggle input:focus + .email-toggle-slider {
    box-shadow: 0 0 0 3px rgba(79, 108, 224, 0.15);
}

/* ------------------------------------------------------------------ Project grid */

.project-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--sp-md);
}

/* ------------------------------------------------------------------ Project card */

.project-card {
    display: flex;
    flex-direction: column;
    gap: var(--sp-sm);
    background: white;
    border: 1px solid rgba(15, 27, 68, 0.08);
    border-radius: var(--radius-md);
    padding: var(--sp-md);
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s;
    cursor: pointer;
}

.project-card:hover {
    box-shadow: var(--shadow-md);
}

.project-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.project-card-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--maptoo-navy);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
}

.project-card-meta {
    display: flex;
    align-items: center;
    gap: var(--sp-sm);
    font-size: 13px;
    color: var(--maptoo-gray);
}

.project-card-meta svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
    flex-shrink: 0;
}

.project-card-municipality {
    font-size: 14px;
    color: var(--maptoo-gray);
}

.project-card-date {
    font-size: 12px;
    color: var(--maptoo-gray);
}

.project-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
    padding-top: var(--sp-sm);
    border-top: 1px solid rgba(15, 27, 68, 0.06);
}

/* ------------------------------------------------------------------ Notification items */

.notification-item {
    display: flex;
    align-items: flex-start;
    gap: var(--sp-sm);
    padding: var(--sp-sm) var(--sp-md);
    border-radius: var(--radius-sm);
    transition: background 0.15s;
}

.notification-item:hover {
    background: rgba(172, 194, 255, 0.08);
}

.notification-item.unread {
    border-left: 3px solid var(--maptoo-blue);
    font-weight: 600;
    background: rgba(79, 108, 224, 0.04);
}

.notification-item-content {
    flex: 1;
    min-width: 0;
}

.notification-item-title {
    font-size: 14px;
    color: var(--maptoo-navy);
    line-height: 1.3;
}

.notification-item-date {
    font-size: 12px;
    color: var(--maptoo-gray);
    margin-top: 2px;
}

.notification-item-event {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--maptoo-blue);
}

/* ------------------------------------------------------------------ Notification badge */

.notification-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--maptoo-error);
    color: white;
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    pointer-events: none;
}

/* ------------------------------------------------------------------ Map wrapper */

.plan-map-wrap {
    flex-grow: 1;
    min-height: 400px;
    background: white;
    border: 1px solid rgba(15, 27, 68, 0.08);
    border-radius: var(--radius-md);
    overflow: hidden;
    position: relative;
}

.plan-map-wrap .map-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--maptoo-gray);
}

/* ------------------------------------------------------------------ Plan detail panel */

.plan-detail-panel {
    width: 380px;
    flex-shrink: 0;
    padding: var(--sp-md);
    background: white;
    border: 1px solid rgba(15, 27, 68, 0.08);
    border-radius: var(--radius-md);
    overflow-y: auto;
    max-height: calc(100vh - var(--nav-height) - var(--sp-2xl));
}

.plan-detail-panel h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--maptoo-navy);
    margin-bottom: var(--sp-md);
}

.plan-detail-section {
    margin-bottom: var(--sp-lg);
}

.plan-detail-section-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--maptoo-gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--sp-sm);
}

.plan-detail-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--sp-xs) 0;
    font-size: 14px;
    color: var(--maptoo-navy);
}

.plan-detail-row .label {
    color: var(--maptoo-gray);
    font-weight: 500;
}

/* ------------------------------------------------------------------ Two-column layout */

.plan-layout {
    display: flex;
    gap: var(--sp-md);
    min-height: calc(100vh - var(--nav-height) - 160px);
}

/* ------------------------------------------------------------------ Consultation section */

.consultation-section {
    margin-top: var(--sp-lg);
    padding: var(--sp-md);
    background: white;
    border: 1px solid rgba(15, 27, 68, 0.08);
    border-radius: var(--radius-md);
}

.consultation-section-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--maptoo-navy);
    margin-bottom: var(--sp-md);
}

.consultation-section-meta {
    display: flex;
    align-items: center;
    gap: var(--sp-md);
    font-size: 13px;
    color: var(--maptoo-gray);
    margin-bottom: var(--sp-md);
}

/* ------------------------------------------------------------------ Comment card */

.comment-card {
    border-left: 3px solid var(--maptoo-blue);
    padding: var(--sp-sm) var(--sp-md);
    margin-bottom: var(--sp-md);
    background: rgba(172, 194, 255, 0.04);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.comment-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--sp-xs);
}

.comment-card-author {
    font-size: 13px;
    font-weight: 600;
    color: var(--maptoo-navy);
}

.comment-card-date {
    font-size: 11px;
    color: var(--maptoo-gray);
}

.comment-card-body {
    font-size: 14px;
    color: var(--maptoo-navy);
    line-height: 1.5;
}

.comment-card-response {
    margin-top: var(--sp-sm);
    padding: var(--sp-sm);
    background: rgba(79, 108, 224, 0.06);
    border-left: 3px solid var(--maptoo-blue);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--maptoo-navy);
}

.comment-card-response .response-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--maptoo-blue);
    margin-bottom: var(--sp-xs);
}

/* ------------------------------------------------------------------ Status badges */

.status-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.draft {
    background: rgba(122, 139, 181, 0.15);
    color: var(--maptoo-gray);
}

.status-badge.submitted {
    background: rgba(79, 108, 224, 0.15);
    color: var(--maptoo-blue);
}

.status-badge.approved {
    background: rgba(39, 174, 96, 0.15);
    color: var(--maptoo-success);
}

.status-badge.published {
    background: rgba(39, 174, 96, 0.2);
    color: #1E8449;
}

/* ------------------------------------------------------------------ Empty state */

.inwestora-empty-state {
    text-align: center;
    padding: var(--sp-2xl) var(--sp-lg);
    color: var(--maptoo-gray);
}

.inwestora-empty-state-icon {
    font-size: 48px;
    margin-bottom: var(--sp-md);
    opacity: 0.4;
}

.inwestora-empty-state p {
    font-size: 15px;
    margin-bottom: var(--sp-md);
}

/* ------------------------------------------------------------------ Responsive */

@media (max-width: 1024px) {
    .watchlist-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .project-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .plan-layout {
        flex-direction: column;
    }

    .plan-detail-panel {
        width: 100%;
        max-height: none;
    }
}

@media (max-width: 640px) {
    .watchlist-grid {
        grid-template-columns: 1fr;
    }

    .project-grid {
        grid-template-columns: 1fr;
    }

    .plan-layout {
        flex-direction: column;
    }

    .plan-detail-panel {
        width: 100%;
        max-height: none;
    }

    .plan-map-wrap {
        min-height: 300px;
    }

    .inwestora-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--sp-sm);
    }

    .inwestora-filters {
        flex-direction: column;
    }

    .inwestora-filters .maptoo-input,
    .inwestora-filters .maptoo-select {
        width: 100%;
    }
}

/* ============================================================================
   MESSAGES (skrzynka wiadomości)
   ============================================================================ */

.msg-unread-badge {
    display: inline-block;
    min-width: 20px;
    padding: 1px 7px;
    border-radius: 10px;
    background: #E74C3C;
    color: white;
    font-size: 11px;
    font-weight: 700;
    text-align: center;
    line-height: 1.4;
}

.messages-layout {
    display: grid;
    grid-template-columns: 340px 1fr;
    height: calc(100vh - var(--nav-height, 60px) - 90px);
    min-height: 500px;
    background: white;
    border: 1px solid rgba(15, 27, 68, 0.08);
    border-radius: 10px;
    overflow: hidden;
}

.messages-sidebar {
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(15, 27, 68, 0.08);
    background: #FAFBFE;
}

.messages-filters {
    display: flex;
    gap: 4px;
    padding: 10px;
    border-bottom: 1px solid rgba(15, 27, 68, 0.08);
    background: white;
}

.msg-filter-btn {
    flex: 1;
    padding: 7px 10px;
    border: 1px solid #E5E8F0;
    border-radius: 7px;
    background: white;
    color: #4A5578;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 150ms;
}
.msg-filter-btn:hover { background: #FFF6EB; color: #E67E22; }
.msg-filter-btn.active { background: #E67E22; color: white; border-color: #E67E22; }

.messages-threads-list { flex: 1; overflow-y: auto; padding: 4px 0; }

.msg-thread-item {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(15, 27, 68, 0.06);
    cursor: pointer;
    transition: background 120ms;
}
.msg-thread-item:hover { background: #FFF6EB; }
.msg-thread-item.active {
    background: #FFEBD0;
    border-left: 3px solid #E67E22;
    padding-left: 13px;
}
.msg-thread-item.unread { background: rgba(230, 126, 34, 0.04); }
.msg-thread-item.unread .msg-thread-subject,
.msg-thread-item.unread .msg-thread-person {
    font-weight: 700; color: #1A1E2E;
}

.msg-thread-head { display: flex; justify-content: space-between; margin-bottom: 4px; align-items: center; }
.msg-thread-person { font-size: 13px; font-weight: 600; color: #1A1E2E; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-thread-date { font-size: 11px; color: #7A8BB5; margin-left: 8px; }
.msg-thread-subject { font-size: 13.5px; color: #1A1E2E; margin-bottom: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-thread-snippet { font-size: 12px; color: #7A8BB5; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-bottom: 4px; }
.msg-thread-meta { display: flex; gap: 8px; align-items: center; }

.msg-attach-icon { font-size: 11px; color: #7A8BB5; }

.messages-thread-view { display: flex; flex-direction: column; background: white; }
.thread-empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; flex: 1; }

.thread-header {
    padding: 16px 24px;
    border-bottom: 1px solid rgba(15, 27, 68, 0.08);
    background: #FAFBFE;
}
.thread-header h2 { font-size: 17px; font-weight: 700; color: #1A1E2E; }

.thread-messages {
    flex: 1; overflow-y: auto;
    padding: 16px 24px;
    display: flex; flex-direction: column; gap: 16px;
}

.msg-single {
    background: #FAFBFE;
    border: 1px solid rgba(15, 27, 68, 0.08);
    border-radius: 10px;
    padding: 14px 16px;
}
.msg-single-head { display: flex; justify-content: space-between; margin-bottom: 10px; font-size: 13px; }
.msg-status-pill {
    display: inline-block; padding: 1px 8px;
    font-size: 10px; font-weight: 700; border-radius: 10px;
    text-transform: uppercase; letter-spacing: 0.5px;
}
.msg-status-pill.unread { background: #E67E22; color: white; }
.msg-single-body { font-size: 14px; color: #1A1E2E; line-height: 1.6; white-space: pre-wrap; margin-bottom: 8px; }

.msg-attachments {
    display: flex; flex-direction: column; gap: 6px;
    margin-top: 10px; padding-top: 10px;
    border-top: 1px solid rgba(15, 27, 68, 0.06);
}
.msg-attach-item {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 10px;
    background: white;
    border: 1px solid rgba(15, 27, 68, 0.08);
    border-radius: 6px;
    font-size: 12.5px;
}
.msg-attach-name { flex: 1; color: #1A1E2E; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-attach-size { color: #7A8BB5; font-size: 11px; }
.msg-attach-download {
    color: #E67E22; font-weight: 600; text-decoration: none;
    padding: 2px 8px; border-radius: 4px; transition: background 120ms;
}
.msg-attach-download:hover { background: #FFF6EB; }

.thread-reply {
    padding: 12px 24px 16px;
    border-top: 1px solid rgba(15, 27, 68, 0.08);
    background: #FAFBFE;
}
.thread-reply textarea { margin-bottom: 8px; }
.thread-reply-bar { display: flex; align-items: center; gap: 8px; }

.compose-dropzone {
    border: 2px dashed #CBD2E0;
    border-radius: 10px;
    padding: 24px; text-align: center;
    cursor: pointer;
    color: #7A8BB5; font-size: 13px;
    transition: all 150ms;
}
.compose-dropzone:hover, .compose-dropzone.dragover {
    border-color: #E67E22; background: #FFF6EB; color: #E67E22;
}
.compose-attachments-list { margin-top: 10px; display: flex; flex-direction: column; gap: 4px; }
.compose-attach-item {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 10px; background: #FFF6EB; border-radius: 6px;
    font-size: 12.5px;
}
.compose-attach-remove {
    background: none; border: none; color: #E74C3C;
    font-size: 18px; cursor: pointer; padding: 0 6px; font-family: inherit;
}
.compose-attach-remove:hover { color: #C0392B; }

@media (max-width: 1024px) {
    .messages-layout { grid-template-columns: 1fr; grid-template-rows: auto 1fr; height: auto; min-height: 80vh; }
    .messages-sidebar { border-right: none; border-bottom: 1px solid rgba(15,27,68,0.08); max-height: 300px; }
}
