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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

/* Header */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
}

header h1 {
    font-size: 28px;
    margin-bottom: 15px;
    font-weight: 600;
}

.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
}

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

.status-dot.connected {
    background: #10b981;
}

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

.connection-info {
    font-size: 13px;
    opacity: 0.9;
}

/* Main content */
main {
    padding: 30px;
}

/* Welcome message */
.welcome-message {
    text-align: center;
    padding: 60px 20px;
}

.welcome-message .icon {
    font-size: 80px;
    margin-bottom: 20px;
}

.welcome-message h2 {
    font-size: 24px;
    color: #333;
    margin-bottom: 10px;
}

.welcome-message p {
    font-size: 16px;
    color: #666;
    margin-bottom: 30px;
}

.instructions {
    max-width: 500px;
    margin: 0 auto;
    background: #f8f9fa;
    padding: 25px;
    border-radius: 12px;
    text-align: left;
}

.instructions h3 {
    font-size: 18px;
    margin-bottom: 15px;
    color: #333;
}

.instructions ol {
    padding-left: 25px;
}

.instructions li {
    margin-bottom: 10px;
    color: #555;
    line-height: 1.6;
}

/* Card display */
.card-display {
    animation: fadeIn 0.3s ease-in;
}

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

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.card-header h2 {
    font-size: 22px;
    color: #333;
}

.card-content {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

@media (max-width: 768px) {
    .card-content {
        grid-template-columns: 1fr;
    }
}

/* Photo section */
.photo-section {
    position: relative;
}

.photo-section img {
    width: 100%;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.photo-placeholder {
    width: 100%;
    aspect-ratio: 3/4;
    background: #f3f4f6;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
}

.photo-placeholder span {
    font-size: 48px;
    margin-bottom: 8px;
}

/* Info section */
.info-section {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

@media (max-width: 640px) {
    .field-row {
        grid-template-columns: 1fr;
    }
}

.field-group {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.field-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.field-value {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.field-value .value {
    flex: 1;
    font-size: 15px;
    color: #1f2937;
    word-break: break-word;
}

/* Copy button */
.copy-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.copy-btn:hover {
    background: #5568d3;
    transform: scale(1.05);
}

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

.copy-btn.copied {
    background: #10b981;
}

/* Controls */
.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 12px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

/* Buttons */
.btn-primary, .btn-secondary, .btn-small {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background: #4b5563;
}

.btn-small {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-primary:active, .btn-secondary:active, .btn-small:active {
    transform: scale(0.95);
}

/* Checkbox */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.checkbox-label span {
    font-size: 14px;
    color: #4b5563;
}

/* Event log */
.event-log {
    background: #1f2937;
    border-radius: 12px;
    overflow: hidden;
}

.log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #111827;
    color: white;
}

.log-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.log-content {
    max-height: 200px;
    overflow-y: auto;
    padding: 15px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
}

.log-entry {
    display: flex;
    gap: 15px;
    margin-bottom: 8px;
    padding: 6px 0;
    border-bottom: 1px solid #374151;
}

.log-entry:last-child {
    border-bottom: none;
}

.log-time {
    color: #9ca3af;
    flex-shrink: 0;
}

.log-message {
    flex: 1;
}

.log-info .log-message { color: #60a5fa; }
.log-success .log-message { color: #34d399; }
.log-warning .log-message { color: #fbbf24; }
.log-error .log-message { color: #f87171; }

/* Toast notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    animation: slideIn 0.3s ease-out;
}

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

.toast.success { border-left: 4px solid #10b981; }
.toast.error { border-left: 4px solid #ef4444; }
.toast.info { border-left: 4px solid #3b82f6; }
.toast.warning { border-left: 4px solid #f59e0b; }

.toast-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.toast-message {
    flex: 1;
    font-size: 14px;
    color: #333;
}

/* Scrollbar styling */
.log-content::-webkit-scrollbar {
    width: 6px;
}

.log-content::-webkit-scrollbar-track {
    background: #1f2937;
}

.log-content::-webkit-scrollbar-thumb {
    background: #4b5563;
    border-radius: 3px;
}

.log-content::-webkit-scrollbar-thumb:hover {
    background: #6b7280;
}

/* Cache indicator */
.cache-indicator {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    animation: fadeIn 0.3s ease-in;
}

.cache-indicator.cached {
    background: #fef3c7;
    border-left: 4px solid #f59e0b;
}

.cache-indicator.fresh {
    background: #d1fae5;
    border-left: 4px solid #10b981;
}

.cache-badge {
    font-size: 14px;
    font-weight: 600;
    display: inline-block;
}

.cache-badge.cached {
    color: #b45309;
}

.cache-badge.fresh {
    color: #047857;
}

.cache-timestamp {
    font-size: 13px;
    color: #6b7280;
}

.cache-hint {
    font-size: 12px;
    color: #92400e;
    font-style: italic;
}
