/* Base styles and CSS variables - Optix Theme */
:root {
    --primary-color: #F26722;
    --primary-dark: #d4541a;
    --primary-light: rgba(242, 103, 34, 0.1);
    --secondary-color: #64748b;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --background: rgb(41, 41, 41);
    --surface: rgba(0, 0, 0, 0.3);
    --surface-light: rgba(255, 255, 255, 0.05);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.8);
    --text-muted: rgba(255, 255, 255, 0.6);
    --border: rgba(242, 103, 34, 0.2);
    --border-hover: rgba(242, 103, 34, 0.5);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.3);
    --shadow-lg: 0 10px 30px rgba(242, 103, 34, 0.2);
    --border-radius: 20px;
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--background);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    overflow-x: hidden;
}

body.display-body {
    overflow-y: auto;
}

/* ===================
   SUBMISSION FORM STYLES
   =================== */

.container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    max-width: 500px;
    margin: 0 auto;
    padding: 20px;
}

.header {
    text-align: center;
    margin-bottom: 32px;
    padding-top: 20px;
}

.logo {
    height: 60px;
    width: auto;
    margin-bottom: 16px;
}

.header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.header p {
    color: var(--text-secondary);
    font-size: 16px;
}

.main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.form {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--border-radius);
    padding: 30px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.form:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-lg);
}

.form-group {
    margin-bottom: 20px;
}

.form-row {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
}

.form-group.half-width {
    flex: 1;
    margin-bottom: 0;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
    font-size: 14px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 16px;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: var(--surface-light);
    color: var(--text-primary);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-group select {
    cursor: pointer;
}

.field-hint {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-secondary);
    font-style: italic;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.char-count {
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    text-align: right;
}

.char-count.warning {
    color: var(--warning-color);
    font-weight: 600;
}

.submit-btn {
    width: 100%;
    padding: 16px 24px;
    background: var(--primary-color);
    color: white;
    border: 2px solid var(--primary-color);
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.submit-btn:hover:not(:disabled) {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.message {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    padding: 24px;
    text-align: center;
    box-shadow: var(--shadow);
}

.success-message {
    border-color: var(--success-color);
    background: rgb(16 185 129 / 0.05);
}

.success-message h3 {
    color: var(--success-color);
    margin-bottom: 8px;
}

.error-message {
    border-color: var(--error-color);
    background: rgb(239 68 68 / 0.05);
}

.error-message h3 {
    color: var(--error-color);
    margin-bottom: 8px;
}

.reset-btn {
    margin-top: 16px;
    padding: 8px 16px;
    background: transparent;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}

.reset-btn:hover {
    background: var(--primary-color);
    color: white;
}

.footer {
    margin-top: 32px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
}

.hidden {
    display: none !important;
}

/* ===================
   LIVE DISPLAY STYLES
   =================== */

.display-body {
    background: var(--background);
    color: #f8fafc;
    overflow: hidden;
}

.display-container {
    min-height: 100vh;
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0;
}

.display-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 32px;
    background: var(--surface);
    border-bottom: 2px solid var(--border);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    max-width: 1200px;
    margin: 0 auto;
}

.display-logo {
    height: 50px;
    width: auto;
}

.display-title {
    flex: 1;
    text-align: center;
    margin: 0 32px;
}

.display-title h1 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--primary-color);
    text-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.display-title p {
    color: #94a3b8;
    font-size: 16px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #cbd5e1;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.status-dot.connected {
    background: var(--success-color);
}

.status-dot.fetching {
    background: var(--warning-color);
}

.status-dot.error {
    background: var(--error-color);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.testimonials-container {
    padding: 32px;
    margin-top: 120px;
    margin-bottom: 200px;
    min-height: calc(100vh - 320px);
}

.testimonials-list {
    display: none;
    gap: 16px;
    flex-direction: column;
}

.testimonial-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    transform: translateY(0);
    opacity: 1;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.testimonial-item.new-testimonial {
    transform: translateY(20px);
    opacity: 0;
    animation: slideInUp 0.5s ease forwards;
}

.testimonial-item.removing {
    transform: translateY(-20px);
    opacity: 0;
    height: 0;
    padding: 0;
    margin: 0;
}

@keyframes slideInUp {
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.testimonial-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 8px;
}

.testimonial-name {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 16px;
    flex-shrink: 0;
}

.company-badge {
    display: inline-block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    background: rgba(100, 116, 139, 0.15);
    padding: 2px 8px;
    border-radius: 12px;
    margin-left: 8px;
    border: 1px solid rgba(100, 116, 139, 0.3);
}

.testimonial-time {
    font-size: 12px;
    color: #94a3b8;
    flex-shrink: 0;
    margin-left: auto;
}

.testimonial-rating {
    font-size: 14px;
    flex-shrink: 0;
    order: 2;
}

.testimonial-session {
    font-size: 12px;
    color: #fbbf24;
    background: rgba(251, 191, 36, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
    flex-shrink: 0;
    order: 3;
}

.testimonial-content {
    color: #e2e8f0;
    font-size: 16px;
    line-height: 1.5;
}

.no-testimonials {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    height: 400px;
    color: #64748b;
}

.waiting-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.7;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.no-testimonials h3 {
    font-size: 24px;
    margin-bottom: 8px;
    color: #94a3b8;
}

.no-testimonials p {
    font-size: 16px;
}

.display-footer {
    padding: 20px 32px;
    background: var(--surface);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10;
    max-width: 1200px;
    margin: 0 auto;
}

.qr-section {
    display: flex;
    align-items: center;
    gap: 16px;
}

.qr-container {
    position: relative;
    width: 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: 12px;
    padding: 8px;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
}

.qr-code {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 4px;
    display: none;
}

.qr-loading {
    font-size: 12px;
    color: #64748b;
    text-align: center;
    padding: 8px;
}

.qr-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.qr-text p {
    color: #cbd5e1;
    font-size: 14px;
    margin: 0;
    font-weight: 500;
}

.form-url {
    color: #94a3b8;
    font-size: 11px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    word-break: break-all;
    max-width: 200px;
}

.stats {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: #94a3b8;
    flex-shrink: 0;
}

.separator {
    opacity: 0.5;
}

/* ===================
   RESPONSIVE DESIGN
   =================== */

@media (max-width: 768px) {
    .container {
        padding: 16px;
    }
    
    .header h1 {
        font-size: 24px;
    }
    
    .form {
        padding: 20px;
    }
    
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .form-group.half-width {
        margin-bottom: 20px;
    }
    
    .display-header {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }
    
    .display-title {
        margin: 0;
    }
    
    .display-title h1 {
        font-size: 24px;
    }
    
    .testimonials-container {
        padding: 20px;
    }
    
    .display-footer {
        flex-direction: column;
        gap: 16px;
        text-align: center;
        padding: 16px 20px;
    }
    
    .qr-section {
        flex-direction: column;
        gap: 12px;
    }
    
    .qr-container {
        width: 100px;
        height: 100px;
    }
    
    .form-url {
        max-width: 280px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 12px;
    }
    
    .logo {
        height: 40px;
    }
    
    .display-logo {
        height: 35px;
    }
    
    .testimonial-item {
        padding: 16px;
    }
    
    .testimonials-container {
        padding: 16px;
    }
}

/* ===================
   PRINT STYLES
   =================== */

@media print {
    .display-header,
    .display-footer {
        display: none;
    }
    
    .testimonial-item {
        break-inside: avoid;
        margin-bottom: 12px;
    }
}

/* ===================
   WEBSOCKET REAL-TIME FEATURES
   =================== */

/* Connection status enhancements */
.status-dot.reconnecting {
    background-color: var(--warning-color);
    animation: pulse-warning 2s infinite;
}

.status-dot.polling {
    background-color: var(--primary-color);
    animation: pulse-slow 3s infinite;
}

.status-dot.disconnected {
    background-color: var(--text-muted);
    animation: none;
}

@keyframes pulse-warning {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.1);
    }
}

@keyframes pulse-slow {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    margin: 8px 0;
    background: rgba(242, 103, 34, 0.1);
    border: 1px solid rgba(242, 103, 34, 0.2);
    border-radius: 12px;
    color: var(--text-secondary);
    font-style: italic;
    animation: fadeInSlide 0.3s ease-out;
}

.typing-animation {
    display: flex;
    gap: 3px;
}

.typing-animation span {
    width: 4px;
    height: 4px;
    background-color: var(--primary-color);
    border-radius: 50%;
    animation: typing-bounce 1.4s infinite both;
}

.typing-animation span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-animation span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing-bounce {
    0%, 80%, 100% {
        transform: translateY(0);
        opacity: 0.5;
    }
    40% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

.typing-text {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Viewer count */
.viewer-count {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Reaction system */
.reactions-container {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    flex-wrap: wrap;
}

.reaction-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.05);
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    transition: all 0.2s ease;
}

.reaction-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.05);
}

.reaction-pulse {
    animation: reaction-pulse 0.5s ease-out;
}

@keyframes reaction-pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
        background: rgba(242, 103, 34, 0.3);
    }
    100% {
        transform: scale(1);
    }
}

/* Enhanced testimonial interactions */
.testimonial-item {
    position: relative;
}

/* Animation improvements */
@keyframes fadeInSlide {
    0% {
        opacity: 0;
        transform: translateY(10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Enhanced new testimonial animation */
.testimonial-item.new-testimonial {
    animation: newTestimonialSlide 0.5s ease-out;
}

@keyframes newTestimonialSlide {
    0% {
        opacity: 0;
        transform: translateX(-100%) scale(0.9);
    }
    50% {
        transform: translateX(0) scale(1.02);
    }
    100% {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

