/* MemberShip Calls - MiniApp Styles */

/* CSS Variables */
:root {
    --primary-color: #667eea;
    --primary-dark: #5a67d8;
    --secondary-color: #764ba2;
    --success-color: #48bb78;
    --warning-color: #ed8936;
    --danger-color: #f56565;
    --bg-dark: #1a1a2e;
    --bg-darker: #16213e;
    --bg-card: #0f3460;
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.5);
    --border-radius: 12px;
    --transition: all 0.3s ease;
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background: linear-gradient(135deg, var(--bg-dark) 0%, var(--bg-darker) 100%);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    touch-action: manipulation;
}

/* Screen Management */
.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
}

.screen.active {
    display: flex;
}

/* Loading Screen */
#loading-screen {
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
}

.loading-content {
    text-align: center;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

/* Waiting Screen */
#waiting-screen {
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.waiting-content {
    text-align: center;
    max-width: 300px;
}

.waiting-icon {
    font-size: 64px;
    margin-bottom: 20px;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

.waiting-content h2 {
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.waiting-content p {
    color: var(--text-secondary);
    margin-bottom: 30px;
}

.participant-status {
    display: flex;
    justify-content: center;
    gap: 30px;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: var(--transition);
}

.status-item.connected .status-dot {
    background: var(--success-color);
    box-shadow: 0 0 10px var(--success-color);
}


/* Call Screen */
#call-screen {
    position: relative;
    background: var(--bg-dark);
}

/* Timer Container */
.timer-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    padding: 15px;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.7) 0%, transparent 100%);
    display: flex;
    justify-content: center;
}

.timer-display {
    font-size: 1.5rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    padding: 8px 20px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

.timer-display.warning {
    background: rgba(237, 137, 54, 0.8);
    animation: timer-pulse 1s ease-in-out infinite;
}

@keyframes timer-pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

/* Video Container */
.video-container {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.video-wrapper {
    position: absolute;
    overflow: hidden;
    background: var(--bg-darker);
}

.video-wrapper video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-wrapper.remote {
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.video-wrapper.local {
    bottom: 100px;
    right: 15px;
    width: 100px;
    height: 140px;
    border-radius: var(--border-radius);
    border: 2px solid rgba(255, 255, 255, 0.3);
    z-index: 5;
}

.video-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: var(--bg-card);
}

.video-placeholder.hidden {
    display: none;
}

.placeholder-icon {
    font-size: 64px;
    opacity: 0.5;
}

.video-wrapper.local .placeholder-icon {
    font-size: 32px;
}

.placeholder-text {
    margin-top: 10px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.participant-name {
    position: absolute;
    bottom: 10px;
    left: 10px;
    padding: 5px 12px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 15px;
    font-size: 0.85rem;
    backdrop-filter: blur(5px);
}

/* Connection Status */
.connection-status {
    position: absolute;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 16px;
    background: rgba(237, 137, 54, 0.9);
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 15;
}

.connection-status.hidden {
    display: none;
}

/* Gift Animation */
.gift-animation {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 20;
    text-align: center;
    pointer-events: none;
}

.gift-animation.hidden {
    display: none;
}

.gift-animation .gift-emoji {
    font-size: 100px;
    animation: gift-bounce 1s ease-out;
}

@keyframes gift-bounce {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    50% {
        transform: scale(1.3);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.gift-animation .gift-info {
    margin-top: 10px;
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

.gift-animation .gift-sender {
    display: block;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.gift-animation .gift-name {
    display: block;
    font-size: 1.1rem;
    font-weight: 600;
}


/* Controls Panel */
.controls-panel {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 15px 20px 25px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, transparent 100%);
    display: flex;
    justify-content: center;
    gap: 15px;
    z-index: 10;
}

.control-btn {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    backdrop-filter: blur(10px);
}

.control-btn:active {
    transform: scale(0.95);
}

.control-btn .icon-off {
    display: none;
}

.control-btn:not(.active) .icon-on {
    display: none;
}

.control-btn:not(.active) .icon-off {
    display: block;
}

.control-btn:not(.active) {
    background: rgba(245, 101, 101, 0.8);
}

.control-btn.end-call {
    background: var(--danger-color);
    transform: rotate(135deg);
}

.control-btn.end-call:active {
    transform: rotate(135deg) scale(0.95);
}

.badge {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: var(--danger-color);
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    justify-content: center;
    align-items: center;
}

.badge.hidden {
    display: none;
}

/* Slide Panels */
.slide-panel {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 60%;
    background: var(--bg-card);
    border-radius: 20px 20px 0 0;
    z-index: 25;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.slide-panel.active {
    transform: translateY(0);
}

.slide-panel.hidden {
    display: none;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.panel-header h3 {
    font-size: 1.1rem;
}

.close-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 1rem;
    cursor: pointer;
}

.panel-content {
    padding: 15px 20px;
    overflow-y: auto;
    max-height: calc(60vh - 60px);
}

/* Gift Panel */
.wallet-balance {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
    margin-bottom: 15px;
}

.balance-amount {
    font-weight: 700;
    color: var(--success-color);
}

.gift-catalog {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.gift-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
}

.gift-item:active {
    transform: scale(0.95);
}

.gift-item.selected {
    border-color: var(--primary-color);
    background: rgba(102, 126, 234, 0.2);
}

.gift-item .gift-emoji {
    font-size: 2rem;
    margin-bottom: 5px;
}

.gift-item .gift-name {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 3px;
}

.gift-item .gift-price {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary-color);
}

.send-gift-btn {
    width: 100%;
    padding: 15px;
    margin-top: 15px;
    background: var(--primary-color);
    border: none;
    border-radius: var(--border-radius);
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.send-gift-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}


/* Chat Panel */
.chat-messages {
    height: 200px;
    overflow-y: auto;
    margin-bottom: 15px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--border-radius);
}

.chat-message {
    margin-bottom: 10px;
    padding: 8px 12px;
    border-radius: 12px;
    max-width: 80%;
}

.chat-message.own {
    background: var(--primary-color);
    margin-left: auto;
}

.chat-message.other {
    background: rgba(255, 255, 255, 0.1);
}

.chat-message .sender {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 3px;
}

.chat-message .text {
    font-size: 0.9rem;
    word-wrap: break-word;
}

.chat-input-container {
    display: flex;
    gap: 10px;
}

#chat-input {
    flex: 1;
    padding: 12px 15px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 25px;
    color: white;
    font-size: 0.95rem;
}

#chat-input::placeholder {
    color: var(--text-muted);
}

.send-btn {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: none;
    background: var(--primary-color);
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
}

/* Summary Screen */
#summary-screen {
    justify-content: center;
    align-items: center;
    padding: 20px;
    background: linear-gradient(135deg, var(--bg-dark) 0%, var(--bg-darker) 100%);
}

.summary-content {
    text-align: center;
    max-width: 320px;
    width: 100%;
}

.summary-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.summary-content h2 {
    font-size: 1.5rem;
    margin-bottom: 30px;
}

.summary-stats {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 30px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-item:last-child {
    border-bottom: none;
}

.stat-label {
    color: var(--text-secondary);
}

.stat-value {
    font-weight: 700;
    font-size: 1.1rem;
}

.stat-item.highlight .stat-value {
    color: var(--success-color);
    font-size: 1.3rem;
}

/* Error Screen */
#error-screen {
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.error-content {
    text-align: center;
    max-width: 300px;
}

.error-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.error-content h2 {
    margin-bottom: 10px;
}

.error-content p {
    color: var(--text-secondary);
    margin-bottom: 30px;
}

/* Buttons */
.primary-btn {
    width: 100%;
    padding: 15px 30px;
    background: var(--primary-color);
    border: none;
    border-radius: var(--border-radius);
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 10px;
}

.primary-btn:active {
    transform: scale(0.98);
}

.secondary-btn {
    width: 100%;
    padding: 15px 30px;
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--border-radius);
    color: white;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
}

.danger-btn {
    width: 100%;
    padding: 15px 30px;
    background: var(--danger-color);
    border: none;
    border-radius: var(--border-radius);
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--bg-card);
    padding: 25px;
    border-radius: var(--border-radius);
    max-width: 300px;
    width: 90%;
    text-align: center;
}

.modal-content h3 {
    margin-bottom: 10px;
}

.modal-content p {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.modal-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Responsive adjustments */
@media (max-height: 600px) {
    .video-wrapper.local {
        width: 80px;
        height: 110px;
        bottom: 80px;
    }

    .controls-panel {
        padding: 10px 15px 20px;
    }

    .control-btn {
        width: 48px;
        height: 48px;
        font-size: 1.3rem;
    }
}