/**
 * Poll Issue Modal CSS - Focused design for individual issue display
 */

/* Modal Base */
.poll-issue-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    padding: var(--space-lg, 1rem);
    padding-top: 120px;
    box-sizing: border-box;
}

.poll-issue-modal.show {
    opacity: 1;
    visibility: visible;
}

.poll-issue-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    cursor: pointer;
}

.poll-issue-modal-content {
    position: relative;
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    max-width: 1100px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
    overflow: hidden;
    transform: scale(0.9) translateY(20px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.poll-issue-modal.show .poll-issue-modal-content {
    transform: scale(1) translateY(0);
}

@keyframes pollIssueModalSlideIn {
    from {
        transform: translateY(40px) scale(0.95);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* Modal Header */
.poll-issue-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    padding: var(--space-xl, 1.5rem);
    border-bottom: 1px solid var(--border-color);
    background: var(--gradient-glass, linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%));
    backdrop-filter: blur(var(--blur-amount, 12px));
    position: relative;
    flex-shrink: 0;
    color: white;
}

.poll-issue-modal-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

.poll-issue-modal-header-left {
    display: flex;
    align-items: flex-start;
    gap: var(--space-lg, 1rem);
    flex: 1;
    min-width: 0;
    padding-right: 60px;
    flex-direction: column;
}

.poll-issue-id-badge {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: var(--space-sm) var(--space-lg);
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: 'Space Grotesk', 'Courier New', monospace;
    flex-shrink: 0;
    letter-spacing: 0.5px;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.poll-issue-title-large {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.2;
    color: white;
    flex: 1;
}

.poll-issue-votes-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    background: rgba(255, 255, 255, 0.25);
    padding: var(--space-sm) var(--space-md);
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(10px);
    flex-shrink: 0;
}

.poll-issue-votes-header .type-icon {
    font-size: 1rem;
}

.poll-issue-votes-header .type-text {
    font-weight: 600;
}

.poll-issue-votes-header .vote-separator {
    color: rgba(255, 255, 255, 0.6);
    font-weight: normal;
}

.poll-issue-votes-header .vote-icon {
    font-size: 0.9rem;
}

.poll-issue-votes-header .vote-count {
    font-weight: 600;
}

.poll-issue-modal-close {
    position: absolute;
    top: var(--space-xl, 1.5rem);
    right: var(--space-xl, 1.5rem);
    background: none;
    border: none;
    color: var(--text-secondary, #9d9da1);
    cursor: pointer;
    padding: var(--space-sm, 0.5rem);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.poll-issue-modal-close:hover {
    background: var(--gradient-danger, linear-gradient(135deg, #ef4444 0%, #dc2626 100%));
    color: white;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* Modal Body */
.poll-issue-modal-body {
    flex: 1;
    /*padding: var(--space-sm, 1rem);*/
    overflow-y: auto;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}




.poll-issue-description-section {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    border: 1px solid var(--border-color);
}

.poll-issue-description-section h3 {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 var(--space-lg) 0;
    padding-bottom: var(--space-sm);
    border-bottom: 2px solid var(--border-color);
}

.poll-issue-description-content {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-primary);
}

.poll-issue-description-content p {
    margin: 0 0 var(--space-md) 0;
}

.poll-issue-description-content p:last-child {
    margin-bottom: 0;
}

/* Clickable Poll Issue Card Enhancements */
.clickable-poll-issue-card {
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.clickable-poll-issue-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    border-color: var(--accent-primary);
}

.poll-issue-card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 122, 204, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(4px);
    border-radius: var(--radius-lg);
    z-index: 1;
}

.clickable-poll-issue-card:hover .poll-issue-card-overlay {
    opacity: 1;
}

.poll-issue-card-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
    color: white;
    text-align: center;
    position: relative;
    z-index: 2;
}

.poll-issue-card-action .action-icon {
    font-size: 2rem;
    animation: bounce 2s infinite;
}

.poll-issue-card-action .action-text {
    font-size: 1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

@keyframes bounce {
    0%, 20%, 53%, 80%, 100% {
        transform: translateY(0);
    }
    40%, 43% {
        transform: translateY(-10px);
    }
    70% {
        transform: translateY(-5px);
    }
    90% {
        transform: translateY(-2px);
    }
}

/* Ensure vote buttons are above overlay */
.poll-issue-actions {
    position: relative;
    z-index: 3;
}

/* Responsive Design */
@media (max-width: 768px) {
    .poll-issue-modal {
        padding: 0.75rem;
        align-items: flex-start;
        padding-left: max(0.75rem, env(safe-area-inset-left, 0.75rem));
        padding-right: max(0.75rem, env(safe-area-inset-right, 0.75rem));
        padding-top: max(80px, calc(80px + env(safe-area-inset-top, 0px)));
        padding-bottom: max(1rem, env(safe-area-inset-bottom, 1rem));
    }

    .poll-issue-modal-content {
        max-height: calc(100vh - 100px);
        width: 100%;
        margin: 0;
    }

    .poll-issue-modal-body {
        /*padding: var(--space-lg, 1rem);*/
        max-height: calc(100vh - 280px);
    }

    .poll-issue-modal-header {
        padding: var(--space-lg, 1rem);
    }

    .poll-issue-modal-header-left {
        gap: var(--space-md, 0.75rem);
        text-align: left;
        padding-right: 50px;
    }

    .poll-issue-title-large {
        font-size: var(--font-lg, 1.125rem);
        line-height: 1.3;
        margin: 0 0 var(--space-xs, 0.25rem) 0;
        text-align: left;
    }

    .poll-issue-modal-close {
        top: var(--space-lg, 1rem);
        right: var(--space-lg, 1rem);
        width: 36px;
        height: 36px;
        font-size: 1.25rem;
    }

    .poll-issue-description-section {
        padding: var(--space-lg, 1rem);
    }
}

@media (max-width: 480px) {
    .poll-issue-modal {
        padding: 0.5rem;
        padding-top: 70px;
    }

    .poll-issue-modal-content {
        max-height: calc(100vh - 80px);
        border-radius: var(--radius-md, 8px);
    }

    .poll-issue-modal-body {
        padding: var(--space-md, 0.75rem);
        max-height: calc(100vh - 240px);
    }

    .poll-issue-modal-header {
        padding: var(--space-md, 0.75rem);
    }

    .poll-issue-modal-header-left {
        padding-right: 45px;
    }

    .poll-issue-title-large {
        font-size: var(--font-base, 1rem);
    }

    .poll-issue-modal-close {
        top: var(--space-md, 0.75rem);
        right: var(--space-md, 0.75rem);
        width: 32px;
        height: 32px;
        font-size: 1.125rem;
    }

    .poll-issue-description-section {
        padding: var(--space-md, 0.75rem);
    }

    .poll-issue-description-content {
        font-size: var(--font-sm, 0.875rem);
    }
}

/* Landscape orientation */
@media (max-width: 768px) and (orientation: landscape) {
    .poll-issue-modal {
        padding-top: 60px;
    }

    .poll-issue-modal-content {
        max-height: calc(100vh - 80px);
    }

    .poll-issue-modal-body {
        max-height: calc(100vh - 220px);
    }
}

/* Light theme support */
[data-theme="light"] .poll-issue-modal-content {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .poll-issue-description-section {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.1);
}

/* Fix title color in light theme */
[data-theme="light"] .poll-issue-title-large {
    color: var(--text-primary, #0f172a);
}

/* Fix votes header styling in light theme */
[data-theme="light"] .poll-issue-votes-header {
    background: rgba(0, 0, 0, 0.1);
    color: var(--text-primary, #0f172a);
    border: 1px solid rgba(0, 0, 0, 0.2);
}

/* Scrollbar styling for modal body */
.poll-issue-modal-body::-webkit-scrollbar {
    width: 6px;
}

.poll-issue-modal-body::-webkit-scrollbar-track {
    background: var(--bg-tertiary, #1e252e);
    border-radius: var(--radius-sm, 0.375rem);
}

.poll-issue-modal-body::-webkit-scrollbar-thumb {
    background: var(--border-color, #374151);
    border-radius: var(--radius-sm, 0.375rem);
}

.poll-issue-modal-body::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary, #60a5fa);
}

/* Focus states for accessibility */
.poll-issue-modal-close:focus {
    outline: 2px solid var(--accent-primary, #60a5fa);
    outline-offset: 2px;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .poll-issue-modal,
    .poll-issue-modal-content,
    .poll-issue-modal-close {
        transition: none !important;
    }
    
    .clickable-poll-issue-card {
        transition: none !important;
    }
    
    .poll-issue-card-action .action-icon {
        animation: none !important;
    }
}

/* Light theme adjustments */
[data-theme="light"] .poll-issue-modal-backdrop {
    background: rgba(0, 0, 0, 0.5);
}

[data-theme="light"] .poll-issue-modal-body::-webkit-scrollbar-track {
    background: var(--bg-tertiary, #f1f5f9);
}

[data-theme="light"] .poll-issue-modal-body::-webkit-scrollbar-thumb {
    background: var(--border-color, #e2e8f0);
}

/* ===================================================
   MOBILE MODAL FOOTER FIX
   =================================================== */

@media (max-width: 768px) {

    .poll-issue-modal-content {
        max-height: 90vh;
        max-height: 90dvh;
        display: flex;
        flex-direction: column;
    }

    .poll-issue-modal-body {
        padding-bottom: calc(4rem + env(safe-area-inset-bottom, 0px));
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .poll-issue-description-section {
        padding-bottom: calc(2rem + env(safe-area-inset-bottom, 0px));
        margin-bottom: 1rem;
    }

    .comment-textarea,
    .form-input,
    .form-textarea {
        font-size: 16px;
    }

    .poll-issue-action-btn,
    .vote-btn,
    .comment-btn {
        min-height: 44px;
        min-width: 44px;
    }
}

@media (max-width: 480px) {
    .poll-issue-modal-content {
        max-height: 85vh;
        max-height: 85dvh;
    }

    .poll-issue-modal-body {
        padding-bottom: calc(5rem + env(safe-area-inset-bottom, 0px));
    }

    .poll-issue-description-section {
        padding-bottom: calc(3rem + env(safe-area-inset-bottom, 0px));
    }
}

@media (max-width: 768px) and (orientation: landscape) {
    .poll-issue-modal-body {
        padding-bottom: calc(3rem + env(safe-area-inset-bottom, 0px));
    }

    .poll-issue-modal-content {
        max-height: 80vh;
        max-height: 80dvh;
    }

    .poll-issue-description-section {
        padding-bottom: calc(2rem + env(safe-area-inset-bottom, 0px));
    }
}

@media (max-width: 768px) {
    .poll-issue-modal {
        padding-left: max(1rem, env(safe-area-inset-left, 1rem));
        padding-right: max(1rem, env(safe-area-inset-right, 1rem));
        padding-top: max(1rem, env(safe-area-inset-top, 1rem));
    }
}