/* ============================================
   KAPSUL CALLS - 1-to-1 Audio Calls UI
   ============================================ */

/* Call Modal Base */
.call-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.call-modal.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.call-modal__content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    padding: 48px;
    text-align: center;
}

.call-modal__avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--yellow);
    box-shadow: 0 0 40px rgba(255, 215, 0, 0.3);
    animation: pulse-avatar 2s ease-in-out infinite;
}

@keyframes pulse-avatar {
    0%, 100% { 
        transform: scale(1);
        box-shadow: 0 0 40px rgba(255, 215, 0, 0.3);
    }
    50% { 
        transform: scale(1.05);
        box-shadow: 0 0 60px rgba(255, 215, 0, 0.5);
    }
}

.call-modal__name {
    font-size: 24px;
    font-weight: 700;
    color: var(--white);
    margin: 0;
}

.call-modal__status {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.7);
    margin: 0;
}

.call-modal--incoming .call-modal__status {
    animation: blink 1s ease-in-out infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Call Action Buttons */
.call-modal__actions {
    display: flex;
    gap: 32px;
    margin-top: 24px;
}

.call-btn {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.call-btn svg {
    width: 32px;
    height: 32px;
}

.call-btn--answer {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: white;
    animation: ring-pulse 1.5s ease-in-out infinite;
}

@keyframes ring-pulse {
    0%, 100% { 
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4);
    }
    50% { 
        transform: scale(1.1);
        box-shadow: 0 0 0 20px rgba(34, 197, 94, 0);
    }
}

.call-btn--answer:hover {
    transform: scale(1.1);
}

.call-btn--reject,
.call-btn--hangup {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}

.call-btn--reject:hover,
.call-btn--hangup:hover {
    transform: scale(1.1);
}

/* Active Call UI */
#active-call-ui {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    display: none;
    flex-direction: column;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.8) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 20px;
    padding-top: env(safe-area-inset-top, 20px);
}

#active-call-ui.active {
    display: flex;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from { transform: translateY(-100%); }
    to { transform: translateY(0); }
}

.active-call__header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.active-call__avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--yellow);
}

.active-call__info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.active-call__name {
    font-size: 18px;
    font-weight: 700;
    color: var(--white);
}

.active-call__timer {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    font-variant-numeric: tabular-nums;
}

.active-call__controls {
    display: flex;
    justify-content: center;
    gap: 24px;
}

.call-control-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.15);
    color: var(--white);
    transition: all 0.2s ease;
}

.call-control-btn svg {
    width: 24px;
    height: 24px;
}

.call-control-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

.call-control-btn.muted {
    background: rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

.call-control-btn--record {
    background: rgba(255, 255, 255, 0.15);
}

.call-control-btn--record.recording {
    background: #ef4444;
    animation: recording-pulse 1s ease-in-out infinite;
}

@keyframes recording-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.call-control-btn--hangup {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.call-control-btn--hangup:hover {
    transform: scale(1.1);
}

/* Call Publish Modal */
#call-publish-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(20px);
    padding: 20px;
}

#call-publish-modal.active {
    display: flex;
}

.call-publish-content {
    background: var(--black);
    border-radius: 24px;
    padding: 32px;
    width: 100%;
    max-width: 400px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.call-publish-content h2 {
    font-size: 20px;
    color: var(--white);
    margin: 0 0 8px 0;
}

.call-publish-info {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
    margin: 0 0 24px 0;
}

#call-publish-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

#call-publish-form input,
#call-publish-form textarea,
#call-publish-form select {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--white);
    font-size: 16px;
    transition: border-color 0.2s;
}

#call-publish-form input:focus,
#call-publish-form textarea:focus,
#call-publish-form select:focus {
    outline: none;
    border-color: var(--yellow);
}

#call-publish-form input::placeholder,
#call-publish-form textarea::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

#call-publish-form textarea {
    resize: none;
    height: 80px;
}

.call-publish-actions {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

.call-publish-actions button {
    flex: 1;
    padding: 14px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.call-publish-actions .btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--white);
}

.call-publish-actions .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.call-publish-actions .btn-primary {
    background: var(--yellow);
    border: none;
    color: var(--black);
}

.call-publish-actions .btn-primary:hover {
    background: #e6c200;
}

/* Profile Actions */
.profile-hero__actions {
    display: flex;
    gap: 12px;
    margin-top: 12px;
}

/* Profile Call Button */
.profile-call-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
}

.profile-call-btn svg {
    width: 20px;
    height: 20px;
}

.profile-call-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 20px rgba(34, 197, 94, 0.4);
}

.profile-call-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Call Settings Page */
.call-settings-page {
    padding: 20px;
    max-width: 600px;
    margin: 0 auto;
}

.call-settings-page h2 {
    font-size: 20px;
    color: var(--white);
    margin-bottom: 20px;
}

.call-setting-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 32px;
}

.call-setting-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.call-setting-option:hover {
    background: rgba(255, 255, 255, 0.1);
}

.call-setting-option input[type="radio"] {
    width: 20px;
    height: 20px;
    accent-color: var(--yellow);
}

.call-setting-option span {
    font-size: 16px;
    color: var(--white);
}

.call-lists {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.call-list h3 {
    font-size: 16px;
    color: var(--white);
    margin-bottom: 12px;
}

.call-list__items {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.call-list__item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
}

.call-list__item img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.call-list__item span {
    flex: 1;
    color: var(--white);
}

.call-list__item button {
    padding: 8px 12px;
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
}

/* Responsive */
@media (max-width: 480px) {
    .call-modal__avatar {
        width: 100px;
        height: 100px;
    }
    
    .call-modal__name {
        font-size: 20px;
    }
    
    .call-btn {
        width: 64px;
        height: 64px;
    }
    
    .call-btn svg {
        width: 28px;
        height: 28px;
    }
    
    .call-modal__actions {
        gap: 24px;
    }
}

/* Call History Page */
.call-history-page {
    padding: 0 16px 100px;
    max-width: 600px;
    margin: 0 auto;
}

.call-history-page .page-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 0;
    position: sticky;
    top: 0;
    background: var(--bg-primary);
    z-index: 10;
}

.call-history-page .page-header h1 {
    font-size: 20px;
    font-weight: 600;
    color: var(--white);
    margin: 0;
}

.call-history-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.call-history-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.call-history-item:hover {
    background: var(--bg-tertiary);
}

.call-history-item.missed .call-history-item__name,
.call-history-item.missed .call-history-item__icon {
    color: var(--danger);
}

.call-history-item__avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.call-history-item__info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.call-history-item__name {
    font-weight: 600;
    color: var(--white);
    font-size: 15px;
}

.call-history-item__meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}

.call-history-item__icon {
    width: 14px;
    height: 14px;
}

.call-history-item__call {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.call-history-item__call:hover {
    background: var(--primary-hover);
}

.call-history-item__call svg {
    width: 18px;
    height: 18px;
}
