/* Reset và Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    overflow-x: hidden;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
}

/* Header Styles */
.header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 10px;
}

.logo i {
    font-size: 2.5rem;
    color: #4FC3F7;
    animation: float 3s ease-in-out infinite;
}

.logo h1 {
    font-size: 2.2rem;
    font-weight: 600;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    font-weight: 300;
}

/* Tab Navigation */
.tab-navigation {
    display: flex;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 8px;
    margin-bottom: 30px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    padding: 15px 20px;
    color: white;
    font-size: 1rem;
    font-weight: 500;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.tab-btn.active {
    background: linear-gradient(135deg, #4FC3F7, #29B6F6);
    box-shadow: 0 4px 15px rgba(79, 195, 247, 0.4);
}

/* Tab Content */
.tab-content {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
    animation: fadeIn 0.5s ease-in-out;
}

/* Input Section */
.input-section h2,
.camera-section h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.5rem;
    font-weight: 600;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#message-input {
    width: 100%;
    padding: 15px;
    border: 2px solid #e1e5e9;
    border-radius: 12px;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    min-height: 120px;
    transition: border-color 0.3s ease;
}

#message-input:focus {
    outline: none;
    border-color: #4FC3F7;
    box-shadow: 0 0 0 3px rgba(79, 195, 247, 0.1);
}

/* Buttons */
.primary-btn, .secondary-btn, .copy-btn {
    background: linear-gradient(135deg, #4FC3F7, #29B6F6);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.primary-btn:hover, .copy-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(79, 195, 247, 0.4);
}

.secondary-btn {
    background: linear-gradient(135deg, #78909C, #607D8B);
}

.secondary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(120, 144, 156, 0.4);
}

/* Cloud Container */
.cloud-container, .shared-cloud-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 350px;
    background: radial-gradient(circle at center, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    border-radius: 25px;
    margin: 20px 0;
    overflow: hidden;
    border: 2px solid rgba(79, 195, 247, 0.3);
    box-shadow: 
        0 0 30px rgba(79, 195, 247, 0.2),
        inset 0 0 50px rgba(79, 195, 247, 0.1);
}

#qr-canvas, #shared-qr-canvas {
    position: relative;
    z-index: 2;
    border-radius: 15px;
    filter: drop-shadow(0 0 20px rgba(79, 195, 247, 0.3));
}

/* Cloud Overlay Effects */
.cloud-overlay, .shared-cloud-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 3;
    background: radial-gradient(circle at center, transparent 40%, rgba(79, 195, 247, 0.1) 70%);
}

.cloud-particles {
    position: absolute;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 25% 25%, rgba(79, 195, 247, 0.15) 1px, transparent 1px),
        radial-gradient(circle at 75% 75%, rgba(155, 206, 235, 0.1) 1px, transparent 1px),
        radial-gradient(circle at 50% 50%, rgba(52, 152, 219, 0.08) 1px, transparent 1px);
    background-size: 40px 40px, 30px 30px, 50px 50px;
    animation: cloudFloat 8s ease-in-out infinite;
}

/* Enhanced cloud floating animation */
@keyframes cloudFloat {
    0%, 100% { 
        transform: translateY(0px) scale(1);
        opacity: 0.7;
    }
    33% { 
        transform: translateY(-5px) scale(1.02);
        opacity: 0.9;
    }
    66% { 
        transform: translateY(3px) scale(0.98);
        opacity: 0.8;
    }
}

/* Share Section */
.share-section {
    margin-top: 30px;
}

.share-section h4 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.2rem;
    font-weight: 600;
}

.share-link-container {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

#share-link {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid #e1e5e9;
    border-radius: 10px;
    font-size: 0.9rem;
    background: #f8f9fa;
    font-family: 'Courier New', monospace;
}

.share-instruction {
    color: #666;
    font-size: 0.9rem;
    font-style: italic;
}

/* Camera Section */
.camera-section .instruction {
    color: #666;
    margin-bottom: 20px;
    font-size: 1rem;
}

.camera-container {
    position: relative;
    background: #000;
    border-radius: 15px;
    overflow: hidden;
    margin: 20px 0;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#camera-video {
    width: 100%;
    max-width: 400px;
    border-radius: 10px;
}

.scan-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    color: white;
    pointer-events: none;
}

.scan-frame {
    width: 200px;
    height: 200px;
    border: 3px solid #4FC3F7;
    border-radius: 15px;
    position: relative;
    animation: pulse 2s infinite;
}

.scan-frame::before,
.scan-frame::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 3px solid #4FC3F7;
}

.scan-frame::before {
    top: -3px;
    left: -3px;
    border-right: none;
    border-bottom: none;
}

.scan-frame::after {
    bottom: -3px;
    right: -3px;
    border-left: none;
    border-top: none;
}

.scan-text {
    margin-top: 20px;
    font-size: 1rem;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    transition: color 0.3s ease;
}

.scan-text.scan-success {
    color: #4CAF50;
    font-weight: bold;
}

.scan-text.scan-warning {
    color: #FF9800;
    font-weight: bold;
}

.scan-text.scan-scanning {
    color: #2196F3;
    animation: scanPulse 1.5s infinite;
}

.scan-info {
    margin-top: 10px;
}

.scan-info small {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8rem;
}

@keyframes scanPulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

.camera-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
}

/* Decoded Result */
.decoded-result {
    margin-top: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #E8F5E8, #C8E6C9);
    border-radius: 15px;
    border: 2px solid #4CAF50;
}

.decoded-result h3 {
    color: #2E7D32;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.decoded-message {
    display: flex;
    gap: 15px;
    align-items: flex-start;
}

.message-content {
    flex: 1;
    padding: 15px;
    background: white;
    border-radius: 10px;
    border: 1px solid #A5D6A7;
    font-size: 1rem;
    line-height: 1.5;
    word-break: break-word;
}

/* Shared Cloud Display */
.shared-cloud-display {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.shared-header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

.shared-header h2 {
    font-size: 2rem;
    margin-bottom: 10px;
}

.shared-header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

.shared-actions {
    margin-top: 30px;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

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

.loading-cloud {
    font-size: 4rem;
    color: #4FC3F7;
    margin-bottom: 20px;
    animation: float 2s ease-in-out infinite;
}

.loading-content p {
    font-size: 1.2rem;
}

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

.result-section {
    margin-top: 30px;
    animation: slideIn 0.5s ease-out;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

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

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(79, 195, 247, 0.7); }
    50% { box-shadow: 0 0 0 10px rgba(79, 195, 247, 0); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .logo h1 {
        font-size: 1.8rem;
    }
    
    .tab-content {
        padding: 20px;
    }
    
    .camera-controls {
        flex-direction: column;
        align-items: center;
    }
    
    .decoded-message {
        flex-direction: column;
    }
    
    .share-link-container {
        flex-direction: column;
    }
    
    .scan-frame {
        width: 150px;
        height: 150px;
    }
}