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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

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

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

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

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

/* Form styles */
.form-section {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    margin-bottom: 30px;
}

/* User info styles */
.user-info {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 20px;
}

.user-status {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.status-icon {
    font-size: 1.2rem;
    margin-right: 10px;
}

.status-text {
    font-weight: 600;
    font-size: 1rem;
}

.status-text.returning-user {
    color: #28a745;
}

.status-text.new-user {
    color: #007bff;
}

.user-id {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: #6c757d;
    background: white;
    padding: 8px 12px;
    border-radius: 5px;
    border: 1px solid #dee2e6;
}

.label-info {
    background: #e3f2fd;
    border: 1px solid #bbdefb;
    color: #1565c0;
    padding: 12px 15px;
    border-radius: 8px;
    margin: 0;
    font-size: 0.95rem;
    text-align: center;
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: #666;
    font-size: 0.9rem;
}

/* Button styles */
button {
    cursor: pointer;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
    padding: 12px 24px;
}

#generateBtn {
    width: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 30px;
    font-size: 18px;
    position: relative;
}

#generateBtn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

#generateBtn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
    transform: translateY(-2px);
}

/* Result section styles */
.result-section {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    margin-bottom: 30px;
}

.result-section h2 {
    color: #333;
    margin-bottom: 25px;
    text-align: center;
    font-size: 1.8rem;
}

.address-card {
    display: grid;
    grid-template-columns: 1fr 200px;
    gap: 30px;
    align-items: start;
}

.address-info {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.info-row {
    display: flex;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}

.info-row:last-child {
    border-bottom: none;
}

.info-row .label {
    font-weight: 600;
    color: #555;
    min-width: 150px;
    margin-right: 15px;
}

.info-row .value {
    flex: 1;
    color: #333;
    word-break: break-all;
    font-family: 'Courier New', monospace;
    background: #f8f9fa;
    padding: 8px 12px;
    border-radius: 5px;
    margin-right: 10px;
}

.copy-btn {
    background: #007bff;
    color: white;
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 4px;
    min-width: 60px;
}

.copy-btn:hover {
    background: #0056b3;
}

/* QR Code section */
.qr-section {
    text-align: center;
}

.qr-section h3 {
    margin-bottom: 15px;
    color: #555;
}

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

/* Actions */
.actions {
    grid-column: 1 / -1;
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
}

.actions button,
.actions a {
    flex: 1;
    max-width: 200px;
}

/* Error section */
.error-section {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    margin-bottom: 30px;
}

.error-section h2 {
    margin-bottom: 15px;
}

.error-message {
    margin-bottom: 20px;
    font-size: 1.1rem;
}

/* Loading animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s ease-in-out infinite;
}

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

/* CORS Notice styles */
.cors-notice {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 30px;
}

.cors-notice h3 {
    margin-bottom: 15px;
    color: #155724;
}

.cors-notice .proxy-info {
    background: white;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #c3e6cb;
    margin-top: 15px;
}

.cors-notice .proxy-info h4 {
    margin-bottom: 10px;
    color: #155724;
}

.cors-notice .proxy-info ul {
    margin: 10px 0;
    padding-left: 20px;
}

.cors-notice .proxy-info li {
    margin: 5px 0;
    color: #155724;
}

.cors-notice .proxy-info p {
    margin-top: 10px;
    font-weight: 500;
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .form-section,
    .result-section,
    .error-section {
        padding: 20px;
    }
    
    .address-card {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .info-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .info-row .label {
        min-width: auto;
        margin-right: 0;
    }
    
    .info-row .value {
        margin-right: 0;
        width: 100%;
    }
    
    .actions {
        flex-direction: column;
    }
    
    .actions button,
    .actions a {
        max-width: none;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.8rem;
    }
    
    .form-section,
    .result-section,
    .error-section {
        padding: 15px;
    }
}
