/* BJS Voting System - Public Styles */

.bjs-voting-container {
    max-width: 1040px;
    margin: 0 auto 24px;
    padding: 18px;
    background:
        radial-gradient(circle at top left, rgba(34, 113, 177, 0.12), transparent 32%),
        linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    border: 1px solid #dbe7f3;
    border-radius: 18px;
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.08);
}

.bjs-voting-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    margin-bottom: 18px;
    gap: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e5eef7;
}

.bjs-category-header-copy {
    min-width: 0;
}

.bjs-category-title {
    font-size: 27px;
    color: #14213d;
    margin: 0;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.bjs-category-meta {
    margin-top: 10px;
}

.bjs-category-voters {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: #edf5ff;
    color: #184e77;
    font-size: 13px;
    font-weight: 700;
    border: 1px solid #c8def7;
}

.bjs-suggest-entity-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 11px 18px !important;
    background: linear-gradient(135deg, #2271b1 0%, #1d4ed8 100%) !important;
    color: #fff !important;
    text-decoration: none !important;
    border-radius: 999px !important;
    cursor: pointer;
    border: 0 !important;
    box-shadow: 0 10px 20px rgba(34, 113, 177, 0.22);
    font-weight: 700 !important;
    white-space: nowrap;
}

.bjs-suggest-entity-btn:hover {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%) !important;
    transform: translateY(-1px);
}

.bjs-login-notice {
    background: linear-gradient(135deg, #fff7d6 0%, #fff0b3 100%);
    border: 1px solid #f2ca52;
    padding: 14px 16px;
    border-radius: 12px;
    margin-bottom: 14px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.bjs-login-notice p {
    margin: 0;
}

.bjs-entities-list {
    display: grid;
    gap: 14px;
}

.bjs-results-locked-note {
    margin-bottom: 12px;
    padding: 10px 12px;
    border: 1px solid #bfdbfe;
    background: #eff6ff;
    color: #1d4ed8;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
}

.bjs-entity-card {
    background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
    border: 1px solid #dbe7f3;
    border-radius: 14px;
    padding: 14px 16px;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 180px;
    gap: 14px;
    align-items: center;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.bjs-entity-card:hover {
    transform: translateY(-2px);
    border-color: #bfd8ef;
    box-shadow: 0 16px 30px rgba(15, 23, 42, 0.09);
}

.bjs-entity-rank {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 800;
    color: #184e77;
    min-width: 44px;
    text-align: center;
    border-radius: 12px;
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
}

.bjs-entity-content {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
}

.bjs-entity-logo {
    width: 58px;
    height: 58px;
    object-fit: contain;
    border: 1px solid #d7e3ef;
    border-radius: 10px;
    padding: 4px;
    background: #fff;
}

.bjs-entity-name {
    font-size: 17px;
    margin: 0 0 6px;
    color: #1f2937;
    line-height: 1.3;
}

.bjs-entity-description {
    color: #64748b;
    line-height: 1.45;
    margin: 0 0 4px;
    font-size: 12px;
}

.bjs-entity-website {
    color: #2271b1;
    text-decoration: none;
    font-size: 12px;
}

.bjs-entity-website:hover {
    text-decoration: underline;
}

.bjs-vote-progress-wrap {
    margin-top: 8px;
    width: 100%;
}

.bjs-vote-progress {
    width: 100%;
    height: 9px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
}

.bjs-vote-progress-bar {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #2271b1, #16a34a);
    transition: width 0.3s ease;
}

.bjs-vote-progress-label {
    margin-top: 6px;
    font-size: 11px;
    color: #4b5563;
    font-weight: 700;
}

.bjs-vote-progress-wrap.is-locked .bjs-vote-progress {
    opacity: 0.45;
}

.bjs-vote-progress-wrap.is-locked .bjs-vote-progress-bar {
    background: linear-gradient(90deg, #cbd5e1, #94a3b8);
}

.bjs-entity-actions {
    display: grid;
    grid-template-columns: 1fr;
    justify-items: end;
    gap: 10px;
}

.bjs-vote-count {
    font-size: 20px;
    font-weight: 800;
    color: #2271b1;
    text-align: right;
    line-height: 1.1;
}

.bjs-vote-count span {
    display: block;
    font-size: 10px;
    font-weight: normal;
    color: #666;
    margin-top: 3px;
}

.bjs-vote-count.is-locked {
    font-size: 13px;
    color: #6b7280;
}

.bjs-vote-btn {
    padding: 8px 16px;
    background: linear-gradient(135deg, #2271b1 0%, #1d4ed8 100%);
    color: #fff;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    box-shadow: 0 10px 18px rgba(34, 113, 177, 0.18);
    transition: all 0.2s ease;
}

.bjs-vote-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
    transform: translateY(-1px);
}

.bjs-vote-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    box-shadow: none;
}

.bjs-vote-btn.voted {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
}

.bjs-vote-btn.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Modal Styles */
.bjs-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
}

.bjs-modal-content {
    background-color: #fff;
    margin: 5% auto;
    padding: 24px;
    border: 1px solid #dbe7f3;
    border-radius: 16px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 24px 48px rgba(15, 23, 42, 0.18);
}

.bjs-modal-close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.bjs-modal-close:hover {
    color: #000;
}

.bjs-modal h3 {
    margin-top: 0;
    color: #14213d;
}

.bjs-modal form p {
    margin-bottom: 12px;
}

.bjs-modal label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

.bjs-modal input[type="text"],
.bjs-modal input[type="url"],
.bjs-modal textarea,
.bjs-modal select {
    width: 100%;
    padding: 10px;
    border: 1px solid #d4deea;
    border-radius: 10px;
    background: #fbfdff;
    box-sizing: border-box;
}

.bjs-form-message {
    margin-top: 12px;
    padding: 10px;
    border-radius: 4px;
    display: none;
}

.bjs-form-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    display: block;
}

.bjs-form-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    display: block;
}

/* Responsive */
@media (max-width: 768px) {
    .bjs-voting-container {
        padding: 14px;
        border-radius: 14px;
    }

    .bjs-entity-card {
        grid-template-columns: 1fr;
    }

    .bjs-entity-content {
        grid-template-columns: 52px 1fr;
    }

    .bjs-entity-actions {
        grid-template-columns: 1fr auto;
        justify-items: stretch;
        align-items: center;
    }

    .bjs-vote-count {
        text-align: left;
    }

    .bjs-voting-header {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .bjs-suggest-entity-btn {
        width: 100%;
    }

    .bjs-vote-btn {
        width: 100%;
    }
}

/* Loading Spinner */
.bjs-loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.bjs-entity-name,
.bjs-entity-description,
.bjs-entity-website {
    white-space: normal;
    text-overflow: clip;
    overflow: visible;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.bjs-pagination {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.bjs-pagination-link {
    display: inline-block;
    padding: 4px 8px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    text-decoration: none;
    color: #1f2937;
    font-size: 12px;
    line-height: 1.2;
}

.bjs-pagination-link.active {
    background: #2271b1;
    border-color: #2271b1;
    color: #fff;
    pointer-events: none;
}

/* Single-line desktop row layout override */
@media (min-width: 769px) {
    .bjs-entity-card {
        grid-template-columns: 36px minmax(0, 1fr) 220px;
        align-items: center;
        gap: 10px;
        padding: 8px 10px;
    }

    .bjs-entity-content {
        grid-template-columns: 44px minmax(0, 1fr);
        align-items: center;
        gap: 8px;
    }

    .bjs-entity-logo {
        width: 44px;
        height: 44px;
    }

    .bjs-entity-info {
        display: flex;
        align-items: center;
        gap: 10px;
        min-width: 0;
    }

    .bjs-entity-name,
    .bjs-entity-description,
    .bjs-entity-website {
        margin: 0;
        line-height: 1.2;
        white-space: nowrap;
    }

    .bjs-entity-name {
        font-size: 14px;
    }

    .bjs-entity-description {
        font-size: 12px;
    }

    .bjs-entity-website {
        font-size: 12px;
    }

    .bjs-vote-progress-wrap {
        margin-top: 0;
        margin-left: auto;
        display: flex;
        align-items: center;
        gap: 6px;
        min-width: 110px;
    }

    .bjs-vote-progress {
        width: 80px;
    }

    .bjs-vote-progress-label {
        margin-top: 0;
        white-space: nowrap;
    }

    .bjs-entity-actions {
        display: flex;
        align-items: center;
        justify-content: flex-end;
        gap: 10px;
    }

    .bjs-vote-count {
        font-size: 18px;
        white-space: nowrap;
        text-align: right;
    }

    .bjs-vote-count span {
        display: inline;
        margin-left: 4px;
        font-size: 11px;
    }

    .bjs-vote-btn {
        padding: 5px 12px;
        font-size: 12px;
    }
}

.bjs-website-icon-link {
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    text-decoration: none;
    color: #2271b1;
    font-size: 13px;
    line-height: 1;
    background: #fff;
}

.bjs-website-icon-link:hover {
    border-color: #2271b1;
    background: #eff6ff;
}

.bjs-verified-badge {
    width: 12px;
    height: 12px;
    display: inline-block;
    border-radius: 999px;
    background: #16a34a;
    margin-left: 5px;
    position: relative;
    vertical-align: middle;
}

.bjs-verified-badge::after {
    content: '';
    position: absolute;
    left: 3px;
    top: 1px;
    width: 4px;
    height: 7px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

@media (min-width: 769px) {
    .bjs-entity-actions {
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        justify-content: center;
        gap: 6px;
    }

    .bjs-vote-progress-wrap {
        margin-top: 0;
        display: flex;
        align-items: center;
        gap: 6px;
        min-width: 110px;
    }

    .bjs-vote-progress {
        width: 82px;
    }

    .bjs-vote-progress-label {
        margin-top: 0;
        min-width: 34px;
        text-align: right;
    }

    .bjs-vote-count {
        font-size: 16px;
    }

    .bjs-vote-count span {
        display: inline-block;
        margin-top: 0;
    }
}

.bjs-globe-svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}

/* Final desktop alignment: keep action items in one line */
@media (min-width: 769px) {
    .bjs-entity-actions {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: flex-end;
        gap: 8px;
        flex-wrap: nowrap;
    }

    .bjs-website-icon-link,
    .bjs-vote-progress-wrap,
    .bjs-vote-btn,
    .bjs-vote-count {
        flex: 0 0 auto;
    }

    .bjs-vote-progress-wrap {
        min-width: 112px;
    }

    .bjs-vote-progress {
        width: 78px;
    }

    .bjs-vote-count {
        white-space: nowrap;
        font-size: 15px;
    }
}
