/**
 * PWA Specific Styles
 * Camera, Audio Recording, and PWA enhancements
 */

/* ===== PWA INSTALL PROMPT ===== */
.pwa-install-prompt {
    position: fixed;
    bottom: 80px;
    left: 16px;
    right: 16px;
    background: var(--bg-color);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 4px 20px var(--shadow);
    z-index: 1000;
    display: none;
    animation: slideUp 0.3s ease;
}

.pwa-install-prompt.show {
    display: block;
}

.pwa-install-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pwa-install-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.pwa-install-icon img {
    width: 32px;
    height: 32px;
}

.pwa-install-text {
    flex: 1;
}

.pwa-install-text h4 {
    margin: 0 0 4px 0;
    font-size: 14px;
    color: var(--text-primary);
}

.pwa-install-text p {
    margin: 0;
    font-size: 12px;
    color: var(--text-secondary);
}

.pwa-install-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.pwa-install-btn {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.pwa-install-btn.primary {
    background: var(--primary-color);
    color: white;
}

.pwa-install-btn.secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* ===== CAMERA MODAL - DISABLED FOR FUTURE RELEASE ===== */
/*
.camera-modal {
    background: #000;
}

.camera-modal-content {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #000;
}

.camera-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.5);
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
}

.camera-close-btn,
.camera-switch-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.camera-close-btn:hover,
.camera-switch-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.camera-title {
    color: white;
    font-size: 16px;
    font-weight: 500;
}

.camera-preview-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.camera-preview-container video,
.camera-preview-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #000;
}

#capturedImage {
    object-fit: contain;
    background: #000;
}

#recordedVideo {
    object-fit: contain;
    background: #000;
}

#cameraPreview {
    transform: scaleX(-1);
}

#cameraPreview.back-camera {
    transform: scaleX(1);
}

.camera-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 40px;
    padding: 24px;
    background: rgba(0, 0, 0, 0.5);
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
}

.camera-spacer {
    flex: 1;
}

.camera-capture-btn {
    width: 72px;
    height: 72px;
    border: 4px solid white;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    padding: 4px;
}

.capture-inner {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: white;
    transition: all 0.2s;
}

.camera-capture-btn:hover .capture-inner {
    transform: scale(0.9);
}

.camera-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 60px;
    padding: 24px;
    background: rgba(0, 0, 0, 0.5);
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
}

.camera-action-btn {
    width: 56px;
    height: 56px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.2s;
}

.camera-action-btn.cancel {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.camera-action-btn.send {
    background: var(--primary-color);
    color: white;
}

.camera-action-btn:hover {
    transform: scale(1.1);
}
*/

/* ===== CAMERA BUTTON IN INPUT - DISABLED ===== */
/*
.camera-btn {
    color: var(--icon-color);
}

.camera-btn:hover {
    color: var(--primary-color);
}
*/

/* ===== PRODUCT MODAL ===== */
.product-search {
    margin-bottom: 16px;
}

.product-search input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    background: var(--bg-color);
    color: var(--text-primary);
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    max-height: 400px;
    overflow-y: auto;
}

.product-card {
    background: var(--bg-secondary);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.product-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow);
}

.product-card.selected {
    border-color: var(--primary-color);
}

.product-image {
    width: 100%;
    height: 100px;
    object-fit: cover;
    background: var(--bg-color);
}

.product-info {
    padding: 10px;
}

.product-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-price {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary-color);
}

/* ===== MEDIA MESSAGE STYLES ===== */
.message-media {
    max-width: 280px;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 4px;
}

.message-media img,
.message-media video {
    width: 100%;
    display: block;
}

.message-document {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    margin-bottom: 4px;
}

.document-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: #f44336;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
}

.document-info {
    flex: 1;
    min-width: 0;
}

.document-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.document-size {
    font-size: 11px;
    color: var(--text-secondary);
}

.message-payment-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: linear-gradient(135deg, #20c997 0%, #17a2b8 100%);
    border-radius: 8px;
    margin-bottom: 4px;
    color: white;
}

.payment-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.payment-info {
    flex: 1;
}

.payment-amount {
    font-size: 18px;
    font-weight: 600;
}

.payment-description {
    font-size: 12px;
    opacity: 0.9;
}

.message-product {
    background: var(--bg-secondary);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 4px;
}

.message-product img {
    width: 100%;
    height: 120px;
    object-fit: cover;
}

.message-product-info {
    padding: 10px;
}

.message-product-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.message-product-price {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary-color);
}

/* ===== UPLOAD PROGRESS ===== */
.upload-progress {
    position: fixed;
    bottom: 80px;
    left: 16px;
    right: 16px;
    background: var(--bg-color);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 4px 20px var(--shadow);
    z-index: 1000;
    display: none;
}

.upload-progress.show {
    display: block;
    animation: slideUp 0.3s ease;
}

.upload-progress-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.upload-progress-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.upload-progress-text {
    flex: 1;
}

.upload-progress-text h4 {
    margin: 0;
    font-size: 14px;
    color: var(--text-primary);
}

.upload-progress-text p {
    margin: 0;
    font-size: 12px;
    color: var(--text-secondary);
}

.upload-progress-bar {
    height: 4px;
    background: var(--bg-secondary);
    border-radius: 2px;
    overflow: hidden;
}

.upload-progress-fill {
    height: 100%;
    background: var(--primary-color);
    border-radius: 2px;
    transition: width 0.3s ease;
    width: 0%;
}

/* ===== RTL SUPPORT ===== */
[dir="rtl"] .camera-header {
    flex-direction: row-reverse;
}

[dir="rtl"] .recording-content {
    flex-direction: row-reverse;
}

[dir="rtl"] .pwa-install-content {
    flex-direction: row-reverse;
}

[dir="rtl"] .message-document,
[dir="rtl"] .message-payment-link {
    flex-direction: row-reverse;
}

/* ===== ANIMATIONS ===== */
@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

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

.recording-timer {
    animation: pulse 1s ease-in-out infinite;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 480px) {
    .camera-controls {
        gap: 24px;
        padding: 16px;
    }
    
    .camera-capture-btn {
        width: 64px;
        height: 64px;
    }
    
    .camera-mode-btn {
        width: 40px;
        height: 40px;
    }
    
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
