/* survey/style.css */

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: #0f0c29; 
}
::-webkit-scrollbar-thumb {
    background: #302b63; 
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #00d2ff; 
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translate3d(0, 20px, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

.animate-fade-in-up {
    animation: fadeInUp 0.6s ease-out forwards;
}

/* Form Styles */
.form-group {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 20px;
    transition: all 0.3s ease;
    position: relative; /* For sentiment glow */
}

.form-group:hover, .form-group:focus-within {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(0, 210, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

/* Sentiment Reactive UI Glows */
.glow-positive {
    box-shadow: 0 0 20px rgba(74, 222, 128, 0.3), inset 0 0 10px rgba(74, 222, 128, 0.1) !important;
    border-color: #4ade80 !important;
}

.glow-negative {
    box-shadow: 0 0 20px rgba(248, 113, 113, 0.3), inset 0 0 10px rgba(248, 113, 113, 0.1) !important;
    border-color: #f87171 !important;
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.form-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: #e2e8f0;
    margin-bottom: 10px;
}

.form-label i {
    color: #00d2ff;
    margin-right: 6px;
    width: 16px;
    height: 16px;
    display: inline-block;
    vertical-align: middle;
}

/* Required Asterisk Style - Explicitly Defined */
.text-pink-500 {
    color: #ec4899 !important;
    margin-left: 4px;
}

.form-input, .form-textarea, .form-select {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 12px 16px;
    color: white;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    outline: none;
}

/* 修复下拉菜单选项背景色 */
.form-select option {
    background-color: #1a1642;
    color: white;
    padding: 10px;
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
    border-color: #00d2ff;
    background: rgba(0, 210, 255, 0.05);
    box-shadow: 0 0 0 2px rgba(0, 210, 255, 0.1);
}

.form-textarea {
    min-height: 120px;
    resize: vertical;
}

/* Radio & Checkbox Groups */
.radio-group, .checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.option-label {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    color: #e2e8f0; /* Ensure text is visible */
}

.option-label:hover {
    background: rgba(255, 255, 255, 0.1);
}

.option-input {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%; /* Radio style */
    margin-right: 12px;
    position: relative;
    transition: all 0.2s ease;
    background: transparent;
}

.option-input[type="checkbox"] {
    border-radius: 4px;
}

.option-input:checked {
    border-color: #00d2ff;
    background-color: #00d2ff;
}

.option-input:checked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background-color: #0f0c29;
    border-radius: 50%; /* Radio style */
}

.option-input[type="checkbox"]:checked::after {
    /* Checkmark shape */
    width: 5px;
    height: 9px;
    border: solid #0f0c29;
    border-width: 0 2px 2px 0;
    transform: translate(-50%, -60%) rotate(45deg);
    border-radius: 0;
    background-color: transparent;
}

.option-input:checked + span {
    color: #00d2ff;
    font-weight: 500;
}

/* File Upload */
.file-upload-container {
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.02);
}

.file-upload-container:hover {
    border-color: #00d2ff;
    background: rgba(0, 210, 255, 0.05);
}

.file-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
}

.preview-item {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid rgba(255,255,255,0.2);
}

/* Star Rating */
.rating-container {
    display: flex;
    gap: 8px;
    flex-direction: row-reverse; /* For CSS hover tricks */
    justify-content: flex-end;
}

.rating-input {
    display: none;
}

.rating-label {
    cursor: pointer;
    color: rgba(255, 255, 255, 0.2);
    font-size: 24px;
    transition: color 0.2s;
}

.rating-label:hover,
.rating-label:hover ~ .rating-label,
.rating-input:checked ~ .rating-label {
    color: #fbbf24; /* Amber-400 */
}

/* === 3D Gift Box Animation === */
.scene {
    width: 150px;
    height: 150px;
    margin: 40px auto;
    perspective: 600px;
}

.cube {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transform: rotateX(-20deg) rotateY(-30deg);
    transition: transform 1s;
    cursor: pointer;
}

.cube:hover {
    transform: rotateX(-20deg) rotateY(-10deg) scale(1.05);
}

.cube-face {
    position: absolute;
    width: 150px;
    height: 150px;
    background: linear-gradient(135deg, #ec4899, #db2777);
    border: 2px solid rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.2);
}

.face-front  { transform: rotateY(  0deg) translateZ(75px); }
.face-right  { transform: rotateY( 90deg) translateZ(75px); background: linear-gradient(135deg, #db2777, #be185d); }
.face-back   { transform: rotateY(180deg) translateZ(75px); }
.face-left   { transform: rotateY(-90deg) translateZ(75px); background: linear-gradient(135deg, #db2777, #be185d); }
.face-top    { transform: rotateX( 90deg) translateZ(75px); background: #fce7f3; transform-origin: center center; transition: transform 0.5s ease-in-out; }
.face-bottom { transform: rotateX(-90deg) translateZ(75px); background: #831843; box-shadow: 0 50px 50px rgba(0,0,0,0.5); }

/* Ribbon */
.cube-face::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 30px;
    background: #fde047; /* Yellow ribbon */
    box-shadow: 0 0 5px rgba(0,0,0,0.2);
}
.face-top::after { transform: rotate(90deg); }
.face-top::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 30px;
    background: #fde047;
}

/* Open State */
.cube.open .face-top {
    transform: rotateX(90deg) translateZ(75px) rotateX(-110deg);
}

/* Pop-out Item */
.pop-out-item {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: -1;
}

.cube.open .pop-out-item {
    transform: translate(-50%, -200%) scale(1.5);
    z-index: 10;
}

/* === Magic Cards Styles === */
#cards-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px; /* Mobile gap */
    min-height: 120px;
}

@media (min-width: 768px) { /* Desktop */
    #cards-container {
        gap: 16px; /* Wider gap on desktop */
    }
}

.magic-card {
    width: 60px; /* Mobile size */
    height: 90px;
    perspective: 1000px;
    cursor: pointer;
    transition: transform 0.3s;
    /* Add entrance animation */
    opacity: 0;
    transform: translateY(20px);
    animation: card-fade-in 0.5s ease-out forwards;
}

@keyframes card-fade-in {
    to { opacity: 1; transform: translateY(0); }
}

@media (min-width: 768px) {
    .magic-card {
        width: 80px; /* Desktop size */
        height: 120px;
    }
}

.magic-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.magic-card.flipped .magic-card-inner {
    transform: rotateY(180deg);
}

.magic-card-front, .magic-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255,255,255,0.2);
}

.magic-card-front {
    background: linear-gradient(135deg, #1a1642, #302b63);
    /* Pattern */
    background-image: 
        radial-gradient(circle at top left, rgba(255,255,255,0.2), transparent 40%),
        radial-gradient(circle at bottom right, rgba(255,255,255,0.2), transparent 40%);
}

.card-bg-1 .magic-card-front { background-color: #3b82f6; } /* Blue */
.card-bg-2 .magic-card-front { background-color: #ec4899; } /* Pink */
.card-bg-3 .magic-card-front { background-color: #9333ea; } /* Purple */
.card-bg-4 .magic-card-front { background-color: #10b981; } /* Green */
.card-bg-5 .magic-card-front { background-color: #f97316; } /* Orange */

.magic-card-back {
    transform: rotateY(180deg);
}

.magic-card.card-bg-1 .magic-card-back { background: linear-gradient(135deg, #a5f3fc, #67e8f9); color: #0e7490; }
.magic-card.card-bg-2 .magic-card-back { background: linear-gradient(135deg, #fbcfe8, #f9a8d4); color: #831843; }
.magic-card.card-bg-3 .magic-card-back { background: linear-gradient(135deg, #e9d5ff, #d8b4fe); color: #581c87; }
.magic-card.card-bg-4 .magic-card-back { background: linear-gradient(135deg, #a7f3d0, #6ee7b7); color: #064e3b; }
.magic-card.card-bg-5 .magic-card-back { background: linear-gradient(135deg, #fed7aa, #fdba74); color: #7c2d12; }

.magic-card-back i {
    opacity: 0.8;
}

.magic-card:hover {
    transform: translateY(-10px);
}

/* Admin Builder Styles */
.builder-field-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px dashed rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 12px;
    position: relative;
    transition: all 0.2s;
    cursor: move; /* Indicate draggable */
    color: #e5e7eb; /* Explicit text color */
}

.builder-field-item:hover {
    border-color: rgba(0, 210, 255, 0.4);
    background: rgba(255, 255, 255, 0.05);
}

.builder-field-item.dragging {
    opacity: 0.5;
    background: rgba(0, 210, 255, 0.1);
    border-color: #00d2ff;
}

.field-remove-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    color: #ef4444;
    cursor: pointer;
    opacity: 0.6;
    padding: 4px;
}

.field-remove-btn:hover {
    opacity: 1;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 4px;
}

/* Option Editor Styles */
.option-editor-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.option-editor-input {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 0.75rem;
    color: white;
}

.option-remove-btn {
    color: #94a3b8;
    cursor: pointer;
}
.option-remove-btn:hover {
    color: #ef4444;
}

.add-option-btn {
    width: 100%;
    padding: 6px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px dashed rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: #94a3b8;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.add-option-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* Custom Scrollbar for Admin Panel */
.custom-scrollbar::-webkit-scrollbar {
    width: 5px;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

/* Cursor Animation */
.typing-cursor {
    animation: blink 1s step-end infinite;
    display: inline-block;
    vertical-align: text-bottom;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* AI Validation Loader */
.ai-analyzing-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 12, 41, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 50;
    border-radius: 16px;
}

/* --- Real-time Voting Styles (Updated) --- */


/* VS Layout (2 Options) - Red & Blue Style */
.vote-vs-layout {
    display: flex;
    align-items: stretch;
    height: 50px;
    position: relative;
    border-radius: 25px;
    overflow: hidden;
    margin-top: 15px;
    background: #1a1642; /* Fallback */
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.vs-bar-left {
    background: linear-gradient(90deg, #3b82f6, #00d2ff); /* Blue/Cyan */
    height: 100%;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    padding-left: 15px;
    position: relative;
    min-width: 0; /* Allow shrinking */
}

.vs-bar-right {
    background: linear-gradient(90deg, #ec4899, #ef4444); /* Pink/Red */
    height: 100%;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 15px;
    position: relative;
    min-width: 0;
}

.vs-text {
    font-size: 12px;
    font-weight: bold;
    color: white;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    z-index: 10;
}

/* The VS Circle Badge */
.vs-center-badge {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 36px;
    height: 36px;
    background: #0f0c29;
    border: 3px solid #fbbf24; /* Gold border */
    border-radius: 50%;
    color: #fbbf24;
    font-weight: 900;
    font-style: italic;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    box-shadow: 0 0 15px rgba(251, 191, 36, 0.5);
    font-size: 14px;
}

/* Stats Row below VS bar */
.vs-stats-row {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 11px;
    color: #94a3b8;
    padding: 0 5px;
}

/* List Layout (3+ Options) - Updated */
.vote-list-layout {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 10px;
}

.vote-list-item {
    position: relative;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    height: 44px;
    overflow: hidden;
    /* Flex container for content */
    display: flex;
    align-items: center;
    padding: 0 15px;
}

/* The background bar that fills up */
.vote-list-progress {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    background: rgba(0, 210, 255, 0.15); /* Light Cyan */
    border-right: 2px solid rgba(0, 210, 255, 0.4);
    width: 0%;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1;
}

/* Content sits on top of progress bar */
.vote-list-content {
    position: relative;
    z-index: 2;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.vote-label-text {
    font-size: 13px;
    font-weight: 600;
    color: #e2e8f0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.vote-selected-badge {
    font-size: 9px;
    background: rgba(236, 72, 153, 0.2);
    color: #f9a8d4;
    padding: 1px 4px;
    border-radius: 4px;
    border: 1px solid rgba(236, 72, 153, 0.3);
}

.vote-stat-text {
    font-size: 12px;
    font-family: monospace;
    color: #94a3b8;
}

/* User selected item highlight style */
.vote-list-item.is-selected {
    border-color: rgba(236, 72, 153, 0.5); /* Pink border */
}

.vote-list-item.is-selected .vote-list-progress {
    background: rgba(236, 72, 153, 0.15); /* Pink bg */
    border-right-color: rgba(236, 72, 153, 0.5);
}

/* Face Control Cursor */
#face-cursor {
    transition: transform 0.1s linear;
}

/* AI Suggestion Modal Styles */
#ai-suggestion-modal {
    transition: opacity 0.3s ease;
}

#ai-suggestion-modal.visible {
    opacity: 1;
    pointer-events: auto;
}

#ai-suggestion-modal .scale-95 {
    transform: scale(0.95);
}

#ai-suggestion-modal .scale-100 {
    transform: scale(1);
    opacity: 1;
}

/* Admin Builder Voting Styles */
.builder-field-item[data-type="voting"] {
    border-color: rgba(236, 72, 153, 0.3);
    background: rgba(236, 72, 153, 0.05);
}